You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by dm...@apache.org on 2018/11/30 10:19:18 UTC

[camel] 05/05: CAMEL-12964: Fix CS

This is an automated email from the ASF dual-hosted git repository.

dmvolod pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 9201574991b083771ec5bf3ab19e6e08f02c4d48
Author: Dmitry Volodin <dm...@gmail.com>
AuthorDate: Fri Nov 30 13:18:23 2018 +0300

    CAMEL-12964: Fix CS
---
 .../jbpm/server/CamelKieServerExtension.java       | 29 +++++------
 .../jbpm/workitem/AbstractCamelCommand.java        | 60 ++++++++++------------
 .../workitem/AbstractCamelWorkItemHandler.java     |  1 -
 .../workitem/DeploymentContextCamelCommand.java    |  5 +-
 .../jbpm/workitem/GlobalContextCamelCommand.java   |  8 ++-
 .../jbpm/workitem/InOnlyCamelWorkItemHandler.java  |  1 -
 .../jbpm/workitem/InOutCamelWorkItemHandler.java   |  1 -
 .../jbpm/JBPMComponentIntegrationTest.java         |  1 -
 .../CamelWorkItemHandlerIntegrationTests.java      |  5 +-
 .../DeploymentContextCamelCommandTest.java         |  9 ++--
 .../workitem/GlobalContextCamelCommandTest.java    | 59 ++++++++++-----------
 .../workitem/InOnlyCamelWorkItemHandlerTest.java   | 11 ++--
 .../workitem/InOutCamelWorkItemHandlerTest.java    | 12 ++---
 13 files changed, 92 insertions(+), 110 deletions(-)

diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/server/CamelKieServerExtension.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/server/CamelKieServerExtension.java
index 659a498..1783b04 100644
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/server/CamelKieServerExtension.java
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/server/CamelKieServerExtension.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.jbpm.server;
 
 import java.io.InputStream;
