Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 893048 Details for
Bug 1092498
FindVariableInstancesByNameCommand do not work for JMS API
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Patch for VariableHistoryTest
BZ-1092498-test-fix.patch (text/plain), 10.26 KB, created by
Marco Rietveld
on 2014-05-07 01:00:15 UTC
(
hide
)
Description:
Patch for VariableHistoryTest
Filename:
MIME Type:
Creator:
Marco Rietveld
Created:
2014-05-07 01:00:15 UTC
Size:
10.26 KB
patch
obsolete
>From c19e263b9213d3bb3f8e0e0f71555c763996096e Mon Sep 17 00:00:00 2001 >From: Marco Rietveld <mrietvel@redhat.com> >Date: Wed, 7 May 2014 02:50:17 +0200 >Subject: [PATCH] BZ-1092498 - fixes for FindVariableInstancesByNameCommand and > Json serialization > >--- > .../jbpm/integration/remote/JmsController.java | 4 +-- > .../rest/wb/JaxbJacksonObjectMapperResolver.java | 42 ++++++++++++++++++++++ > .../jboss/qa/bpms/rest/wb/RestWorkbenchClient.java | 38 ++++++++++++++------ > .../remote/history/VariableHistoryTest.java | 8 ++--- > 4 files changed, 76 insertions(+), 16 deletions(-) > create mode 100644 framework-rest/src/main/java/org/jboss/qa/bpms/rest/wb/JaxbJacksonObjectMapperResolver.java > >diff --git a/framework-rest/src/main/java/org/jboss/qa/bpms/jbpm/integration/remote/JmsController.java b/framework-rest/src/main/java/org/jboss/qa/bpms/jbpm/integration/remote/JmsController.java >index 7407c03..e86233f 100644 >--- a/framework-rest/src/main/java/org/jboss/qa/bpms/jbpm/integration/remote/JmsController.java >+++ b/framework-rest/src/main/java/org/jboss/qa/bpms/jbpm/integration/remote/JmsController.java >@@ -344,7 +344,7 @@ public class JmsController implements RemoteController { > **************************************************************/ > > public List<VariableInstanceLog> getVariableHistory(String variableId) throws Exception { >- Command<?> cmd = new FindVariableInstancesByNameCommand(variableId); >+ Command<?> cmd = new FindVariableInstancesByNameCommand(variableId, false); > JaxbCommandsRequest req = new JaxbCommandsRequest(cmd); > JaxbCommandResponse<?> resp = sendJmsJaxbCommandsRequest(sessionQueueName, req).getResponses().get(0); > List<AuditEvent> history = (List<AuditEvent>) resp.getResult(); >@@ -356,7 +356,7 @@ public class JmsController implements RemoteController { > } > > public List<VariableInstanceLog> getVariableHistoryByValue(String variableId, String value) throws Exception { >- Command<?> cmd = new FindVariableInstancesByNameCommand(variableId, value); >+ Command<?> cmd = new FindVariableInstancesByNameCommand(variableId, value, false); > JaxbCommandsRequest req = new JaxbCommandsRequest(cmd); > JaxbCommandResponse<?> resp = sendJmsJaxbCommandsRequest(sessionQueueName, req).getResponses().get(0); > List<AuditEvent> history = (List<AuditEvent>) resp.getResult(); >diff --git a/framework-rest/src/main/java/org/jboss/qa/bpms/rest/wb/JaxbJacksonObjectMapperResolver.java b/framework-rest/src/main/java/org/jboss/qa/bpms/rest/wb/JaxbJacksonObjectMapperResolver.java >new file mode 100644 >index 0000000..297d67e >--- /dev/null >+++ b/framework-rest/src/main/java/org/jboss/qa/bpms/rest/wb/JaxbJacksonObjectMapperResolver.java >@@ -0,0 +1,42 @@ >+package org.jboss.qa.bpms.rest.wb; >+ >+import javax.ws.rs.Produces; >+import javax.ws.rs.core.MediaType; >+import javax.ws.rs.ext.ContextResolver; >+import javax.ws.rs.ext.Provider; >+ >+import org.codehaus.jackson.map.AnnotationIntrospector; >+import org.codehaus.jackson.map.ObjectMapper; >+import org.codehaus.jackson.xc.JaxbAnnotationIntrospector; >+ >+@Provider >+@Produces(MediaType.APPLICATION_JSON) >+public class JaxbJacksonObjectMapperResolver implements ContextResolver<ObjectMapper> { >+ >+ // Do not make this static: there are no gaurantees about the thread-safety of the Jackson code >+ private final ObjectMapper objectMapper = new JaxbJacksonObjectMapper(); >+ >+ @Override >+ public ObjectMapper getContext(Class<?> type) { >+ return objectMapper; >+ } >+ >+ public static class JaxbJacksonObjectMapper extends ObjectMapper { >+ >+ public JaxbJacksonObjectMapper() { >+ super(); >+ >+ final AnnotationIntrospector introspector = new JaxbAnnotationIntrospector(); >+ >+ this.configure(org.codehaus.jackson.map.DeserializationConfig.Feature.UNWRAP_ROOT_VALUE, true); >+ this.configure(org.codehaus.jackson.map.SerializationConfig.Feature.WRAP_ROOT_VALUE, true); >+ >+ this.configure(org.codehaus.jackson.map.SerializationConfig.Feature.USE_STATIC_TYPING, true); >+ this.enableDefaultTyping(DefaultTyping.NON_FINAL); >+ >+ this.setDeserializationConfig(this.getDeserializationConfig().withAnnotationIntrospector(introspector)); >+ this.setSerializationConfig(this.getSerializationConfig().withAnnotationIntrospector(introspector)); >+ this.setAnnotationIntrospector(introspector); >+ } >+ } >+} >\ No newline at end of file >diff --git a/framework-rest/src/main/java/org/jboss/qa/bpms/rest/wb/RestWorkbenchClient.java b/framework-rest/src/main/java/org/jboss/qa/bpms/rest/wb/RestWorkbenchClient.java >index 6f3f8fd..272574b 100644 >--- a/framework-rest/src/main/java/org/jboss/qa/bpms/rest/wb/RestWorkbenchClient.java >+++ b/framework-rest/src/main/java/org/jboss/qa/bpms/rest/wb/RestWorkbenchClient.java >@@ -14,6 +14,7 @@ import org.apache.http.client.CredentialsProvider; > import org.apache.http.client.HttpClient; > import org.apache.http.impl.client.BasicCredentialsProvider; > import org.apache.http.impl.client.HttpClientBuilder; >+import org.jboss.qa.bpms.rest.wb.JaxbJacksonObjectMapperResolver.JaxbJacksonObjectMapper; > import org.jboss.resteasy.client.ClientExecutor; > import org.jboss.resteasy.client.ClientRequest; > import org.jboss.resteasy.client.ClientRequestFactory; >@@ -34,8 +35,10 @@ import org.kie.workbench.common.services.shared.rest.InstallProjectRequest; > import org.kie.workbench.common.services.shared.rest.JobRequest; > import org.kie.workbench.common.services.shared.rest.JobResult; > import org.kie.workbench.common.services.shared.rest.JobStatus; >+import org.kie.workbench.common.services.shared.rest.OrganizationalUnit; > import org.kie.workbench.common.services.shared.rest.RemoveRepositoryFromOrganizationalUnitRequest; > import org.kie.workbench.common.services.shared.rest.RemoveRepositoryRequest; >+import org.kie.workbench.common.services.shared.rest.RepositoryRequest; > import org.kie.workbench.common.services.shared.rest.RepositoryResponse; > import org.slf4j.Logger; > import org.slf4j.LoggerFactory; >@@ -52,6 +55,10 @@ public class RestWorkbenchClient implements WorkbenchClient { > private final String userId; > private final String password; > >+ static { >+ ResteasyProviderFactory.getInstance().registerProvider(JaxbJacksonObjectMapperResolver.class); >+ } >+ > private <T extends Object> T get(ClientRequest request, Class<T> returnType) { > return process(request, GET, returnType); > } >@@ -163,9 +170,16 @@ public class RestWorkbenchClient implements WorkbenchClient { > > public JobRequest createRepository(String repo, String cloneRepoUrl) { > LOG.info("Cloning repo '{}' from URL '{}'", repo, cloneRepoUrl); >- String input = "{\"name\":\"" + repo >- + "\",\"description\":\"\",\"userName\":\"\",\"password\":\"\",\"requestType\":\"clone\",\"gitURL\":\"" >- + cloneRepoUrl + "\"}"; >+ RepositoryRequest repoRequest = new RepositoryRequest(); >+ repoRequest.setName(repo); >+ repoRequest.setRequestType("clone"); >+ repoRequest.setGitURL(cloneRepoUrl); >+ String input = null; >+ try { >+ input = new JaxbJacksonObjectMapper().writeValueAsString(repoRequest); >+ } catch(Exception e) { >+ throw new RuntimeException("Unable to serialize RepositoryRequest", e); >+ } > return post(createRequest(appUrl + "/rest/repositories/", input), CreateOrCloneRepositoryRequest.class); > } > >@@ -194,15 +208,19 @@ public class RestWorkbenchClient implements WorkbenchClient { > > public JobRequest createOrganizationalUnit(String name, String owner, String... repositories) { > LOG.info("Creating organizational unit '{}' owned by '{}' containing [{}]", name, owner, repositories); >- String repositoriesLine = ""; >+ OrganizationalUnit ou = new OrganizationalUnit(); >+ ou.setRepositories(new ArrayList<String>()); > for (int i = 0; repositories != null && i < repositories.length; ++i) { >- repositoriesLine += "\"" + repositories[i] + "\""; >- if (i + 1 < repositories.length) { >- repositoriesLine += ","; >- } >+ ou.getRepositories().add(repositories[i]); >+ } >+ ou.setName(name); >+ ou.setOwner(owner); >+ String input = null; >+ try { >+ input = new JaxbJacksonObjectMapper().writeValueAsString(ou); >+ } catch(Exception e) { >+ throw new RuntimeException("Unable to serialize " + ou.getClass().getSimpleName(), e); > } >- String input = "{\"name\":\"" + name + "\",\"description\":\"\",\"owner\":\"" + owner + "\",\"repositories\":[" >- + repositoriesLine + "]}"; > return post(createRequest(appUrl + "/rest/organizationalunits/", input), CreateOrganizationalUnitRequest.class); > } > >diff --git a/test-jbpm-integration/src/test/java/org/jboss/qa/bpms/jbpm/integration/remote/history/VariableHistoryTest.java b/test-jbpm-integration/src/test/java/org/jboss/qa/bpms/jbpm/integration/remote/history/VariableHistoryTest.java >index 193cbcb..30db2f2 100644 >--- a/test-jbpm-integration/src/test/java/org/jboss/qa/bpms/jbpm/integration/remote/history/VariableHistoryTest.java >+++ b/test-jbpm-integration/src/test/java/org/jboss/qa/bpms/jbpm/integration/remote/history/VariableHistoryTest.java >@@ -24,8 +24,8 @@ import org.junit.runners.Parameterized.Parameters; > import org.kie.api.runtime.process.ProcessInstance; > > @RunWith(Parameterized.class) >-@BZ("1070097") >-@IssueConstraint(id = "1070097", variable = "rc", value = JmsController.JmsControllerId) >+// @BZ("1070097") >+//@IssueConstraint(id = "1070097", variable = "rc", value = JmsController.JmsControllerId) > public class VariableHistoryTest extends BusinessCentralBase { > > private RemoteController rc; >@@ -134,8 +134,8 @@ public class VariableHistoryTest extends BusinessCentralBase { > } > > @Test >- @BZ("1069568") >- @IssueConstraint(id = "1069568", variable = "rc", value = RestController.RestControllerId) >+ // @BZ("1069568") >+ // @IssueConstraint(id = "1069568", variable = "rc", value = RestController.RestControllerId) > public void testProcessInstanceHistoryByVariableByValue() throws Exception { > Map<String, Object> parameters = new HashMap<String, Object>(); > parameters.put("var1", "testProcessInstanceHistoryByVariableByValue1"); >-- >1.8.2 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1092498
: 893048