@Test public void getRuntimeItemByRuntimeKeyNotExisting() { ProviderKey providerKey = mock(ProviderKey.class); RuntimeKey runtimeKey = new RuntimeKey(providerKey, RUNTIME_ID); List<RuntimeQueryResultItem> singleResult = new ArrayList<>(); when(runtimeProvisioningService.executeQuery(any(RuntimeQuery.class))).thenReturn(singleResult); RuntimeListItem result = service.getRuntimeItem(runtimeKey); assertNull(result); }
private void testDeleteRuntime(boolean forced) { ProviderKey providerKey = mock(ProviderKey.class); RuntimeKey runtimeKey = new RuntimeKey(providerKey, RUNTIME_ID); service.deleteRuntime(runtimeKey, forced); verify(runtimeProvisioningService, times(1)).destroyRuntime(RUNTIME_ID, forced); verify(runtimeChangeEvent, times(1)).fire(new RuntimeChangeEvent(RuntimeChange.DELETED, runtimeKey)); }
@Test public void getRuntimeItemByRuntimeKeyNotExisting() { ProviderKey providerKey = mock(ProviderKey.class); RuntimeKey runtimeKey = new RuntimeKey(providerKey, RUNTIME_ID); List<RuntimeQueryResultItem> singleResult = new ArrayList<>(); when(runtimeProvisioningService.executeQuery(any(RuntimeQuery.class))).thenReturn(singleResult); RuntimeListItem result = service.getRuntimeItem(runtimeKey); assertNull(result); }
@Test public void testStartRuntime() { ProviderKey providerKey = mock(ProviderKey.class); RuntimeKey runtimeKey = new RuntimeKey(providerKey, RUNTIME_ID); service.startRuntime(runtimeKey); verify(runtimeProvisioningService, times(1)).startRuntime(RUNTIME_ID); verify(runtimeChangeEvent, times(1)).fire(new RuntimeChangeEvent(RuntimeChange.STARTED, runtimeKey)); }
@Test public void testStopRuntime() { ProviderKey providerKey = mock(ProviderKey.class); RuntimeKey runtimeKey = new RuntimeKey(providerKey, RUNTIME_ID); service.stopRuntime(runtimeKey); verify(runtimeProvisioningService, times(1)).stopRuntime(RUNTIME_ID); verify(runtimeChangeEvent, times(1)).fire(new RuntimeChangeEvent(RuntimeChange.STOPPED, runtimeKey)); }
@Test public void testStartRuntime() { ProviderKey providerKey = mock(ProviderKey.class); RuntimeKey runtimeKey = new RuntimeKey(providerKey, RUNTIME_ID); service.startRuntime(runtimeKey); verify(runtimeProvisioningService, times(1)).startRuntime(RUNTIME_ID); verify(runtimeChangeEvent, times(1)).fire(new RuntimeChangeEvent(RuntimeChange.STARTED, runtimeKey)); }
private void testDeleteRuntime(boolean forced) { ProviderKey providerKey = mock(ProviderKey.class); RuntimeKey runtimeKey = new RuntimeKey(providerKey, RUNTIME_ID); service.deleteRuntime(runtimeKey, forced); verify(runtimeProvisioningService, times(1)).destroyRuntime(RUNTIME_ID, forced); verify(runtimeChangeEvent, times(1)).fire(new RuntimeChangeEvent(RuntimeChange.DELETED, runtimeKey)); }
@Test public void testStopRuntime() { ProviderKey providerKey = mock(ProviderKey.class); RuntimeKey runtimeKey = new RuntimeKey(providerKey, RUNTIME_ID); service.stopRuntime(runtimeKey); verify(runtimeProvisioningService, times(1)).stopRuntime(RUNTIME_ID); verify(runtimeChangeEvent, times(1)).fire(new RuntimeChangeEvent(RuntimeChange.STOPPED, runtimeKey)); }
@Test public void getRuntimeItemByRuntimeKeyExisting() { ProviderKey providerKey = mock(ProviderKey.class); RuntimeKey runtimeKey = new RuntimeKey(providerKey, RUNTIME_ID); List<RuntimeQueryResultItem> singleResult = mockRuntimeQueryResultItemList(1); when(runtimeProvisioningService.executeQuery(any(RuntimeQuery.class))).thenReturn(singleResult); RuntimeListItem expectedItem = buildExpectedResult(singleResult).iterator().next(); RuntimeListItem result = service.getRuntimeItem(runtimeKey); assertEquals(expectedItem, result); }
@Test public void getRuntimeItemByRuntimeKeyExisting() { ProviderKey providerKey = mock(ProviderKey.class); RuntimeKey runtimeKey = new RuntimeKey(providerKey, RUNTIME_ID); List<RuntimeQueryResultItem> singleResult = mockRuntimeQueryResultItemList(1); when(runtimeProvisioningService.executeQuery(any(RuntimeQuery.class))).thenReturn(singleResult); RuntimeListItem expectedItem = buildExpectedResult(singleResult).iterator().next(); RuntimeListItem result = service.getRuntimeItem(runtimeKey); assertEquals(expectedItem, result); }
protected Runtime mockRuntime() { ProviderTypeKey providerTypeKey = mockProviderTypeKey("1"); ProviderKey providerKey = mockProviderKey(providerTypeKey, "1"); RuntimeKey runtimeKey = new RuntimeKey(providerKey, RUNTIME_ID); Runtime runtime = new Runtime(runtimeKey, RUNTIME_NAME, null, RUNTIME_STATUS, ENDPOINT, CREATED_DATE); return runtime; }
protected Runtime mockRuntime() { ProviderTypeKey providerTypeKey = mockProviderTypeKey("1"); ProviderKey providerKey = mockProviderKey(providerTypeKey, "1"); RuntimeKey runtimeKey = new RuntimeKey(providerKey, RUNTIME_ID); Runtime runtime = new Runtime(runtimeKey, RUNTIME_NAME, null, RUNTIME_STATUS, ENDPOINT, CREATED_DATE); return runtime; }
final Runtime runtime = new Runtime(new RuntimeKey(new ProviderKey(new ProviderTypeKey(item.getProviderTypeName(), item.getProviderVersion()), item.getProviderId()),