@@ -44,7 +43,7 @@ public class CamelKieServerExtension implements KieServerExtension {
 
     private static final Boolean DISABLED = Boolean.parseBoolean(System.getProperty("org.camel.server.ext.disabled", "false"));
 
-    protected DefaultCamelContext camel;
+    protected DefaultCamelContext camelContext;
 
     protected boolean managedCamel;
 
@@ -54,14 +53,14 @@ public class CamelKieServerExtension implements KieServerExtension {
         this.managedCamel = true;
     }
 
-    public CamelKieServerExtension(DefaultCamelContext camel) {
-        this.camel = camel;
+    public CamelKieServerExtension(DefaultCamelContext camelContext) {
+        this.camelContext = camelContext;
         this.managedCamel = false;
     }
 
     @Override
     public boolean isInitialized() {
-        return camel != null;
+        return camelContext != null;
     }
 
     @Override
@@ -71,31 +70,31 @@ public class CamelKieServerExtension implements KieServerExtension {
 
     @Override
     public void init(KieServerImpl kieServer, KieServerRegistry registry) {
-        if (this.managedCamel && this.camel == null) {
-            this.camel = new DefaultCamelContext();
-            this.camel.setName("KIE Server Camel context");
+        if (this.managedCamel && this.camelContext == null) {
+            this.camelContext = new DefaultCamelContext();
+            this.camelContext.setName("KIE Server Camel context");
 
             try (InputStream is = this.getClass().getResourceAsStream("/global-camel-routes.xml")) {
                 if (is != null) {
 
-                    RoutesDefinition routes = camel.loadRoutesDefinition(is);
-                    camel.addRouteDefinitions(routes.getRoutes());
+                    RoutesDefinition routes = camelContext.loadRoutesDefinition(is);
+                    camelContext.addRouteDefinitions(routes.getRoutes());
                 }
             } catch (Exception e) {
                 LOGGER.error("Error while adding Camel context for KIE Server", e);
             }
         }
 
-        ServiceRegistry.get().register(JBPMConstants.GLOBAL_CAMEL_CONTEXT_SERVICE_KEY, this.camel);
+        ServiceRegistry.get().register(JBPMConstants.GLOBAL_CAMEL_CONTEXT_SERVICE_KEY, this.camelContext);
     }
 
     @Override
     public void destroy(KieServerImpl kieServer, KieServerRegistry registry) {
         ServiceRegistry.get().remove("GlobalCamelService");
 
-        if (this.managedCamel && this.camel != null) {
+        if (this.managedCamel && this.camelContext != null) {
             try {
-                this.camel.stop();
+                this.camelContext.stop();
             } catch (Exception e) {
                 LOGGER.error("Failed at stopping KIE Server extension {}", EXTENSION_NAME);
             }
@@ -184,9 +183,9 @@ public class CamelKieServerExtension implements KieServerExtension {
 
     @Override
     public void serverStarted() {
-        if (this.managedCamel && this.camel != null && !this.camel.isStarted()) {
+        if (this.managedCamel && this.camelContext != null && !this.camelContext.isStarted()) {
             try {
-                this.camel.start();
+                this.camelContext.start();
             } catch (Exception e) {
                 LOGGER.error("Failed at start Camel context", e);
             }
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelCommand.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelCommand.java
index a26aa32..1900960 100644
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelCommand.java
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelCommand.java
@@ -14,20 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.jbpm.workitem;
 
-import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.ExchangeBuilder;
 import org.apache.camel.component.jbpm.JBPMConstants;
-import org.jbpm.services.api.service.ServiceRegistry;
 import org.kie.api.executor.Command;
 import org.kie.api.executor.CommandContext;
 import org.kie.api.executor.ExecutionResults;
-import org.kie.api.runtime.manager.RuntimeManager;
 import org.kie.api.runtime.process.WorkItem;
 import org.kie.internal.runtime.Cacheable;
 import org.slf4j.Logger;
@@ -45,41 +41,41 @@ import org.slf4j.LoggerFactory;
  * {@link Message} is provided via the <code>Message</code> parameter. This gives the user access to more advanced fields like message headers 
  * and attachments.
  */
-public abstract class AbstractCamelCommand implements Command,
-                                          Cacheable {
-
-    private static final Logger logger = LoggerFactory.getLogger(AbstractCamelCommand.class);
+public abstract class AbstractCamelCommand implements Command, Cacheable {
+    private static final Logger LOGGER = LoggerFactory.getLogger(AbstractCamelCommand.class);
 
-	public AbstractCamelCommand() {
-	}
-	
+    public AbstractCamelCommand() {
+    }
+    
     @Override
     public ExecutionResults execute(CommandContext ctx) throws Exception {
         
         WorkItem workItem = (WorkItem) ctx.getData("workItem");
-    	
-    	String camelEndpointId = (String) workItem.getParameter(JBPMConstants.CAMEL_ENDPOINT_ID_WI_PARAM);
-		
-		// We only support direct. We don't need to support more, as direct simply gives us the entrypoint into the actual Camel Routes.
-		String camelUri = "direct://" + camelEndpointId;
-		
-		ProducerTemplate producerTemplate = getProducerTemplate(ctx);
-		Exchange inExchange = ExchangeBuilder.anExchange(producerTemplate.getCamelContext()).withBody(workItem).build();
-		Exchange outExchange = producerTemplate.send(camelUri, inExchange);
-		// producerTemplate.send does not throw exceptions, instead they are set on the returned Exchange.
-		if (outExchange.getException() != null) {
-			throw outExchange.getException();
-		}
-		Message outMessage = outExchange.getOut();
-		
-		ExecutionResults results = new ExecutionResults();
-		Object response = outMessage.getBody();
-		results.setData(JBPMConstants.RESPONSE_WI_PARAM, response);
-		results.setData(JBPMConstants.MESSAGE_WI_PARAM, outMessage);
-    	
+      
+        String camelEndpointId = (String) workItem.getParameter(JBPMConstants.CAMEL_ENDPOINT_ID_WI_PARAM);
+
+        // We only support direct. We don't need to support more, as direct simply gives us the entrypoint into the actual Camel Routes.
+        String camelUri = "direct://" + camelEndpointId;
+        
+        ProducerTemplate producerTemplate = getProducerTemplate(ctx);
+        Exchange inExchange = ExchangeBuilder.anExchange(producerTemplate.getCamelContext()).withBody(workItem).build();
+        Exchange outExchange = producerTemplate.send(camelUri, inExchange);
+
+        // producerTemplate.send does not throw exceptions, instead they are set on the returned Exchange.
+        if (outExchange.getException() != null) {
+            throw outExchange.getException();
+        }
+
+        Message outMessage = outExchange.getOut();
+
+        ExecutionResults results = new ExecutionResults();
+        Object response = outMessage.getBody();
+        results.setData(JBPMConstants.RESPONSE_WI_PARAM, response);
+        results.setData(JBPMConstants.MESSAGE_WI_PARAM, outMessage);
+
         return results;
     }
-    
+
     protected abstract ProducerTemplate getProducerTemplate(CommandContext ctx);
 
 }
\ No newline at end of file
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelWorkItemHandler.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelWorkItemHandler.java
index 23d7a35..d5ea7df 100644
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelWorkItemHandler.java
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelWorkItemHandler.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.jbpm.workitem;
 
 import org.apache.camel.CamelContext;
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommand.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommand.java
index 009b909..69c74ad 100644
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommand.java
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommand.java
@@ -32,11 +32,10 @@ import org.slf4j.LoggerFactory;
  * CamelCommand that uses the {@link CamelContext} registered on the {@link ServiceRegistry} for this specific deployment.
  */
 public class DeploymentContextCamelCommand extends AbstractCamelCommand {
+    private static final Logger LOGGER = LoggerFactory.getLogger(DeploymentContextCamelCommand.class);
 
     private final Map<String, ProducerTemplate> templates = new ConcurrentHashMap<>();
 
-    private static final Logger logger = LoggerFactory.getLogger(DeploymentContextCamelCommand.class);
-
     @Override
     protected ProducerTemplate getProducerTemplate(CommandContext ctx) {
         String deploymentId = (String) ctx.getData("deploymentId");
@@ -62,7 +61,7 @@ public class DeploymentContextCamelCommand extends AbstractCamelCommand {
             try {
                 nextTemplate.stop();
             } catch (Exception e) {
-                logger.warn("Error encountered while closing the Camel Producer Template.", e);
+                LOGGER.warn("Error encountered while closing the Camel Producer Template.", e);
                 // Not much we can do here, so swallowing exception.
             }
         }
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommand.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommand.java
index e129a12..aa46014 100644
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommand.java
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommand.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.jbpm.workitem;
 
 import org.apache.camel.CamelContext;
@@ -29,10 +28,9 @@ import org.slf4j.LoggerFactory;
  * CamelCommand that uses the global {@link CamelContext} registered on the {@link ServiceRegistry}.
  */
 public class GlobalContextCamelCommand extends AbstractCamelCommand {
-
-    private final ProducerTemplate globalContextProducerTemplate;
+    private static final Logger LOGGER = LoggerFactory.getLogger(GlobalContextCamelCommand.class);
     
-    private static final Logger logger = LoggerFactory.getLogger(GlobalContextCamelCommand.class);
+    private final ProducerTemplate globalContextProducerTemplate;
     
     public GlobalContextCamelCommand() {
         CamelContext globalCamelContext = (CamelContext) ServiceRegistry.get().service(JBPMConstants.GLOBAL_CAMEL_CONTEXT_SERVICE_KEY);
@@ -49,7 +47,7 @@ public class GlobalContextCamelCommand extends AbstractCamelCommand {
         try {
             this.globalContextProducerTemplate.stop();
         } catch (Exception e) {
-            logger.warn("Error encountered while closing the Camel Producer Template.", e);
+            LOGGER.warn("Error encountered while closing the Camel Producer Template.", e);
             // Not much we can do here, so swallowing exception.
         }
     }
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandler.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandler.java
index b97b0ad..b20bcda 100644
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandler.java
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandler.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.jbpm.workitem;
 
 import org.apache.camel.Exchange;
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandler.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandler.java
index a8482dd..6b6ef5f 100644
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandler.java
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandler.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.jbpm.workitem;
 
 import java.util.HashMap;
diff --git a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/JBPMComponentIntegrationTest.java b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/JBPMComponentIntegrationTest.java
index fbab216..046b118 100644
--- a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/JBPMComponentIntegrationTest.java
+++ b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/JBPMComponentIntegrationTest.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.jbpm;
 
 import java.util.HashMap;
diff --git a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/CamelWorkItemHandlerIntegrationTests.java b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/CamelWorkItemHandlerIntegrationTests.java
index 4e594dd..67d54fb 100644
--- a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/CamelWorkItemHandlerIntegrationTests.java
+++ b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/CamelWorkItemHandlerIntegrationTests.java
@@ -14,11 +14,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.jbpm.workitem;
 
-import static org.hamcrest.CoreMatchers.*;
-
 import org.apache.camel.EndpointInject;
 import org.apache.camel.Produce;
 import org.apache.camel.ProducerTemplate;
@@ -33,6 +30,8 @@ import org.jbpm.services.api.service.ServiceRegistry;
 import org.junit.Test;
 import org.kie.api.runtime.process.WorkItemHandler;
 
+import static org.hamcrest.CoreMatchers.*;
+
 //http://camel.apache.org/using-getin-or-getout-methods-on-exchange.html
 //http://camel.apache.org/async.html
 public class CamelWorkItemHandlerIntegrationTests extends CamelTestSupport {
diff --git a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommandTest.java b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommandTest.java
index e1aef21..b0086b9 100644
--- a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommandTest.java
+++ b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommandTest.java
@@ -14,13 +14,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.jbpm.workitem;
 
-import static org.junit.Assert.*;
-import static org.mockito.ArgumentMatchers.*;
-import static org.mockito.Mockito.*;
-
 import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
@@ -37,6 +32,10 @@ import org.kie.api.runtime.manager.RuntimeManager;
 import org.mockito.Mock;
 import org.mockito.junit.MockitoJUnitRunner;
 
+import static org.junit.Assert.*;
+import static org.mockito.ArgumentMatchers.*;
+import static org.mockito.Mockito.*;
+
 @RunWith(MockitoJUnitRunner.class)
 public class DeploymentContextCamelCommandTest {
     
diff --git a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommandTest.java b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommandTest.java
index 048ec72..031bc69 100644
--- a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommandTest.java
+++ b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommandTest.java
@@ -14,13 +14,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.jbpm.workitem;
 
-import static org.junit.Assert.*;
-import static org.mockito.ArgumentMatchers.*;
-import static org.mockito.Mockito.*;
-
 import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
@@ -37,10 +32,14 @@ import org.kie.api.runtime.manager.RuntimeManager;
 import org.mockito.Mock;
 import org.mockito.junit.MockitoJUnitRunner;
 
+import static org.junit.Assert.*;
+import static org.mockito.ArgumentMatchers.*;
+import static org.mockito.Mockito.*;
+
 @RunWith(MockitoJUnitRunner.class)
 public class GlobalContextCamelCommandTest {
 
-	@Mock
+    @Mock
     ProducerTemplate producerTemplate;
 
     @Mock
@@ -61,38 +60,36 @@ public class GlobalContextCamelCommandTest {
     @Test
     public void testExecuteGlobalCommand() throws Exception {
     
-    	String camelEndpointId = "testCamelRoute";
-    	String camelRouteUri = "direct://" + camelEndpointId;
-    	
-    	String testReponse = "testResponse";
-    	
-    	String runtimeManagerId = "testRuntimeManager";
-    	
-    	when(producerTemplate.send(eq(camelRouteUri), any(Exchange.class))).thenReturn(outExchange);
-    	
-    	
-    	when(producerTemplate.getCamelContext()).thenReturn(camelContext);
-    	
-    	when(camelContext.createProducerTemplate()).thenReturn(producerTemplate);
-    	
-    	when(outExchange.getOut()).thenReturn(outMessage);
-    	when(outMessage.getBody()).thenReturn(testReponse);
-    	
-    	//Register the RuntimeManager bound camelcontext.
-    	ServiceRegistry.get().register(JBPMConstants.GLOBAL_CAMEL_CONTEXT_SERVICE_KEY, camelContext);
-    	
+        String camelEndpointId = "testCamelRoute";
+        String camelRouteUri = "direct://" + camelEndpointId;
+
+        String testReponse = "testResponse";
+
+        String runtimeManagerId = "testRuntimeManager";
+
+        when(producerTemplate.send(eq(camelRouteUri), any(Exchange.class))).thenReturn(outExchange);
+
+        when(producerTemplate.getCamelContext()).thenReturn(camelContext);
+
+        when(camelContext.createProducerTemplate()).thenReturn(producerTemplate);
+
+        when(outExchange.getOut()).thenReturn(outMessage);
+        when(outMessage.getBody()).thenReturn(testReponse);
+
+        //Register the RuntimeManager bound camelContext.
+        ServiceRegistry.get().register(JBPMConstants.GLOBAL_CAMEL_CONTEXT_SERVICE_KEY, camelContext);
+
         WorkItemImpl workItem = new WorkItemImpl();
         workItem.setParameter(JBPMConstants.CAMEL_ENDPOINT_ID_WI_PARAM, camelEndpointId);
         workItem.setParameter("Request", "someRequest");
-        
+
         when(commandContext.getData(anyString())).thenReturn(workItem);
-        
+
         Command command = new GlobalContextCamelCommand();
         ExecutionResults results = command.execute(commandContext);
-        
-        
+
         assertNotNull(results);
         assertEquals(2, results.getData().size());
         assertEquals(testReponse, results.getData().get(JBPMConstants.RESPONSE_WI_PARAM));
     }
-}
+}
\ No newline at end of file
diff --git a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandlerTest.java b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandlerTest.java
index a862f22..b97822e 100644
--- a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandlerTest.java
+++ b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandlerTest.java
@@ -14,14 +14,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.jbpm.workitem;
 
-import static org.hamcrest.CoreMatchers.*;
-import static org.junit.Assert.*;
-import static org.mockito.ArgumentMatchers.*;
-import static org.mockito.Mockito.*;
-
 import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
@@ -39,6 +33,11 @@ import org.mockito.ArgumentMatchers;
 import org.mockito.Mock;
 import org.mockito.junit.MockitoJUnitRunner;
 
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.*;
+import static org.mockito.ArgumentMatchers.*;
+import static org.mockito.Mockito.*;
+
 @RunWith(MockitoJUnitRunner.class)
 public class InOnlyCamelWorkItemHandlerTest {
 
diff --git a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandlerTest.java b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandlerTest.java
index 1277f04..578de78 100644
--- a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandlerTest.java
+++ b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandlerTest.java
@@ -14,14 +14,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.jbpm.workitem;
 
-import static org.hamcrest.CoreMatchers.*;
-import static org.junit.Assert.*;
-import static org.mockito.ArgumentMatchers.*;
-import static org.mockito.Mockito.*;
-
 import java.util.Map;
 
 import org.apache.camel.CamelContext;
@@ -41,6 +35,12 @@ import org.mockito.ArgumentMatchers;
 import org.mockito.Mock;
 import org.mockito.junit.MockitoJUnitRunner;
 
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.*;
+import static org.mockito.ArgumentMatchers.*;
+import static org.mockito.Mockito.*;
+
+
 @RunWith(MockitoJUnitRunner.class)
 public class InOutCamelWorkItemHandlerTest {