use of org.openstack4j.model.identity.v3.Region in project camel by apache.
the class RegionProducerTest method setUp.
@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());
}
use of org.openstack4j.model.identity.v3.Region in project camel by apache.
the class RegionProducerTest method updateTest.
@Test
public void updateTest() throws Exception {
final String id = "myID";
msg.setHeader(OpenstackConstants.OPERATION, OpenstackConstants.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());
}
Aggregations