camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject [13/17] camel git commit: CAMEL-9748: fix CS
Date Sat, 17 Dec 2016 11:53:52 GMT
http://git-wip-us.apache.org/repos/asf/camel/blob/7d2907d2/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/cinder/VolumeProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/cinder/VolumeProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/cinder/VolumeProducerTest.java
index 8464cae..580b91c 100644
--- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/cinder/VolumeProducerTest.java
+++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/cinder/VolumeProducerTest.java
@@ -16,21 +16,11 @@
  */
 package org.apache.camel.component.openstack.cinder;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
+import java.util.UUID;
 
 import org.apache.camel.component.openstack.cinder.producer.VolumeProducer;
-
 import org.junit.Before;
 import org.junit.Test;
-
 import org.mockito.ArgumentCaptor;
 import org.mockito.Matchers;
 import org.mockito.Mock;
@@ -39,121 +29,128 @@ import org.openstack4j.model.common.ActionResponse;
 import org.openstack4j.model.storage.block.Volume;
 import org.openstack4j.model.storage.block.builder.VolumeBuilder;
 
-import java.util.UUID;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 public class VolumeProducerTest extends CinderProducerTestSupport {
 
-	@Mock
-	private Volume testOSVolume;
-
-	private Volume dummyVolume;
-
-	@Before
-	public void setUp() {
-		producer = new VolumeProducer(endpoint, client);
-
-		when(volumeService.create(Matchers.any(org.openstack4j.model.storage.block.Volume.class))).thenReturn(testOSVolume);
-		when(volumeService.get(Matchers.anyString())).thenReturn(testOSVolume);
-
-		dummyVolume = createTestVolume();
-		when(testOSVolume.getId()).thenReturn(UUID.randomUUID().toString());
-		when(testOSVolume.getName()).thenReturn(dummyVolume.getName());
-		when(testOSVolume.getDescription()).thenReturn(dummyVolume.getDescription());
-		when(testOSVolume.getImageRef()).thenReturn(dummyVolume.getImageRef());
-		when(testOSVolume.getSize()).thenReturn(dummyVolume.getSize());
-		when(testOSVolume.getVolumeType()).thenReturn(dummyVolume.getVolumeType());
-	}
-
-	@Test
-	public void createVolumeTest() throws Exception {
-		when(endpoint.getOperation()).thenReturn(CinderConstants.CREATE);
-		msg.setBody(dummyVolume);
-		producer.process(exchange);
-		assertEqualVolumes(dummyVolume, msg.getBody(Volume.class));
-	}
-
-	@Test
-	public void updateVolumeTest() throws Exception {
-		when(volumeService.update(anyString(), anyString(), anyString())).thenReturn(ActionResponse.actionSuccess());
-		msg.setHeader(CinderConstants.OPERATION, CinderConstants.UPDATE);
-		final String id = "id";
-		final String desc = "newDesc";
-		final String name = "newName";
-		msg.setHeader(CinderConstants.ID, id);
-		msg.setHeader(CinderConstants.DESCRIPTION, desc);
-		msg.setHeader(CinderConstants.NAME, name);
-
-		producer.process(exchange);
-
-		ArgumentCaptor<String> idCaptor = ArgumentCaptor.forClass(String.class);
-		ArgumentCaptor<String> nameCaptor = ArgumentCaptor.forClass(String.class);
-		ArgumentCaptor<String> descCaptor = ArgumentCaptor.forClass(String.class);
-		verify(volumeService).update(idCaptor.capture(), nameCaptor.capture(), descCaptor.capture());
-
-		assertEquals(id, idCaptor.getValue());
-		assertEquals(name, nameCaptor.getValue());
-		assertEquals(desc, descCaptor.getValue());
-		assertFalse(msg.isFault());
-		assertNull(msg.getBody());
-	}
-
-	@Test
-	public void updateVolumeFailTest() throws Exception {
-		final String faultMessage = "fault";
-		when(volumeService.update(anyString(), anyString(), anyString())).thenReturn(ActionResponse.actionFailed(faultMessage, 401));
-
-		msg.setHeader(CinderConstants.OPERATION, CinderConstants.UPDATE);
-		final String id = "id";
-		msg.setHeader(CinderConstants.ID, id);
-		msg.setBody(createTestVolume());
-
-		producer.process(exchange);
-
-		assertTrue(msg.isFault());
-		assertTrue(msg.getBody(String.class).contains(faultMessage));
-	}
-
-	@Test
-	public void getVolumeTest() throws Exception {
-		when(endpoint.getOperation()).thenReturn(CinderConstants.GET);
-		msg.setHeader(CinderConstants.ID, "anyID");
-		producer.process(exchange);
-
-		assertEqualVolumes(dummyVolume, msg.getBody(Volume.class));
-	}
-
-	@Test
-	public void deleteVolumeTest() throws Exception {
-		msg.setHeader(CinderConstants.OPERATION, CinderConstants.DELETE);
-		when(volumeService.delete(anyString())).thenReturn(ActionResponse.actionSuccess());
-		final String id = "id";
-		msg.setHeader(CinderConstants.ID, id);
-
-		producer.process(exchange);
-
-		ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
-		verify(volumeService).delete(captor.capture());
-		assertEquals(id, captor.getValue());
-
-		assertFalse(msg.isFault());
-	}
-
-	private void assertEqualVolumes(Volume old, Volume newVolume) {
-		assertEquals(old.getName(), newVolume.getName());
-		assertEquals(old.getDescription(), newVolume.getDescription());
-		assertEquals(old.getImageRef(), newVolume.getImageRef());
-		assertEquals(old.getSize(), newVolume.getSize());
-		assertEquals(old.getVolumeType(), newVolume.getVolumeType());
-
-		assertNotNull(newVolume.getId());
-	}
-
-	private Volume createTestVolume() {
-		VolumeBuilder builder = Builders.volume()
-				.name("name")
-				.description("description")
-				.imageRef("ref").size(20)
-				.volumeType("type");
-		return builder.build();
-	}
+    @Mock
+    private Volume testOSVolume;
+
+    private Volume dummyVolume;
+
+    @Before
+    public void setUp() {
+        producer = new VolumeProducer(endpoint, client);
+
+        when(volumeService.create(Matchers.any(org.openstack4j.model.storage.block.Volume.class))).thenReturn(testOSVolume);
+        when(volumeService.get(Matchers.anyString())).thenReturn(testOSVolume);
+
+        dummyVolume = createTestVolume();
+        when(testOSVolume.getId()).thenReturn(UUID.randomUUID().toString());
+        when(testOSVolume.getName()).thenReturn(dummyVolume.getName());
+        when(testOSVolume.getDescription()).thenReturn(dummyVolume.getDescription());
+        when(testOSVolume.getImageRef()).thenReturn(dummyVolume.getImageRef());
+        when(testOSVolume.getSize()).thenReturn(dummyVolume.getSize());
+        when(testOSVolume.getVolumeType()).thenReturn(dummyVolume.getVolumeType());
+    }
+
+    @Test
+    public void createVolumeTest() throws Exception {
+        when(endpoint.getOperation()).thenReturn(CinderConstants.CREATE);
+        msg.setBody(dummyVolume);
+        producer.process(exchange);
+        assertEqualVolumes(dummyVolume, msg.getBody(Volume.class));
+    }
+
+    @Test
+    public void updateVolumeTest() throws Exception {
+        when(volumeService.update(anyString(), anyString(), anyString())).thenReturn(ActionResponse.actionSuccess());
+        msg.setHeader(CinderConstants.OPERATION, CinderConstants.UPDATE);
+        final String id = "id";
+        final String desc = "newDesc";
+        final String name = "newName";
+        msg.setHeader(CinderConstants.ID, id);
+        msg.setHeader(CinderConstants.DESCRIPTION, desc);
+        msg.setHeader(CinderConstants.NAME, name);
+
+        producer.process(exchange);
+
+        ArgumentCaptor<String> idCaptor = ArgumentCaptor.forClass(String.class);
+        ArgumentCaptor<String> nameCaptor = ArgumentCaptor.forClass(String.class);
+        ArgumentCaptor<String> descCaptor = ArgumentCaptor.forClass(String.class);
+        verify(volumeService).update(idCaptor.capture(), nameCaptor.capture(), descCaptor.capture());
+
+        assertEquals(id, idCaptor.getValue());
+        assertEquals(name, nameCaptor.getValue());
+        assertEquals(desc, descCaptor.getValue());
+        assertFalse(msg.isFault());
+        assertNull(msg.getBody());
+    }
+
+    @Test
+    public void updateVolumeFailTest() throws Exception {
+        final String faultMessage = "fault";
+        when(volumeService.update(anyString(), anyString(), anyString())).thenReturn(ActionResponse.actionFailed(faultMessage, 401));
+
+        msg.setHeader(CinderConstants.OPERATION, CinderConstants.UPDATE);
+        final String id = "id";
+        msg.setHeader(CinderConstants.ID, id);
+        msg.setBody(createTestVolume());
+
+        producer.process(exchange);
+
+        assertTrue(msg.isFault());
+        assertTrue(msg.getBody(String.class).contains(faultMessage));
+    }
+
+    @Test
+    public void getVolumeTest() throws Exception {
+        when(endpoint.getOperation()).thenReturn(CinderConstants.GET);
+        msg.setHeader(CinderConstants.ID, "anyID");
+        producer.process(exchange);
+
+        assertEqualVolumes(dummyVolume, msg.getBody(Volume.class));
+    }
+
+    @Test
+    public void deleteVolumeTest() throws Exception {
+        msg.setHeader(CinderConstants.OPERATION, CinderConstants.DELETE);
+        when(volumeService.delete(anyString())).thenReturn(ActionResponse.actionSuccess());
+        final String id = "id";
+        msg.setHeader(CinderConstants.ID, id);
+
+        producer.process(exchange);
+
+        ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
+        verify(volumeService).delete(captor.capture());
+        assertEquals(id, captor.getValue());
+
+        assertFalse(msg.isFault());
+    }
+
+    private void assertEqualVolumes(Volume old, Volume newVolume) {
+        assertEquals(old.getName(), newVolume.getName());
+        assertEquals(old.getDescription(), newVolume.getDescription());
+        assertEquals(old.getImageRef(), newVolume.getImageRef());
+        assertEquals(old.getSize(), newVolume.getSize());
+        assertEquals(old.getVolumeType(), newVolume.getVolumeType());
+
+        assertNotNull(newVolume.getId());
+    }
+
+    private Volume createTestVolume() {
+        VolumeBuilder builder = Builders.volume()
+                .name("name")
+                .description("description")
+                .imageRef("ref").size(20)
+                .volumeType("type");
+        return builder.build();
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/7d2907d2/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/cinder/VolumeSnapshotProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/cinder/VolumeSnapshotProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/cinder/VolumeSnapshotProducerTest.java
index 3173f1a..4ab2144 100644
--- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/cinder/VolumeSnapshotProducerTest.java
+++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/cinder/VolumeSnapshotProducerTest.java
@@ -16,20 +16,11 @@
  */
 package org.apache.camel.component.openstack.cinder;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
+import java.util.UUID;
 
 import org.apache.camel.component.openstack.cinder.producer.SnapshotProducer;
-
 import org.junit.Before;
 import org.junit.Test;
-
 import org.mockito.ArgumentCaptor;
 import org.mockito.Matchers;
 import org.mockito.Mock;
@@ -37,100 +28,106 @@ import org.openstack4j.api.Builders;
 import org.openstack4j.model.common.ActionResponse;
 import org.openstack4j.model.storage.block.VolumeSnapshot;
 
-import java.util.UUID;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 public class VolumeSnapshotProducerTest extends CinderProducerTestSupport {
 
-	@Mock
-	private VolumeSnapshot testOSVolumeSnapshot;
-
-	private VolumeSnapshot dummyVolumeSnapshot;
-
-	@Before
-	public void setUp() {
-		producer = new SnapshotProducer(endpoint, client);
-
-		when(snapshotService.create(Matchers.any(VolumeSnapshot.class))).thenReturn(testOSVolumeSnapshot);
-		when(snapshotService.get(Matchers.anyString())).thenReturn(testOSVolumeSnapshot);
-
-		dummyVolumeSnapshot = createTestVolume();
-		when(testOSVolumeSnapshot.getId()).thenReturn(UUID.randomUUID().toString());
-		when(testOSVolumeSnapshot.getName()).thenReturn(dummyVolumeSnapshot.getName());
-		when(testOSVolumeSnapshot.getDescription()).thenReturn(dummyVolumeSnapshot.getDescription());
-		when(testOSVolumeSnapshot.getVolumeId()).thenReturn(dummyVolumeSnapshot.getVolumeId());
-	}
-
-	@Test
-	public void createVolumeTest() throws Exception {
-		when(endpoint.getOperation()).thenReturn(CinderConstants.CREATE);
-		msg.setBody(dummyVolumeSnapshot);
-		producer.process(exchange);
-		final VolumeSnapshot result = msg.getBody(VolumeSnapshot.class);
-		assertEqualsVolumeSnapshots(dummyVolumeSnapshot, result);
-		assertNotNull(result.getId());
-	}
-
-	@Test
-	public void updateVolumeSnapshotTest() throws Exception {
-		when(snapshotService.update(anyString(), anyString(), anyString())).thenReturn(ActionResponse.actionSuccess());
-		msg.setHeader(CinderConstants.OPERATION, CinderConstants.UPDATE);
-		final String id = "id";
-		final String desc = "newDesc";
-		final String name = "newName";
-		msg.setHeader(CinderConstants.ID, id);
-		msg.setHeader(CinderConstants.DESCRIPTION, desc);
-		msg.setHeader(CinderConstants.NAME, name);
-
-		producer.process(exchange);
-
-		ArgumentCaptor<String> idCaptor = ArgumentCaptor.forClass(String.class);
-		ArgumentCaptor<String> nameCaptor = ArgumentCaptor.forClass(String.class);
-		ArgumentCaptor<String> descCaptor = ArgumentCaptor.forClass(String.class);
-		verify(snapshotService).update(idCaptor.capture(), nameCaptor.capture(), descCaptor.capture());
-
-		assertEquals(id, idCaptor.getValue());
-		assertEquals(name, nameCaptor.getValue());
-		assertEquals(desc, descCaptor.getValue());
-		assertFalse(msg.isFault());
-		assertNull(msg.getBody());
-	}
-
-
-	@Test
-	public void getVolumeSnapshotTest() throws Exception {
-		when(endpoint.getOperation()).thenReturn(CinderConstants.GET);
-		msg.setHeader(CinderConstants.ID, "anyID");
-		producer.process(exchange);
-
-		assertEqualsVolumeSnapshots(dummyVolumeSnapshot, msg.getBody(VolumeSnapshot.class));
-	}
-
-	@Test
-	public void deleteVolumeSnapshotTest() throws Exception {
-		msg.setHeader(CinderConstants.OPERATION, CinderConstants.DELETE);
-		when(snapshotService.delete(anyString())).thenReturn(ActionResponse.actionSuccess());
-		final String id = "id";
-		msg.setHeader(CinderConstants.ID, id);
-
-		producer.process(exchange);
-
-		ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
-		verify(snapshotService).delete(captor.capture());
-		assertEquals(id, captor.getValue());
-		assertFalse(msg.isFault());
-	}
-
-	private void assertEqualsVolumeSnapshots(VolumeSnapshot old, VolumeSnapshot newVolumeSn) {
-		assertEquals(old.getName(), newVolumeSn.getName());
-		assertEquals(old.getDescription(), newVolumeSn.getDescription());
-		assertEquals(old.getVolumeId(), newVolumeSn.getVolumeId());
-	}
-
-	private VolumeSnapshot createTestVolume() {
-		return Builders.volumeSnapshot()
-				.description("descr")
-				.name("name")
-				.volume("volId")
-				.build();
-	}
+    @Mock
+    private VolumeSnapshot testOSVolumeSnapshot;
+
+    private VolumeSnapshot dummyVolumeSnapshot;
+
+    @Before
+    public void setUp() {
+        producer = new SnapshotProducer(endpoint, client);
+
+        when(snapshotService.create(Matchers.any(VolumeSnapshot.class))).thenReturn(testOSVolumeSnapshot);
+        when(snapshotService.get(Matchers.anyString())).thenReturn(testOSVolumeSnapshot);
+
+        dummyVolumeSnapshot = createTestVolume();
+        when(testOSVolumeSnapshot.getId()).thenReturn(UUID.randomUUID().toString());
+        when(testOSVolumeSnapshot.getName()).thenReturn(dummyVolumeSnapshot.getName());
+        when(testOSVolumeSnapshot.getDescription()).thenReturn(dummyVolumeSnapshot.getDescription());
+        when(testOSVolumeSnapshot.getVolumeId()).thenReturn(dummyVolumeSnapshot.getVolumeId());
+    }
+
+    @Test
+    public void createVolumeTest() throws Exception {
+        when(endpoint.getOperation()).thenReturn(CinderConstants.CREATE);
+        msg.setBody(dummyVolumeSnapshot);
+        producer.process(exchange);
+        final VolumeSnapshot result = msg.getBody(VolumeSnapshot.class);
+        assertEqualsVolumeSnapshots(dummyVolumeSnapshot, result);
+        assertNotNull(result.getId());
+    }
+
+    @Test
+    public void updateVolumeSnapshotTest() throws Exception {
+        when(snapshotService.update(anyString(), anyString(), anyString())).thenReturn(ActionResponse.actionSuccess());
+        msg.setHeader(CinderConstants.OPERATION, CinderConstants.UPDATE);
+        final String id = "id";
+        final String desc = "newDesc";
+        final String name = "newName";
+        msg.setHeader(CinderConstants.ID, id);
+        msg.setHeader(CinderConstants.DESCRIPTION, desc);
+        msg.setHeader(CinderConstants.NAME, name);
+
+        producer.process(exchange);
+
+        ArgumentCaptor<String> idCaptor = ArgumentCaptor.forClass(String.class);
+        ArgumentCaptor<String> nameCaptor = ArgumentCaptor.forClass(String.class);
+        ArgumentCaptor<String> descCaptor = ArgumentCaptor.forClass(String.class);
+        verify(snapshotService).update(idCaptor.capture(), nameCaptor.capture(), descCaptor.capture());
+
+        assertEquals(id, idCaptor.getValue());
+        assertEquals(name, nameCaptor.getValue());
+        assertEquals(desc, descCaptor.getValue());
+        assertFalse(msg.isFault());
+        assertNull(msg.getBody());
+    }
+
+
+    @Test
+    public void getVolumeSnapshotTest() throws Exception {
+        when(endpoint.getOperation()).thenReturn(CinderConstants.GET);
+        msg.setHeader(CinderConstants.ID, "anyID");
+        producer.process(exchange);
+
+        assertEqualsVolumeSnapshots(dummyVolumeSnapshot, msg.getBody(VolumeSnapshot.class));
+    }
+
+    @Test
+    public void deleteVolumeSnapshotTest() throws Exception {
+        msg.setHeader(CinderConstants.OPERATION, CinderConstants.DELETE);
+        when(snapshotService.delete(anyString())).thenReturn(ActionResponse.actionSuccess());
+        final String id = "id";
+        msg.setHeader(CinderConstants.ID, id);
+
+        producer.process(exchange);
+
+        ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
+        verify(snapshotService).delete(captor.capture());
+        assertEquals(id, captor.getValue());
+        assertFalse(msg.isFault());
+    }
+
+    private void assertEqualsVolumeSnapshots(VolumeSnapshot old, VolumeSnapshot newVolumeSn) {
+        assertEquals(old.getName(), newVolumeSn.getName());
+        assertEquals(old.getDescription(), newVolumeSn.getDescription());
+        assertEquals(old.getVolumeId(), newVolumeSn.getVolumeId());
+    }
+
+    private VolumeSnapshot createTestVolume() {
+        return Builders.volumeSnapshot()
+                .description("descr")
+                .name("name")
+                .volume("volId")
+                .build();
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/7d2907d2/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/glance/GlanceProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/glance/GlanceProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/glance/GlanceProducerTest.java
index aa48e8a..8a77c07 100644
--- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/glance/GlanceProducerTest.java
+++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/glance/GlanceProducerTest.java
@@ -16,20 +16,14 @@
  */
 package org.apache.camel.component.openstack.glance;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.UUID;
 
 import org.apache.camel.component.openstack.AbstractProducerTestSupport;
-
 import org.junit.Before;
 import org.junit.Test;
-
 import org.mockito.ArgumentCaptor;
 import org.mockito.Mock;
 import org.mockito.Spy;
@@ -41,197 +35,200 @@ import org.openstack4j.model.image.DiskFormat;
 import org.openstack4j.model.image.Image;
 import org.openstack4j.openstack.image.domain.GlanceImage;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.util.UUID;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 public class GlanceProducerTest extends AbstractProducerTestSupport {
 
-	@Mock
-	private GlanceEndpoint endpoint;
-
-	@Mock
-	private ImageService imageService;
-
-	private Image dummyImage;
-
-	@Spy
-	private Image osImage = Builders.image().build();
-
-	@Before
-	public void setUp() {
-		producer = new GlanceProducer(endpoint, client);
-		when(client.images()).thenReturn(imageService);
-		dummyImage = createImage();
-
-		when(imageService.get(anyString())).thenReturn(osImage);
-		when(imageService.create(any(org.openstack4j.model.image.Image.class), any(Payload.class))).thenReturn(osImage);
-		when(imageService.reserve(any(org.openstack4j.model.image.Image.class))).thenReturn(osImage);
-		when(imageService.upload(anyString(), any(Payload.class), any(GlanceImage.class))).thenReturn(osImage);
-
-		when(osImage.getContainerFormat()).thenReturn(ContainerFormat.BARE);
-		when(osImage.getDiskFormat()).thenReturn(DiskFormat.ISO);
-		when(osImage.getName()).thenReturn(dummyImage.getName());
-		when(osImage.getChecksum()).thenReturn(dummyImage.getChecksum());
-		when(osImage.getMinDisk()).thenReturn(dummyImage.getMinDisk());
-		when(osImage.getMinRam()).thenReturn(dummyImage.getMinRam());
-		when(osImage.getOwner()).thenReturn(dummyImage.getOwner());
-		when(osImage.getId()).thenReturn(UUID.randomUUID().toString());
-	}
-
-	@Test
-	public void reserveTest() throws Exception {
-		when(endpoint.getOperation()).thenReturn(GlanceConstants.RESERVE);
-		msg.setBody(dummyImage);
-		producer.process(exchange);
-		ArgumentCaptor<Image> captor = ArgumentCaptor.forClass(Image.class);
-		verify(imageService).reserve(captor.capture());
-		assertEquals(dummyImage, captor.getValue());
-
-		Image result = msg.getBody(Image.class);
-		assertNotNull(result.getId());
-		assertEqualsImages(dummyImage, result);
-	}
-
-	@Test
-	public void reserveWithHeadersTest() throws Exception {
-		when(endpoint.getOperation()).thenReturn(GlanceConstants.RESERVE);
-		msg.setHeader(GlanceConstants.NAME, dummyImage.getName());
-		msg.setHeader(GlanceConstants.CONTAINER_FORMAT, dummyImage.getContainerFormat());
-		msg.setHeader(GlanceConstants.DISK_FORMAT, dummyImage.getDiskFormat());
-		msg.setHeader(GlanceConstants.CHECKSUM, dummyImage.getChecksum());
-		msg.setHeader(GlanceConstants.MIN_DISK, dummyImage.getMinDisk());
-		msg.setHeader(GlanceConstants.MIN_RAM, dummyImage.getMinRam());
-		msg.setHeader(GlanceConstants.OWNER, dummyImage.getOwner());
-
-		producer.process(exchange);
-		final ArgumentCaptor<Image> captor = ArgumentCaptor.forClass(Image.class);
-		verify(imageService).reserve(captor.capture());
-		assertEqualsImages(dummyImage, captor.getValue());
-
-		final Image result = msg.getBody(Image.class);
-		assertNotNull(result.getId());
-		assertEqualsImages(dummyImage, result);
-	}
-
-	@Test
-	public void createTest() throws Exception {
-		msg.setHeader(GlanceConstants.OPERATION, GlanceConstants.CREATE);
-		msg.setHeader(GlanceConstants.NAME, dummyImage.getName());
-		msg.setHeader(GlanceConstants.OWNER, dummyImage.getOwner());
-		msg.setHeader(GlanceConstants.MIN_DISK, dummyImage.getMinDisk());
-		msg.setHeader(GlanceConstants.MIN_RAM, dummyImage.getMinRam());
-		msg.setHeader(GlanceConstants.CHECKSUM, dummyImage.getChecksum());
-		msg.setHeader(GlanceConstants.DISK_FORMAT, dummyImage.getDiskFormat());
-		msg.setHeader(GlanceConstants.CONTAINER_FORMAT, dummyImage.getContainerFormat());
-
-		final InputStream is = new FileInputStream(File.createTempFile("image", ".iso"));
-		msg.setBody(is);
-		producer.process(exchange);
-
-		final ArgumentCaptor<Payload> payloadCaptor = ArgumentCaptor.forClass(Payload.class);
-		final ArgumentCaptor<org.openstack4j.model.image.Image> imageCaptor = ArgumentCaptor.forClass(org.openstack4j.model.image.Image.class);
-		verify(imageService).create(imageCaptor.capture(), payloadCaptor.capture());
-		assertEquals(is, payloadCaptor.getValue().open());
-
-		final Image result = msg.getBody(Image.class);
-		assertNotNull(result.getId());
-		assertEqualsImages(dummyImage, result);
-	}
-
-	@Test
-	public void uploadWithoutUpdatingTest() throws Exception {
-		msg.setHeader(GlanceConstants.OPERATION, GlanceConstants.UPLOAD);
-		final String id = "id";
-		msg.setHeader(GlanceConstants.ID, id);
-
-		final File file = File.createTempFile("image", ".iso");
-		msg.setBody(file);
-		producer.process(exchange);
-
-		final ArgumentCaptor<Payload> payloadCaptor = ArgumentCaptor.forClass(Payload.class);
-		final ArgumentCaptor<String> imageIdCaptor = ArgumentCaptor.forClass(String.class);
-		final ArgumentCaptor<org.openstack4j.model.image.Image> imageCaptor = ArgumentCaptor.forClass(org.openstack4j.model.image.Image.class);
-		verify(imageService).upload(imageIdCaptor.capture(), payloadCaptor.capture(), imageCaptor.capture());
-		assertEquals(file, payloadCaptor.getValue().getRaw());
-		assertEquals(id, imageIdCaptor.getValue());
-		assertNull(imageCaptor.getValue());
-
-		final Image result = msg.getBody(Image.class);
-		assertNotNull(result.getId());
-		assertEqualsImages(dummyImage, result);
-	}
-
-	@Test
-	public void uploadWithUpdatingTest() throws Exception {
-		final String newName = "newName";
-		dummyImage.setName(newName);
-		when(osImage.getName()).thenReturn(newName);
-		msg.setHeader(GlanceConstants.OPERATION, GlanceConstants.UPLOAD);
-		final String id = "id";
-		msg.setHeader(GlanceConstants.ID, id);
-		msg.setHeader(GlanceConstants.NAME, dummyImage.getName());
-		msg.setHeader(GlanceConstants.OWNER, dummyImage.getOwner());
-		msg.setHeader(GlanceConstants.MIN_DISK, dummyImage.getMinDisk());
-		msg.setHeader(GlanceConstants.MIN_RAM, dummyImage.getMinRam());
-		msg.setHeader(GlanceConstants.CHECKSUM, dummyImage.getChecksum());
-		msg.setHeader(GlanceConstants.DISK_FORMAT, dummyImage.getDiskFormat());
-		msg.setHeader(GlanceConstants.CONTAINER_FORMAT, dummyImage.getContainerFormat());
-
-		final File file = File.createTempFile("image", ".iso");
-		msg.setBody(file);
-		producer.process(exchange);
-
-		ArgumentCaptor<Payload> payloadCaptor = ArgumentCaptor.forClass(Payload.class);
-		ArgumentCaptor<String> imageIdCaptor = ArgumentCaptor.forClass(String.class);
-		ArgumentCaptor<org.openstack4j.model.image.Image> imageCaptor = ArgumentCaptor.forClass(org.openstack4j.model.image.Image.class);
-		verify(imageService).upload(imageIdCaptor.capture(), payloadCaptor.capture(), imageCaptor.capture());
-		assertEquals(id, imageIdCaptor.getValue());
-		assertEquals(file, payloadCaptor.getValue().getRaw());
-		assertEquals(newName, imageCaptor.getValue().getName());
-
-		final Image result = msg.getBody(Image.class);
-		assertNotNull(result.getId());
-		assertEqualsImages(dummyImage, result);
-	}
-
-	@Test
-	public void updateTest() throws Exception {
-		msg.setHeader(GlanceConstants.OPERATION, GlanceConstants.UPDATE);
-		when(imageService.update(any(Image.class))).thenReturn(osImage);
-		final String newName = "newName";
-		when(osImage.getName()).thenReturn(newName);
-		dummyImage.setName(newName);
-
-		msg.setBody(dummyImage);
-		producer.process(exchange);
-
-		final ArgumentCaptor<org.openstack4j.model.image.Image> imageCaptor = ArgumentCaptor.forClass(org.openstack4j.model.image.Image.class);
-		verify(imageService).update(imageCaptor.capture());
-
-		assertEquals(dummyImage, imageCaptor.getValue());
-		assertEqualsImages(dummyImage, msg.getBody(Image.class));
-	}
-
-	private Image createImage() {
-		return Builders.image()
-				.name("Image Name")
-				.diskFormat(DiskFormat.ISO)
-				.containerFormat(ContainerFormat.BARE)
-				.checksum("checksum")
-				.minDisk(10L)
-				.minRam(5L)
-				.owner("owner").build();
-	}
-
-	private void assertEqualsImages(Image original, Image newImage) {
-		assertEquals(original.getContainerFormat(), newImage.getContainerFormat());
-		assertEquals(original.getDiskFormat(), newImage.getDiskFormat());
-		assertEquals(original.getChecksum(), newImage.getChecksum());
-		assertEquals(original.getMinDisk(), newImage.getMinDisk());
-		assertEquals(original.getMinRam(), newImage.getMinRam());
-		assertEquals(original.getOwner(), newImage.getOwner());
-		assertEquals(original.getName(), newImage.getName());
-	}
+    @Mock
+    private GlanceEndpoint endpoint;
+
+    @Mock
+    private ImageService imageService;
+
+    private Image dummyImage;
+
+    @Spy
+    private Image osImage = Builders.image().build();
+
+    @Before
+    public void setUp() {
+        producer = new GlanceProducer(endpoint, client);
+        when(client.images()).thenReturn(imageService);
+        dummyImage = createImage();
+
+        when(imageService.get(anyString())).thenReturn(osImage);
+        when(imageService.create(any(org.openstack4j.model.image.Image.class), any(Payload.class))).thenReturn(osImage);
+        when(imageService.reserve(any(org.openstack4j.model.image.Image.class))).thenReturn(osImage);
+        when(imageService.upload(anyString(), any(Payload.class), any(GlanceImage.class))).thenReturn(osImage);
+
+        when(osImage.getContainerFormat()).thenReturn(ContainerFormat.BARE);
+        when(osImage.getDiskFormat()).thenReturn(DiskFormat.ISO);
+        when(osImage.getName()).thenReturn(dummyImage.getName());
+        when(osImage.getChecksum()).thenReturn(dummyImage.getChecksum());
+        when(osImage.getMinDisk()).thenReturn(dummyImage.getMinDisk());
+        when(osImage.getMinRam()).thenReturn(dummyImage.getMinRam());
+        when(osImage.getOwner()).thenReturn(dummyImage.getOwner());
+        when(osImage.getId()).thenReturn(UUID.randomUUID().toString());
+    }
+
+    @Test
+    public void reserveTest() throws Exception {
+        when(endpoint.getOperation()).thenReturn(GlanceConstants.RESERVE);
+        msg.setBody(dummyImage);
+        producer.process(exchange);
+        ArgumentCaptor<Image> captor = ArgumentCaptor.forClass(Image.class);
+        verify(imageService).reserve(captor.capture());
+        assertEquals(dummyImage, captor.getValue());
+
+        Image result = msg.getBody(Image.class);
+        assertNotNull(result.getId());
+        assertEqualsImages(dummyImage, result);
+    }
+
+    @Test
+    public void reserveWithHeadersTest() throws Exception {
+        when(endpoint.getOperation()).thenReturn(GlanceConstants.RESERVE);
+        msg.setHeader(GlanceConstants.NAME, dummyImage.getName());
+        msg.setHeader(GlanceConstants.CONTAINER_FORMAT, dummyImage.getContainerFormat());
+        msg.setHeader(GlanceConstants.DISK_FORMAT, dummyImage.getDiskFormat());
+        msg.setHeader(GlanceConstants.CHECKSUM, dummyImage.getChecksum());
+        msg.setHeader(GlanceConstants.MIN_DISK, dummyImage.getMinDisk());
+        msg.setHeader(GlanceConstants.MIN_RAM, dummyImage.getMinRam());
+        msg.setHeader(GlanceConstants.OWNER, dummyImage.getOwner());
+
+        producer.process(exchange);
+        final ArgumentCaptor<Image> captor = ArgumentCaptor.forClass(Image.class);
+        verify(imageService).reserve(captor.capture());
+        assertEqualsImages(dummyImage, captor.getValue());
+
+        final Image result = msg.getBody(Image.class);
+        assertNotNull(result.getId());
+        assertEqualsImages(dummyImage, result);
+    }
+
+    @Test
+    public void createTest() throws Exception {
+        msg.setHeader(GlanceConstants.OPERATION, GlanceConstants.CREATE);
+        msg.setHeader(GlanceConstants.NAME, dummyImage.getName());
+        msg.setHeader(GlanceConstants.OWNER, dummyImage.getOwner());
+        msg.setHeader(GlanceConstants.MIN_DISK, dummyImage.getMinDisk());
+        msg.setHeader(GlanceConstants.MIN_RAM, dummyImage.getMinRam());
+        msg.setHeader(GlanceConstants.CHECKSUM, dummyImage.getChecksum());
+        msg.setHeader(GlanceConstants.DISK_FORMAT, dummyImage.getDiskFormat());
+        msg.setHeader(GlanceConstants.CONTAINER_FORMAT, dummyImage.getContainerFormat());
+
+        final InputStream is = new FileInputStream(File.createTempFile("image", ".iso"));
+        msg.setBody(is);
+        producer.process(exchange);
+
+        final ArgumentCaptor<Payload> payloadCaptor = ArgumentCaptor.forClass(Payload.class);
+        final ArgumentCaptor<org.openstack4j.model.image.Image> imageCaptor = ArgumentCaptor.forClass(org.openstack4j.model.image.Image.class);
+        verify(imageService).create(imageCaptor.capture(), payloadCaptor.capture());
+        assertEquals(is, payloadCaptor.getValue().open());
+
+        final Image result = msg.getBody(Image.class);
+        assertNotNull(result.getId());
+        assertEqualsImages(dummyImage, result);
+    }
+
+    @Test
+    public void uploadWithoutUpdatingTest() throws Exception {
+        msg.setHeader(GlanceConstants.OPERATION, GlanceConstants.UPLOAD);
+        final String id = "id";
+        msg.setHeader(GlanceConstants.ID, id);
+
+        final File file = File.createTempFile("image", ".iso");
+        msg.setBody(file);
+        producer.process(exchange);
+
+        final ArgumentCaptor<Payload> payloadCaptor = ArgumentCaptor.forClass(Payload.class);
+        final ArgumentCaptor<String> imageIdCaptor = ArgumentCaptor.forClass(String.class);
+        final ArgumentCaptor<org.openstack4j.model.image.Image> imageCaptor = ArgumentCaptor.forClass(org.openstack4j.model.image.Image.class);
+        verify(imageService).upload(imageIdCaptor.capture(), payloadCaptor.capture(), imageCaptor.capture());
+        assertEquals(file, payloadCaptor.getValue().getRaw());
+        assertEquals(id, imageIdCaptor.getValue());
+        assertNull(imageCaptor.getValue());
+
+        final Image result = msg.getBody(Image.class);
+        assertNotNull(result.getId());
+        assertEqualsImages(dummyImage, result);
+    }
+
+    @Test
+    public void uploadWithUpdatingTest() throws Exception {
+        final String newName = "newName";
+        dummyImage.setName(newName);
+        when(osImage.getName()).thenReturn(newName);
+        msg.setHeader(GlanceConstants.OPERATION, GlanceConstants.UPLOAD);
+        final String id = "id";
+        msg.setHeader(GlanceConstants.ID, id);
+        msg.setHeader(GlanceConstants.NAME, dummyImage.getName());
+        msg.setHeader(GlanceConstants.OWNER, dummyImage.getOwner());
+        msg.setHeader(GlanceConstants.MIN_DISK, dummyImage.getMinDisk());
+        msg.setHeader(GlanceConstants.MIN_RAM, dummyImage.getMinRam());
+        msg.setHeader(GlanceConstants.CHECKSUM, dummyImage.getChecksum());
+        msg.setHeader(GlanceConstants.DISK_FORMAT, dummyImage.getDiskFormat());
+        msg.setHeader(GlanceConstants.CONTAINER_FORMAT, dummyImage.getContainerFormat());
+
+        final File file = File.createTempFile("image", ".iso");
+        msg.setBody(file);
+        producer.process(exchange);
+
+        ArgumentCaptor<Payload> payloadCaptor = ArgumentCaptor.forClass(Payload.class);
+        ArgumentCaptor<String> imageIdCaptor = ArgumentCaptor.forClass(String.class);
+        ArgumentCaptor<org.openstack4j.model.image.Image> imageCaptor = ArgumentCaptor.forClass(org.openstack4j.model.image.Image.class);
+        verify(imageService).upload(imageIdCaptor.capture(), payloadCaptor.capture(), imageCaptor.capture());
+        assertEquals(id, imageIdCaptor.getValue());
+        assertEquals(file, payloadCaptor.getValue().getRaw());
+        assertEquals(newName, imageCaptor.getValue().getName());
+
+        final Image result = msg.getBody(Image.class);
+        assertNotNull(result.getId());
+        assertEqualsImages(dummyImage, result);
+    }
+
+    @Test
+    public void updateTest() throws Exception {
+        msg.setHeader(GlanceConstants.OPERATION, GlanceConstants.UPDATE);
+        when(imageService.update(any(Image.class))).thenReturn(osImage);
+        final String newName = "newName";
+        when(osImage.getName()).thenReturn(newName);
+        dummyImage.setName(newName);
+
+        msg.setBody(dummyImage);
+        producer.process(exchange);
+
+        final ArgumentCaptor<org.openstack4j.model.image.Image> imageCaptor = ArgumentCaptor.forClass(org.openstack4j.model.image.Image.class);
+        verify(imageService).update(imageCaptor.capture());
+
+        assertEquals(dummyImage, imageCaptor.getValue());
+        assertEqualsImages(dummyImage, msg.getBody(Image.class));
+    }
+
+    private Image createImage() {
+        return Builders.image()
+                .name("Image Name")
+                .diskFormat(DiskFormat.ISO)
+                .containerFormat(ContainerFormat.BARE)
+                .checksum("checksum")
+                .minDisk(10L)
+                .minRam(5L)
+                .owner("owner").build();
+    }
+
+    private void assertEqualsImages(Image original, Image newImage) {
+        assertEquals(original.getContainerFormat(), newImage.getContainerFormat());
+        assertEquals(original.getDiskFormat(), newImage.getDiskFormat());
+        assertEquals(original.getChecksum(), newImage.getChecksum());
+        assertEquals(original.getMinDisk(), newImage.getMinDisk());
+        assertEquals(original.getMinRam(), newImage.getMinRam());
+        assertEquals(original.getOwner(), newImage.getOwner());
+        assertEquals(original.getName(), newImage.getName());
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/7d2907d2/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/DomainProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/DomainProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/DomainProducerTest.java
index 40c7879..986edc1 100644
--- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/DomainProducerTest.java
+++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/DomainProducerTest.java
@@ -16,154 +16,150 @@
  */
 package org.apache.camel.component.openstack.keystone;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.camel.component.openstack.keystone.producer.DomainProducer;
 import org.apache.camel.component.openstack.neutron.NeutronConstants;
-
 import org.junit.Before;
 import org.junit.Test;
-
 import org.mockito.ArgumentCaptor;
 import org.mockito.Mock;
 import org.openstack4j.api.Builders;
 import org.openstack4j.model.common.ActionResponse;
 import org.openstack4j.model.identity.v3.Domain;
 import org.openstack4j.model.network.Network;
-import org.openstack4j.model.network.Router;
 
-import java.util.ArrayList;
-import java.util.List;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 public class DomainProducerTest extends KeystoneProducerTestSupport {
 
-	private Domain dummyDomain;
+    private Domain dummyDomain;
+
+    @Mock
+    private Domain testOSdomain;
+
+    @Before
+    public void setUp() {
+        producer = new DomainProducer(endpoint, client);
+
+        when(domainService.create(any(Domain.class))).thenReturn(testOSdomain);
+        when(domainService.get(anyString())).thenReturn(testOSdomain);
+
+        List<Domain> getAllList = new ArrayList<>();
+        getAllList.add(testOSdomain);
+        getAllList.add(testOSdomain);
+        doReturn(getAllList).when(domainService).list();
+
+        dummyDomain = createDomain();
+
+        when(testOSdomain.getName()).thenReturn(dummyDomain.getName());
+        when(testOSdomain.getDescription()).thenReturn(dummyDomain.getDescription());
+    }
+
+    @Test
+    public void createTest() throws Exception {
+        msg.setHeader(KeystoneConstants.OPERATION, KeystoneConstants.CREATE);
+        msg.setHeader(KeystoneConstants.NAME, dummyDomain.getName());
+        msg.setHeader(KeystoneConstants.DESCRIPTION, dummyDomain.getDescription());
+
+
+        producer.process(exchange);
+
+        ArgumentCaptor<Domain> captor = ArgumentCaptor.forClass(Domain.class);
+        verify(domainService).create(captor.capture());
+
+        assertEqualsDomain(dummyDomain, captor.getValue());
+    }
+
+    @Test
+    public void getTest() throws Exception {
+        final String id = "id";
+        msg.setHeader(NeutronConstants.OPERATION, NeutronConstants.GET);
+        msg.setHeader(NeutronConstants.ID, id);
+
+        producer.process(exchange);
+
+        ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
+        verify(domainService).get(captor.capture());
+
+        assertEquals(id, captor.getValue());
+        assertEqualsDomain(testOSdomain, msg.getBody(Domain.class));
+    }
+
+    @Test
+    public void getAllTest() throws Exception {
+        msg.setHeader(NeutronConstants.OPERATION, NeutronConstants.GET_ALL);
+
+        producer.process(exchange);
+
+        final List<Network> result = msg.getBody(List.class);
+        assertTrue(result.size() == 2);
+        assertEquals(testOSdomain, result.get(0));
+    }
+
+    @Test
+    public void updateTest() throws Exception {
+        final String id = "myID";
+        msg.setHeader(KeystoneConstants.OPERATION, KeystoneConstants.UPDATE);
+        final String newName = "newName";
+
+        when(testOSdomain.getId()).thenReturn(id);
+        when(testOSdomain.getName()).thenReturn(newName);
+        when(testOSdomain.getDescription()).thenReturn("desc");
+
+        when(domainService.update(any(Domain.class))).thenReturn(testOSdomain);
+        msg.setBody(testOSdomain);
+
+        producer.process(exchange);
+
+        ArgumentCaptor<Domain> captor = ArgumentCaptor.forClass(Domain.class);
+        verify(domainService).update(captor.capture());
+
+        assertEqualsDomain(testOSdomain, captor.getValue());
+        assertNotNull(captor.getValue().getId());
+        assertEquals(newName, msg.getBody(Domain.class).getName());
+    }
+
+    @Test
+    public void deleteTest() throws Exception {
+        when(domainService.delete(anyString())).thenReturn(ActionResponse.actionSuccess());
+        final String networkID = "myID";
+        msg.setHeader(NeutronConstants.OPERATION, NeutronConstants.DELETE);
+        msg.setHeader(NeutronConstants.ID, networkID);
+
+        producer.process(exchange);
+
+        ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
+        verify(domainService).delete(captor.capture());
+        assertEquals(networkID, captor.getValue());
+        assertFalse(msg.isFault());
+
+        //in case of failure
+        final String failureMessage = "fail";
+        when(domainService.delete(anyString())).thenReturn(ActionResponse.actionFailed(failureMessage, 404));
+        producer.process(exchange);
+        assertTrue(msg.isFault());
+        assertTrue(msg.getBody(String.class).contains(failureMessage));
+    }
+
+    private void assertEqualsDomain(Domain old, Domain newDomain) {
+        assertEquals(old.getName(), newDomain.getName());
+        assertEquals(old.getDescription(), newDomain.getDescription());
+    }
 
-	@Mock
-	private Domain testOSdomain;
-
-	@Before
-	public void setUp() {
-		producer = new DomainProducer(endpoint, client);
-		
-		when(domainService.create(any(Domain.class))).thenReturn(testOSdomain);
-		when(domainService.get(anyString())).thenReturn(testOSdomain);
-
-		List<Domain> getAllList = new ArrayList<>();
-		getAllList.add(testOSdomain);
-		getAllList.add(testOSdomain);
-		doReturn(getAllList).when(domainService).list();
-		
-		dummyDomain = createDomain();
-
-		when(testOSdomain.getName()).thenReturn(dummyDomain.getName());
-		when(testOSdomain.getDescription()).thenReturn(dummyDomain.getDescription());
-	}
-	
-	@Test
-	public void createTest() throws Exception {
-		msg.setHeader(KeystoneConstants.OPERATION, KeystoneConstants.CREATE);
-		msg.setHeader(KeystoneConstants.NAME, dummyDomain.getName());
-		msg.setHeader(KeystoneConstants.DESCRIPTION, dummyDomain.getDescription());
-
-
-		producer.process(exchange);
-
-		ArgumentCaptor<Domain> captor = ArgumentCaptor.forClass(Domain.class);
-		verify(domainService).create(captor.capture());
-
-		assertEqualsDomain(dummyDomain, captor.getValue());
-	}
-
-	@Test
-	public void getTest() throws Exception {
-		final String id = "id";
-		msg.setHeader(NeutronConstants.OPERATION, NeutronConstants.GET);
-		msg.setHeader(NeutronConstants.ID, id);
-
-		producer.process(exchange);
-
-		ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
-		verify(domainService).get(captor.capture());
-
-		assertEquals(id, captor.getValue());
-		assertEqualsDomain(testOSdomain, msg.getBody(Domain.class));
-	}
-
-	@Test
-	public void getAllTest() throws Exception {
-		msg.setHeader(NeutronConstants.OPERATION, NeutronConstants.GET_ALL);
-
-		producer.process(exchange);
-
-		final List<Network> result = msg.getBody(List.class);
-		assertTrue(result.size() == 2);
-		assertEquals(testOSdomain, result.get(0));
-	}
-
-	@Test
-	public void updateTest() throws Exception {
-		final String id = "myID";
-		msg.setHeader(KeystoneConstants.OPERATION, KeystoneConstants.UPDATE);
-		final String newName = "newName";
-
-		when(testOSdomain.getId()).thenReturn(id);
-		when(testOSdomain.getName()).thenReturn(newName);
-		when(testOSdomain.getDescription()).thenReturn("desc");
-
-		when(domainService.update(any(Domain.class))).thenReturn(testOSdomain);
-		msg.setBody(testOSdomain);
-
-		producer.process(exchange);
-
-		ArgumentCaptor<Domain> captor = ArgumentCaptor.forClass(Domain.class);
-		verify(domainService).update(captor.capture());
-
-		assertEqualsDomain(testOSdomain, captor.getValue());
-		assertNotNull(captor.getValue().getId());
-		assertEquals(newName, msg.getBody(Domain.class).getName());
-	}
-	
-	@Test
-	public void deleteTest() throws Exception {
-		when(domainService.delete(anyString())).thenReturn(ActionResponse.actionSuccess());
-		final String networkID = "myID";
-		msg.setHeader(NeutronConstants.OPERATION, NeutronConstants.DELETE);
-		msg.setHeader(NeutronConstants.ID, networkID);
-
-		producer.process(exchange);
-
-		ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
-		verify(domainService).delete(captor.capture());
-		assertEquals(networkID, captor.getValue());
-		assertFalse(msg.isFault());
-
-		//in case of failure
-		final String failureMessage = "fail";
-		when(domainService.delete(anyString())).thenReturn(ActionResponse.actionFailed(failureMessage, 404));
-		producer.process(exchange);
-		assertTrue(msg.isFault());
-		assertTrue(msg.getBody(String.class).contains(failureMessage));
-	}
-
-	private void assertEqualsDomain(Domain old, Domain newDomain) {
-		assertEquals(old.getName(), newDomain.getName());
-		assertEquals(old.getDescription(), newDomain.getDescription());
-	}
-
-	private Domain createDomain() {
-		return Builders.domain()
-				.description("desc")
-				.name("domain Name").build();
-	}
+    private Domain createDomain() {
+        return Builders.domain()
+                .description("desc")
+                .name("domain Name").build();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/7d2907d2/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/GroupProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/GroupProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/GroupProducerTest.java
index e1aec6d..1384b8f 100644
--- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/GroupProducerTest.java
+++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/GroupProducerTest.java
@@ -16,23 +16,13 @@
  */
 package org.apache.camel.component.openstack.keystone;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.camel.component.openstack.keystone.producer.GroupProducer;
 import org.apache.camel.component.openstack.neutron.NeutronConstants;
-
 import org.junit.Before;
 import org.junit.Test;
-
 import org.mockito.ArgumentCaptor;
 import org.mockito.Mock;
 import org.openstack4j.api.Builders;
@@ -40,132 +30,139 @@ import org.openstack4j.model.common.ActionResponse;
 import org.openstack4j.model.identity.v3.Group;
 import org.openstack4j.model.network.Network;
 
-import java.util.ArrayList;
-import java.util.List;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 public class GroupProducerTest extends KeystoneProducerTestSupport {
 
-	private Group dummyGroup;
+    private Group dummyGroup;
+
+    @Mock
+    private Group testOSgroup;
+
+    @Before
+    public void setUp() {
+        producer = new GroupProducer(endpoint, client);
+
+        when(groupService.create(any(Group.class))).thenReturn(testOSgroup);
+        when(groupService.get(anyString())).thenReturn(testOSgroup);
+
+        List<Group> getAllList = new ArrayList<>();
+        getAllList.add(testOSgroup);
+        getAllList.add(testOSgroup);
+        doReturn(getAllList).when(groupService).list();
+
+        dummyGroup = createGroup();
+
+        when(testOSgroup.getName()).thenReturn(dummyGroup.getName());
+        when(testOSgroup.getDescription()).thenReturn(dummyGroup.getDescription());
+    }
+
+    @Test
+    public void createTest() throws Exception {
+        msg.setHeader(KeystoneConstants.OPERATION, KeystoneConstants.CREATE);
+        msg.setHeader(KeystoneConstants.NAME, dummyGroup.getName());
+        msg.setHeader(KeystoneConstants.DESCRIPTION, dummyGroup.getDescription());
+        msg.setHeader(KeystoneConstants.DOMAIN_ID, dummyGroup.getDomainId());
+
+
+        producer.process(exchange);
+
+        ArgumentCaptor<Group> captor = ArgumentCaptor.forClass(Group.class);
+        verify(groupService).create(captor.capture());
+
+        assertEqualsGroup(dummyGroup, captor.getValue());
+    }
+
+    @Test
+    public void getTest() throws Exception {
+        final String id = "id";
+        msg.setHeader(NeutronConstants.OPERATION, NeutronConstants.GET);
+        msg.setHeader(NeutronConstants.ID, id);
+
+        producer.process(exchange);
+
+        ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
+        verify(groupService).get(captor.capture());
+
+        assertEquals(id, captor.getValue());
+        assertEqualsGroup(testOSgroup, msg.getBody(Group.class));
+    }
+
+    @Test
+    public void getAllTest() throws Exception {
+        msg.setHeader(NeutronConstants.OPERATION, NeutronConstants.GET_ALL);
+
+        producer.process(exchange);
+
+        final List<Network> result = msg.getBody(List.class);
+        assertTrue(result.size() == 2);
+        assertEquals(testOSgroup, result.get(0));
+    }
+
+    @Test
+    public void updateTest() throws Exception {
+        final String id = "myID";
+        msg.setHeader(KeystoneConstants.OPERATION, KeystoneConstants.UPDATE);
+        final String newName = "newName";
+
+        when(testOSgroup.getId()).thenReturn(id);
+        when(testOSgroup.getName()).thenReturn(newName);
+        when(testOSgroup.getDescription()).thenReturn("desc");
+
+        when(groupService.update(any(Group.class))).thenReturn(testOSgroup);
+        msg.setBody(testOSgroup);
+
+        producer.process(exchange);
+
+        ArgumentCaptor<Group> captor = ArgumentCaptor.forClass(Group.class);
+        verify(groupService).update(captor.capture());
+
+        assertEqualsGroup(testOSgroup, captor.getValue());
+        assertNotNull(captor.getValue().getId());
+        assertEquals(newName, msg.getBody(Group.class).getName());
+    }
+
+    @Test
+    public void deleteTest() throws Exception {
+        when(groupService.delete(anyString())).thenReturn(ActionResponse.actionSuccess());
+        final String networkID = "myID";
+        msg.setHeader(NeutronConstants.OPERATION, NeutronConstants.DELETE);
+        msg.setHeader(NeutronConstants.ID, networkID);
+
+        producer.process(exchange);
+
+        ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
+        verify(groupService).delete(captor.capture());
+        assertEquals(networkID, captor.getValue());
+        assertFalse(msg.isFault());
+
+        //in case of failure
+        final String failureMessage = "fail";
+        when(groupService.delete(anyString())).thenReturn(ActionResponse.actionFailed(failureMessage, 404));
+        producer.process(exchange);
+        assertTrue(msg.isFault());
+        assertTrue(msg.getBody(String.class).contains(failureMessage));
+    }
+
+    private void assertEqualsGroup(Group old, Group newGroup) {
+        assertEquals(old.getName(), newGroup.getName());
+        assertEquals(old.getDescription(), newGroup.getDescription());
+        assertEquals(old.getDomainId(), newGroup.getDomainId());
+    }
 
-	@Mock
-	private Group testOSgroup;
-
-	@Before
-	public void setUp() {
-		producer = new GroupProducer(endpoint, client);
-		
-		when(groupService.create(any(Group.class))).thenReturn(testOSgroup);
-		when(groupService.get(anyString())).thenReturn(testOSgroup);
-
-		List<Group> getAllList = new ArrayList<>();
-		getAllList.add(testOSgroup);
-		getAllList.add(testOSgroup);
-		doReturn(getAllList).when(groupService).list();
-		
-		dummyGroup = createGroup();
-
-		when(testOSgroup.getName()).thenReturn(dummyGroup.getName());
-		when(testOSgroup.getDescription()).thenReturn(dummyGroup.getDescription());
-	}
-	
-	@Test
-	public void createTest() throws Exception {
-		msg.setHeader(KeystoneConstants.OPERATION, KeystoneConstants.CREATE);
-		msg.setHeader(KeystoneConstants.NAME, dummyGroup.getName());
-		msg.setHeader(KeystoneConstants.DESCRIPTION, dummyGroup.getDescription());
-		msg.setHeader(KeystoneConstants.DOMAIN_ID, dummyGroup.getDomainId());
-
-
-		producer.process(exchange);
-
-		ArgumentCaptor<Group> captor = ArgumentCaptor.forClass(Group.class);
-		verify(groupService).create(captor.capture());
-
-		assertEqualsGroup(dummyGroup, captor.getValue());
-	}
-
-	@Test
-	public void getTest() throws Exception {
-		final String id = "id";
-		msg.setHeader(NeutronConstants.OPERATION, NeutronConstants.GET);
-		msg.setHeader(NeutronConstants.ID, id);
-
-		producer.process(exchange);
-
-		ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
-		verify(groupService).get(captor.capture());
-
-		assertEquals(id, captor.getValue());
-		assertEqualsGroup(testOSgroup, msg.getBody(Group.class));
-	}
-
-	@Test
-	public void getAllTest() throws Exception {
-		msg.setHeader(NeutronConstants.OPERATION, NeutronConstants.GET_ALL);
-
-		producer.process(exchange);
-
-		final List<Network> result = msg.getBody(List.class);
-		assertTrue(result.size() == 2);
-		assertEquals(testOSgroup, result.get(0));
-	}
-
-	@Test
-	public void updateTest() throws Exception {
-		final String id = "myID";
-		msg.setHeader(KeystoneConstants.OPERATION, KeystoneConstants.UPDATE);
-		final String newName = "newName";
-
-		when(testOSgroup.getId()).thenReturn(id);
-		when(testOSgroup.getName()).thenReturn(newName);
-		when(testOSgroup.getDescription()).thenReturn("desc");
-
-		when(groupService.update(any(Group.class))).thenReturn(testOSgroup);
-		msg.setBody(testOSgroup);
-
-		producer.process(exchange);
-
-		ArgumentCaptor<Group> captor = ArgumentCaptor.forClass(Group.class);
-		verify(groupService).update(captor.capture());
-
-		assertEqualsGroup(testOSgroup, captor.getValue());
-		assertNotNull(captor.getValue().getId());
-		assertEquals(newName, msg.getBody(Group.class).getName());
-	}
-	
-	@Test
-	public void deleteTest() throws Exception {
-		when(groupService.delete(anyString())).thenReturn(ActionResponse.actionSuccess());
-		final String networkID = "myID";
-		msg.setHeader(NeutronConstants.OPERATION, NeutronConstants.DELETE);
-		msg.setHeader(NeutronConstants.ID, networkID);
-
-		producer.process(exchange);
-
-		ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
-		verify(groupService).delete(captor.capture());
-		assertEquals(networkID, captor.getValue());
-		assertFalse(msg.isFault());
-
-		//in case of failure
-		final String failureMessage = "fail";
-		when(groupService.delete(anyString())).thenReturn(ActionResponse.actionFailed(failureMessage, 404));
-		producer.process(exchange);
-		assertTrue(msg.isFault());
-		assertTrue(msg.getBody(String.class).contains(failureMessage));
-	}
-
-	private void assertEqualsGroup(Group old, Group newGroup) {
-		assertEquals(old.getName(), newGroup.getName());
-		assertEquals(old.getDescription(), newGroup.getDescription());
-		assertEquals(old.getDomainId(), newGroup.getDomainId());
-	}
-
-	private Group createGroup() {
-		return Builders.group()
-				.domainId("domain")
-				.description("desc")
-				.name("group Name").build();
-	}
+    private Group createGroup() {
+        return Builders.group()
+                .domainId("domain")
+                .description("desc")
+                .name("group Name").build();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/7d2907d2/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/KeystoneProducerTestSupport.java
----------------------------------------------------------------------
diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/KeystoneProducerTestSupport.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/KeystoneProducerTestSupport.java
index 02ba409..53051a6 100644
--- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/KeystoneProducerTestSupport.java
+++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/KeystoneProducerTestSupport.java
@@ -16,12 +16,8 @@
  */
 package org.apache.camel.component.openstack.keystone;
 
-import static org.mockito.Mockito.when;
-
 import org.apache.camel.component.openstack.AbstractProducerTestSupport;
-
 import org.junit.Before;
-
 import org.mockito.Mock;
 import org.openstack4j.api.identity.v3.DomainService;
 import org.openstack4j.api.identity.v3.GroupService;
@@ -30,36 +26,38 @@ import org.openstack4j.api.identity.v3.ProjectService;
 import org.openstack4j.api.identity.v3.RegionService;
 import org.openstack4j.api.identity.v3.UserService;
 
+import static org.mockito.Mockito.when;
+
 public class KeystoneProducerTestSupport extends AbstractProducerTestSupport {
 
-	@Mock
-	protected KeystoneEndpoint endpoint;
+    @Mock
+    protected KeystoneEndpoint endpoint;
 
-	@Mock
-	protected IdentityService identityService;
+    @Mock
+    protected IdentityService identityService;
 
-	@Mock
-	protected DomainService domainService;
+    @Mock
+    protected DomainService domainService;
 
-	@Mock
-	protected GroupService groupService;
+    @Mock
+    protected GroupService groupService;
 
-	@Mock
-	protected ProjectService projectService;
+    @Mock
+    protected ProjectService projectService;
 
-	@Mock
-	protected RegionService regionService;
+    @Mock
+    protected RegionService regionService;
 
-	@Mock
-	protected UserService userService;
+    @Mock
+    protected UserService userService;
 
-	@Before
-	public void setUpComputeService(){
-		when(client.identity()).thenReturn(identityService);
-		when(identityService.domains()).thenReturn(domainService);
-		when(identityService.groups()).thenReturn(groupService);
-		when(identityService.projects()).thenReturn(projectService);
-		when(identityService.regions()).thenReturn(regionService);
-		when(identityService.users()).thenReturn(userService);
-	}
+    @Before
+    public void setUpComputeService() {
+        when(client.identity()).thenReturn(identityService);
+        when(identityService.domains()).thenReturn(domainService);
+        when(identityService.groups()).thenReturn(groupService);
+        when(identityService.projects()).thenReturn(projectService);
+        when(identityService.regions()).thenReturn(regionService);
+        when(identityService.users()).thenReturn(userService);
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/7d2907d2/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/ProjectProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/ProjectProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/ProjectProducerTest.java
index 206ac9f..c0f79ba 100644
--- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/ProjectProducerTest.java
+++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/ProjectProducerTest.java
@@ -16,23 +16,13 @@
  */
 package org.apache.camel.component.openstack.keystone;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.camel.component.openstack.keystone.producer.ProjectProducer;
 import org.apache.camel.component.openstack.neutron.NeutronConstants;
-
 import org.junit.Before;
 import org.junit.Test;
-
 import org.mockito.ArgumentCaptor;
 import org.mockito.Mock;
 import org.openstack4j.api.Builders;
@@ -40,134 +30,141 @@ import org.openstack4j.model.common.ActionResponse;
 import org.openstack4j.model.identity.v3.Project;
 import org.openstack4j.model.network.Network;
 
-import java.util.ArrayList;
-import java.util.List;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 public class ProjectProducerTest extends KeystoneProducerTestSupport {
 
-	private Project dummyProject;
-
-	@Mock
-	private Project testOSproject;
-
-	@Before
-	public void setUp() {
-		producer = new ProjectProducer(endpoint, client);
-		
-		when(projectService.create(any(Project.class))).thenReturn(testOSproject);
-		when(projectService.get(anyString())).thenReturn(testOSproject);
-
-		List<Project> getAllList = new ArrayList<>();
-		getAllList.add(testOSproject);
-		getAllList.add(testOSproject);
-		doReturn(getAllList).when(projectService).list();
-		
-		dummyProject = createProject();
-
-		when(testOSproject.getName()).thenReturn(dummyProject.getName());
-		when(testOSproject.getDescription()).thenReturn(dummyProject.getDescription());
-	}
-	
-	@Test
-	public void createTest() throws Exception {
-		msg.setHeader(KeystoneConstants.OPERATION, KeystoneConstants.CREATE);
-		msg.setHeader(KeystoneConstants.NAME, dummyProject.getName());
-		msg.setHeader(KeystoneConstants.DESCRIPTION, dummyProject.getDescription());
-		msg.setHeader(KeystoneConstants.DOMAIN_ID, dummyProject.getDomainId());
-		msg.setHeader(KeystoneConstants.PARENT_ID, dummyProject.getParentId());
-
-
-		producer.process(exchange);
-
-		ArgumentCaptor<Project> captor = ArgumentCaptor.forClass(Project.class);
-		verify(projectService).create(captor.capture());
-
-		assertEqualsProject(dummyProject, captor.getValue());
-	}
-
-	@Test
-	public void getTest() throws Exception {
-		final String id = "id";
-		msg.setHeader(NeutronConstants.OPERATION, NeutronConstants.GET);
-		msg.setHeader(NeutronConstants.ID, id);
-
-		producer.process(exchange);
-
-		ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
-		verify(projectService).get(captor.capture());
-
-		assertEquals(id, captor.getValue());
-		assertEqualsProject(testOSproject, msg.getBody(Project.class));
-	}
-
-	@Test
-	public void getAllTest() throws Exception {
-		msg.setHeader(NeutronConstants.OPERATION, NeutronConstants.GET_ALL);
-
-		producer.process(exchange);
-
-		final List<Network> result = msg.getBody(List.class);
-		assertTrue(result.size() == 2);
-		assertEquals(testOSproject, result.get(0));
-	}
-
-	@Test
-	public void updateTest() throws Exception {
-		final String id = "myID";
-		msg.setHeader(KeystoneConstants.OPERATION, KeystoneConstants.UPDATE);
-		final String newName = "newName";
-
-		when(testOSproject.getId()).thenReturn(id);
-		when(testOSproject.getName()).thenReturn(newName);
-		when(testOSproject.getDescription()).thenReturn("desc");
-
-		when(projectService.update(any(Project.class))).thenReturn(testOSproject);
-		msg.setBody(testOSproject);
-
-		producer.process(exchange);
-
-		ArgumentCaptor<Project> captor = ArgumentCaptor.forClass(Project.class);
-		verify(projectService).update(captor.capture());
-
-		assertEqualsProject(testOSproject, captor.getValue());
-		assertNotNull(captor.getValue().getId());
-		assertEquals(newName, msg.getBody(Project.class).getName());
-	}
-	
-	@Test
-	public void deleteTest() throws Exception {
-		when(projectService.delete(anyString())).thenReturn(ActionResponse.actionSuccess());
-		final String networkID = "myID";
-		msg.setHeader(NeutronConstants.OPERATION, NeutronConstants.DELETE);
-		msg.setHeader(NeutronConstants.ID, networkID);
-
-		producer.process(exchange);
-
-		ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
-		verify(projectService).delete(captor.capture());
-		assertEquals(networkID, captor.getValue());
-		assertFalse(msg.isFault());
-
-		//in case of failure
-		final String failureMessage = "fail";
-		when(projectService.delete(anyString())).thenReturn(ActionResponse.actionFailed(failureMessage, 404));
-		producer.process(exchange);
-		assertTrue(msg.isFault());
-		assertTrue(msg.getBody(String.class).contains(failureMessage));
-	}
-
-	private void assertEqualsProject(Project old, Project newProject) {
-		assertEquals(old.getName(), newProject.getName());
-		assertEquals(old.getDescription(), newProject.getDescription());
-		assertEquals(old.getDomainId(), newProject.getDomainId());
-	}
-
-	private Project createProject() {
-		return Builders.project()
-				.domainId("domain")
-				.description("desc")
-				.name("project Name")
-				.parentId("parent").build();
-	}
+    private Project dummyProject;
+
+    @Mock
+    private Project testOSproject;
+
+    @Before
+    public void setUp() {
+        producer = new ProjectProducer(endpoint, client);
+
+        when(projectService.create(any(Project.class))).thenReturn(testOSproject);
+        when(projectService.get(anyString())).thenReturn(testOSproject);
+
+        List<Project> getAllList = new ArrayList<>();
+        getAllList.add(testOSproject);
+        getAllList.add(testOSproject);
+        doReturn(getAllList).when(projectService).list();
+
+        dummyProject = createProject();
+
+        when(testOSproject.getName()).thenReturn(dummyProject.getName());
+        when(testOSproject.getDescription()).thenReturn(dummyProject.getDescription());
+    }
+
+    @Test
+    public void createTest() throws Exception {
+        msg.setHeader(KeystoneConstants.OPERATION, KeystoneConstants.CREATE);
+        msg.setHeader(KeystoneConstants.NAME, dummyProject.getName());
+        msg.setHeader(KeystoneConstants.DESCRIPTION, dummyProject.getDescription());
+        msg.setHeader(KeystoneConstants.DOMAIN_ID, dummyProject.getDomainId());
+        msg.setHeader(KeystoneConstants.PARENT_ID, dummyProject.getParentId());
+
+
+        producer.process(exchange);
+
+        ArgumentCaptor<Project> captor = ArgumentCaptor.forClass(Project.class);
+        verify(projectService).create(captor.capture());
+
+        assertEqualsProject(dummyProject, captor.getValue());
+    }
+
+    @Test
+    public void getTest() throws Exception {
+        final String id = "id";
+        msg.setHeader(NeutronConstants.OPERATION, NeutronConstants.GET);
+        msg.setHeader(NeutronConstants.ID, id);
+
+        producer.process(exchange);
+
+        ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
+        verify(projectService).get(captor.capture());
+
+        assertEquals(id, captor.getValue());
+        assertEqualsProject(testOSproject, msg.getBody(Project.class));
+    }
+
+    @Test
+    public void getAllTest() throws Exception {
+        msg.setHeader(NeutronConstants.OPERATION, NeutronConstants.GET_ALL);
+
+        producer.process(exchange);
+
+        final List<Network> result = msg.getBody(List.class);
+        assertTrue(result.size() == 2);
+        assertEquals(testOSproject, result.get(0));
+    }
+
+    @Test
+    public void updateTest() throws Exception {
+        final String id = "myID";
+        msg.setHeader(KeystoneConstants.OPERATION, KeystoneConstants.UPDATE);
+        final String newName = "newName";
+
+        when(testOSproject.getId()).thenReturn(id);
+        when(testOSproject.getName()).thenReturn(newName);
+        when(testOSproject.getDescription()).thenReturn("desc");
+
+        when(projectService.update(any(Project.class))).thenReturn(testOSproject);
+        msg.setBody(testOSproject);
+
+        producer.process(exchange);
+
+        ArgumentCaptor<Project> captor = ArgumentCaptor.forClass(Project.class);
+        verify(projectService).update(captor.capture());
+
+        assertEqualsProject(testOSproject, captor.getValue());
+        assertNotNull(captor.getValue().getId());
+        assertEquals(newName, msg.getBody(Project.class).getName());
+    }
+
+    @Test
+    public void deleteTest() throws Exception {
+        when(projectService.delete(anyString())).thenReturn(ActionResponse.actionSuccess());
+        final String networkID = "myID";
+        msg.setHeader(NeutronConstants.OPERATION, NeutronConstants.DELETE);
+        msg.setHeader(NeutronConstants.ID, networkID);
+
+        producer.process(exchange);
+
+        ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
+        verify(projectService).delete(captor.capture());
+        assertEquals(networkID, captor.getValue());
+        assertFalse(msg.isFault());
+
+        //in case of failure
+        final String failureMessage = "fail";
+        when(projectService.delete(anyString())).thenReturn(ActionResponse.actionFailed(failureMessage, 404));
+        producer.process(exchange);
+        assertTrue(msg.isFault());
+        assertTrue(msg.getBody(String.class).contains(failureMessage));
+    }
+
+    private void assertEqualsProject(Project old, Project newProject) {
+        assertEquals(old.getName(), newProject.getName());
+        assertEquals(old.getDescription(), newProject.getDescription());
+        assertEquals(old.getDomainId(), newProject.getDomainId());
+    }
+
+    private Project createProject() {
+        return Builders.project()
+                .domainId("domain")
+                .description("desc")
+                .name("project Name")
+                .parentId("parent").build();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/7d2907d2/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/RegionProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/RegionProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/RegionProducerTest.java
index 332d02f..6f1cfeb 100644
--- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/RegionProducerTest.java
+++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/RegionProducerTest.java
@@ -16,23 +16,13 @@
  */
 package org.apache.camel.component.openstack.keystone;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.camel.component.openstack.keystone.producer.RegionProducer;
 import org.apache.camel.component.openstack.neutron.NeutronConstants;
-
 import org.junit.Before;
 import org.junit.Test;
-
 import org.mockito.ArgumentCaptor;
 import org.mockito.Mock;
 import org.openstack4j.api.Builders;
@@ -40,124 +30,131 @@ import org.openstack4j.model.common.ActionResponse;
 import org.openstack4j.model.identity.v3.Region;
 import org.openstack4j.model.network.Network;
 
-import java.util.ArrayList;
-import java.util.List;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 public class RegionProducerTest extends KeystoneProducerTestSupport {
 
-	private Region dummyRegion;
-
-	@Mock
-	private Region testOSregion;
-
-	@Before
-	public void setUp() {
-		producer = new RegionProducer(endpoint, client);
-		
-		when(regionService.create(any(Region.class))).thenReturn(testOSregion);
-		when(regionService.get(anyString())).thenReturn(testOSregion);
-
-		List<Region> getAllList = new ArrayList<>();
-		getAllList.add(testOSregion);
-		getAllList.add(testOSregion);
-		doReturn(getAllList).when(regionService).list();
-		
-		dummyRegion = createRegion();
-
-		when(testOSregion.getDescription()).thenReturn(dummyRegion.getDescription());
-	}
-	
-	@Test
-	public void createTest() throws Exception {
-		msg.setHeader(KeystoneConstants.OPERATION, KeystoneConstants.CREATE);
-		msg.setHeader(KeystoneConstants.DESCRIPTION, dummyRegion.getDescription());
-
-		producer.process(exchange);
-
-		ArgumentCaptor<Region> captor = ArgumentCaptor.forClass(Region.class);
-		verify(regionService).create(captor.capture());
-
-		assertEqualsRegion(dummyRegion, captor.getValue());
-	}
-
-	@Test
-	public void getTest() throws Exception {
-		final String id = "id";
-		msg.setHeader(NeutronConstants.OPERATION, NeutronConstants.GET);
-		msg.setHeader(NeutronConstants.ID, id);
-
-		producer.process(exchange);
-
-		ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
-		verify(regionService).get(captor.capture());
-
-		assertEquals(id, captor.getValue());
-		assertEqualsRegion(testOSregion, msg.getBody(Region.class));
-	}
-
-	@Test
-	public void getAllTest() throws Exception {
-		msg.setHeader(NeutronConstants.OPERATION, NeutronConstants.GET_ALL);
-
-		producer.process(exchange);
-
-		final List<Network> result = msg.getBody(List.class);
-		assertTrue(result.size() == 2);
-		assertEquals(testOSregion, result.get(0));
-	}
-
-	@Test
-	public void updateTest() throws Exception {
-		final String id = "myID";
-		msg.setHeader(KeystoneConstants.OPERATION, KeystoneConstants.UPDATE);
-
-		when(testOSregion.getId()).thenReturn(id);
-		final String newDescription = "ndesc";
-		when(testOSregion.getDescription()).thenReturn(newDescription);
-
-		when(regionService.update(any(Region.class))).thenReturn(testOSregion);
-		msg.setBody(testOSregion);
-
-		producer.process(exchange);
-
-		ArgumentCaptor<Region> captor = ArgumentCaptor.forClass(Region.class);
-		verify(regionService).update(captor.capture());
-
-		assertEqualsRegion(testOSregion, captor.getValue());
-		assertNotNull(captor.getValue().getId());
-		assertEquals(newDescription, msg.getBody(Region.class).getDescription());
-	}
-	
-	@Test
-	public void deleteTest() throws Exception {
-		when(regionService.delete(anyString())).thenReturn(ActionResponse.actionSuccess());
-		final String networkID = "myID";
-		msg.setHeader(NeutronConstants.OPERATION, NeutronConstants.DELETE);
-		msg.setHeader(NeutronConstants.ID, networkID);
-
-		producer.process(exchange);
-
-		ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
-		verify(regionService).delete(captor.capture());
-		assertEquals(networkID, captor.getValue());
-		assertFalse(msg.isFault());
-
-		//in case of failure
-		final String failureMessage = "fail";
-		when(regionService.delete(anyString())).thenReturn(ActionResponse.actionFailed(failureMessage, 404));
-		producer.process(exchange);
-		assertTrue(msg.isFault());
-		assertTrue(msg.getBody(String.class).contains(failureMessage));
-	}
-
-	private void assertEqualsRegion(Region old, Region newRegion) {
-		assertEquals(old.getDescription(), newRegion.getDescription());
-	}
-
-	private Region createRegion() {
-		return Builders.region()
-				.description("desc")
-				.build();
-	}
+    private Region dummyRegion;
+
+    @Mock
+    private Region testOSregion;
+
+    @Before
+    public void setUp() {
+        producer = new RegionProducer(endpoint, client);
+
+        when(regionService.create(any(Region.class))).thenReturn(testOSregion);
+        when(regionService.get(anyString())).thenReturn(testOSregion);
+
+        List<Region> getAllList = new ArrayList<>();
+        getAllList.add(testOSregion);
+        getAllList.add(testOSregion);
+        doReturn(getAllList).when(regionService).list();
+
+        dummyRegion = createRegion();
+
+        when(testOSregion.getDescription()).thenReturn(dummyRegion.getDescription());
+    }
+
+    @Test
+    public void createTest() throws Exception {
+        msg.setHeader(KeystoneConstants.OPERATION, KeystoneConstants.CREATE);
+        msg.setHeader(KeystoneConstants.DESCRIPTION, dummyRegion.getDescription());
+
+        producer.process(exchange);
+
+        ArgumentCaptor<Region> captor = ArgumentCaptor.forClass(Region.class);
+        verify(regionService).create(captor.capture());
+
+        assertEqualsRegion(dummyRegion, captor.getValue());
+    }
+
+    @Test
+    public void getTest() throws Exception {
+        final String id = "id";
+        msg.setHeader(NeutronConstants.OPERATION, NeutronConstants.GET);
+        msg.setHeader(NeutronConstants.ID, id);
+
+        producer.process(exchange);
+
+        ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
+        verify(regionService).get(captor.capture());
+
+        assertEquals(id, captor.getValue());
+        assertEqualsRegion(testOSregion, msg.getBody(Region.class));
+    }
+
+    @Test
+    public void getAllTest() throws Exception {
+        msg.setHeader(NeutronConstants.OPERATION, NeutronConstants.GET_ALL);
+
+        producer.process(exchange);
+
+        final List<Network> result = msg.getBody(List.class);
+        assertTrue(result.size() == 2);
+        assertEquals(testOSregion, result.get(0));
+    }
+
+    @Test
+    public void updateTest() throws Exception {
+        final String id = "myID";
+        msg.setHeader(KeystoneConstants.OPERATION, KeystoneConstants.UPDATE);
+
+        when(testOSregion.getId()).thenReturn(id);
+        final String newDescription = "ndesc";
+        when(testOSregion.getDescription()).thenReturn(newDescription);
+
+        when(regionService.update(any(Region.class))).thenReturn(testOSregion);
+        msg.setBody(testOSregion);
+
+        producer.process(exchange);
+
+        ArgumentCaptor<Region> captor = ArgumentCaptor.forClass(Region.class);
+        verify(regionService).update(captor.capture());
+
+        assertEqualsRegion(testOSregion, captor.getValue());
+        assertNotNull(captor.getValue().getId());
+        assertEquals(newDescription, msg.getBody(Region.class).getDescription());
+    }
+
+    @Test
+    public void deleteTest() throws Exception {
+        when(regionService.delete(anyString())).thenReturn(ActionResponse.actionSuccess());
+        final String networkID = "myID";
+        msg.setHeader(NeutronConstants.OPERATION, NeutronConstants.DELETE);
+        msg.setHeader(NeutronConstants.ID, networkID);
+
+        producer.process(exchange);
+
+        ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
+        verify(regionService).delete(captor.capture());
+        assertEquals(networkID, captor.getValue());
+        assertFalse(msg.isFault());
+
+        //in case of failure
+        final String failureMessage = "fail";
+        when(regionService.delete(anyString())).thenReturn(ActionResponse.actionFailed(failureMessage, 404));
+        producer.process(exchange);
+        assertTrue(msg.isFault());
+        assertTrue(msg.getBody(String.class).contains(failureMessage));
+    }
+
+    private void assertEqualsRegion(Region old, Region newRegion) {
+        assertEquals(old.getDescription(), newRegion.getDescription());
+    }
+
+    private Region createRegion() {
+        return Builders.region()
+                .description("desc")
+                .build();
+    }
 
 }


Mime
View raw message