List of usage examples for java.util.concurrent.atomic AtomicInteger get
public final int get()
From source file:com.android.leanlauncher.Workspace.java
public void beginDragShared(View child, DragSource source) { child.clearFocus();/*ww w. j a va2 s. c o m*/ child.setPressed(false); // The outline is used to visualize where the item will land if dropped mDragOutline = createDragOutline(child, DRAG_BITMAP_PADDING); mLauncher.onDragStarted(child); // The drag bitmap follows the touch point around on the screen AtomicInteger padding = new AtomicInteger(DRAG_BITMAP_PADDING); final Bitmap b = createDragBitmap(child, padding); final int bmpWidth = b.getWidth(); final int bmpHeight = b.getHeight(); float scale = mLauncher.getDragLayer().getLocationInDragLayer(child, mTempXY); int dragLayerX = Math.round(mTempXY[0] - (bmpWidth - scale * child.getWidth()) / 2); int dragLayerY = Math.round(mTempXY[1] - (bmpHeight - scale * bmpHeight) / 2 - padding.get() / 2); LauncherAppState app = LauncherAppState.getInstance(); DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); Point dragVisualizeOffset = null; Rect dragRect = null; if (child instanceof BubbleTextView) { int iconSize = grid.iconSizePx; int top = child.getPaddingTop(); int left = (bmpWidth - iconSize) / 2; int right = left + iconSize; int bottom = top + iconSize; dragLayerY += top; // Note: The drag region is used to calculate drag layer offsets, but the // dragVisualizeOffset in addition to the dragRect (the size) to position the outline. dragVisualizeOffset = new Point(-padding.get() / 2, padding.get() / 2); dragRect = new Rect(left, top, right, bottom); } // Clear the pressed state if necessary if (child instanceof BubbleTextView) { BubbleTextView icon = (BubbleTextView) child; icon.clearPressedBackground(); } if (child.getTag() == null || !(child.getTag() instanceof ItemInfo)) { String msg = "Drag started with a view that has no tag set. This " + "will cause a crash (issue 11627249) down the line. " + "View: " + child + " tag: " + child.getTag(); throw new IllegalStateException(msg); } DragView dv = mDragController.startDrag(b, dragLayerX, dragLayerY, source, child.getTag(), DragController.DRAG_ACTION_MOVE, dragVisualizeOffset, dragRect, scale); dv.setIntrinsicIconScaleFactor(source.getIntrinsicIconScaleFactor()); b.recycle(); }
From source file:com.igormaznitsa.jute.JuteMojo.java
@Override public void execute() throws MojoExecutionException, MojoFailureException { if (isSkipExecution()) { getLog().info("Tests are skipped."); return;//from w w w. ja va 2s .c om } final File testFolder = this.testClassesDirectory; if (!testFolder.isDirectory()) { getLog().info("No test folder"); return; } getLog().info("Project test folder : " + testFolder.getAbsolutePath()); final File pathToMojoJar; try { pathToMojoJar = new File( this.getClass().getProtectionDomain().getCodeSource().getLocation().toURI().getPath()); } catch (URISyntaxException ex) { throw new MojoExecutionException("Can't get path to the Mojo jar", ex); } final File javaInterpreter = getFilePathToJVMInterpreter(this.java); final String testClassPath = makeClassPath(pathToMojoJar, getClassPathAsFiles()); final TestContainer baseTestConfig = new TestContainer(null, null, null, javaInterpreter == null ? this.java : javaInterpreter.getAbsolutePath(), this.jvmOptions, this.in, -1, this.enforcePrintConsole, false, this.timeout); final List<String> collectedTestFilePaths = collectAllPotentialTestClassPaths(getLog(), this.verbose, testFolder, normalizeStringArray(this.includes), normalizeStringArray(this.excludes)); final Map<TestClassProcessor, List<TestContainer>> extractedTestMethods = new HashMap<TestClassProcessor, List<TestContainer>>(); try { fillListByTestMethods(baseTestConfig, testFolder, collectedTestFilePaths, extractedTestMethods); } catch (IOException ex) { throw new MojoExecutionException("Can't scan test classes", ex); } final long startTime = System.currentTimeMillis(); getLog().info("Global Java options: " + (this.jvmOptions == null ? "<not provided>" : Arrays.toString(this.jvmOptions))); if (javaInterpreter == null) { getLog().info("JVM interpreter as command: " + this.java); } else { getLog().info("Global JVM interpreter as path: " + javaInterpreter.getAbsolutePath()); } if (this.juteTest != null && !this.juteTest.isEmpty()) { getLog().info("NB! Defined juteTest : " + this.juteTest); } getLog().info("Test class path: " + testClassPath); getLog().info(this.timeout <= 0L ? "No Timeout" : "Timeout is " + this.timeout + " ms"); getLog().info("Detected " + Utils.calcNumberOfItems(extractedTestMethods) + " potential test method(s)"); getLog().info(""); final AtomicInteger startedCounter = new AtomicInteger(); final AtomicInteger errorCounter = new AtomicInteger(); final AtomicInteger skippedCounter = new AtomicInteger(); int maxTestNameLength = 0; for (final Map.Entry<TestClassProcessor, List<TestContainer>> e : extractedTestMethods.entrySet()) { for (final TestContainer test : e.getValue()) { if (maxTestNameLength < test.getMethodName().length()) { maxTestNameLength = test.getMethodName().length(); } } } for (final Map.Entry<TestClassProcessor, List<TestContainer>> e : extractedTestMethods.entrySet()) { if (e.getValue().isEmpty()) { continue; } getLog().info(e.getKey().getClassName()); getLog().info(" " + (char) 0x2502); int nextTestIndex = 0; final List<String> logStrings = new ArrayList<String>(); while (!Thread.currentThread().isInterrupted() && nextTestIndex < e.getValue().size()) { try { logStrings.clear(); final int prevStartIndex = nextTestIndex; final int numberOfExecuted = executeNextTestsFromList(logStrings, maxTestNameLength, testClassPath, e.getValue(), prevStartIndex, startedCounter, errorCounter, skippedCounter); getLog().debug("Executed " + numberOfExecuted + " test(s)"); printExecutionResultIntoLog(nextTestIndex + numberOfExecuted >= e.getValue().size(), logStrings); nextTestIndex += numberOfExecuted; } catch (Throwable ex) { throw new MojoExecutionException("Critical error during a test method execution", ex); } } getLog().info(""); } final long delay = System.currentTimeMillis() - startTime; getLog().info(String.format("Tests run: %d, Errors: %d, Skipped: %d, Total time: %s", startedCounter.get(), errorCounter.get(), skippedCounter.get(), Utils.printTimeDelay(delay))); if (errorCounter.get() != 0) { throw new MojoFailureException("Detected failed tests, see session log"); } }
From source file:org.glassfish.jersey.examples.sseitemstore.jersey.JerseyItemStoreResourceTest.java
/** * Test the item addition, addition event broadcasting and item retrieval from {@link ItemStoreResource}. * * @throws Exception in case of a test failure. *///from w w w . ja v a 2 s .c om @Test public void testItemsStore() throws Exception { final List<String> items = Collections.unmodifiableList(Arrays.asList("foo", "bar", "baz")); final WebTarget itemsTarget = target("items"); final CountDownLatch latch = new CountDownLatch(items.size() * MAX_LISTENERS * 2); // countdown on all events final List<Queue<Integer>> indexQueues = new ArrayList<>(MAX_LISTENERS); final EventSource[] sources = new EventSource[MAX_LISTENERS]; final AtomicInteger sizeEventsCount = new AtomicInteger(0); for (int i = 0; i < MAX_LISTENERS; i++) { final int id = i; final EventSource es = EventSource.target(itemsTarget.path("events")).named("SOURCE " + id).build(); sources[id] = es; final Queue<Integer> indexes = new ConcurrentLinkedQueue<>(); indexQueues.add(indexes); es.register(inboundEvent -> { try { if (inboundEvent.getName() == null) { final String data = inboundEvent.readData(); LOGGER.info("[-i-] SOURCE " + id + ": Received event id=" + inboundEvent.getId() + " data=" + data); indexes.add(items.indexOf(data)); } else if ("size".equals(inboundEvent.getName())) { sizeEventsCount.incrementAndGet(); } } catch (Exception ex) { LOGGER.log(Level.SEVERE, "[-x-] SOURCE " + id + ": Error getting event data.", ex); indexes.add(-999); } finally { latch.countDown(); } }); } try { open(sources); for (String item : items) { postItem(itemsTarget, item); } assertTrue("Waiting to receive all events has timed out.", latch.await( (1000 + MAX_LISTENERS * EventSource.RECONNECT_DEFAULT) * getAsyncTimeoutMultiplier(), TimeUnit.MILLISECONDS)); // need to force disconnect on server in order for EventSource.close(...) to succeed with HttpUrlConnection sendCommand(itemsTarget, "disconnect"); } finally { close(sources); } String postedItems = itemsTarget.request().get(String.class); for (String item : items) { assertTrue("Item '" + item + "' not stored on server.", postedItems.contains(item)); } int queueId = 0; for (Queue<Integer> indexes : indexQueues) { for (int i = 0; i < items.size(); i++) { assertTrue("Event for '" + items.get(i) + "' not received in queue " + queueId, indexes.contains(i)); } assertEquals("Not received the expected number of events in queue " + queueId, items.size(), indexes.size()); queueId++; } assertEquals("Number of received 'size' events does not match.", items.size() * MAX_LISTENERS, sizeEventsCount.get()); }
From source file:org.dasein.cloud.azure.tests.network.AzureLoadBalancerSupportWithMockHttpClientTest.java
@Test public void removeServersShouldPostCorrectRequest() throws CloudException, InternalException { final String ROLE_NAME_2 = "TESTROLENAME2"; final String VM_ID_2 = String.format("%s:%s:%s", SERVICE_NAME, DEPLOYMENT_NAME, ROLE_NAME_2); final AtomicInteger postCount = new AtomicInteger(0); new MockUp<CloseableHttpClient>() { @Mock/*from w ww.jav a 2s .c om*/ public CloseableHttpResponse execute(Invocation inv, HttpUriRequest request) throws IOException { if ("GET".equals(request.getMethod()) && DEFINITION_URL.equals(request.getURI().toString())) { assertGet(request, DEFINITION_URL, new Header[] { new BasicHeader("x-ms-version", "2012-03-01") }); DefinitionModel definitionModel = createDefinitionModelWithAnotherServer("Failover", "Enabled", ROLE_NAME_2); DaseinObjectToXmlEntity<DefinitionModel> daseinEntity = new DaseinObjectToXmlEntity<DefinitionModel>( createDefinitionModel("Failover", "Enabled", HC_PORT)); return getHttpResponseMock(getStatusLineMock(HttpServletResponse.SC_OK), daseinEntity, new Header[] { new BasicHeader("x-ms-request-id", UUID.randomUUID().toString()) }); } else if ("POST".equals(request.getMethod()) && DEFINITIONS_URL.equals(request.getURI().toString())) { postCount.incrementAndGet(); assertPost(request, DEFINITIONS_URL, new Header[] { new BasicHeader("x-ms-version", "2012-03-01") }, createDefinitionModel("Failover", "Enabled", HC_PORT)); DefinitionModel definitionModel = new DefinitionModel(); definitionModel.setVersion("2"); DaseinObjectToXmlEntity<DefinitionModel> daseinEntity = new DaseinObjectToXmlEntity<DefinitionModel>( definitionModel); return getHttpResponseMock(getStatusLineMock(HttpServletResponse.SC_OK), daseinEntity, new Header[] { new BasicHeader("x-ms-request-id", UUID.randomUUID().toString()) }); } else { throw new IOException("Request is not mocked"); } } }; loadBalancerSupport.removeServers(LB_NAME, ROLE_NAME_2); assertEquals("LoadBalancerSupport.addServers() post count doesn't match", 1, postCount.get()); }
From source file:org.dasein.cloud.azure.tests.network.AzureVlanSupportTest.java
@Test public void removeVlanShouldPostCorrectRequest() throws CloudException, InternalException { final AtomicInteger putCount = new AtomicInteger(0); new MockUp<CloseableHttpClient>() { @Mock//w ww. jav a 2 s.c o m public CloseableHttpResponse execute(Invocation inv, HttpUriRequest request) throws IOException { if (request.getMethod().equals("GET") && VIRTUAL_NETWORK_SITES_URL.equals(request.getURI().toString())) { DaseinObjectToXmlEntity<VirtualNetworkSitesModel> daseinEntity = new DaseinObjectToXmlEntity<VirtualNetworkSitesModel>( createVirtualNetworkSitesModel(ID, NAME, REGION, CIDR, "Updating")); return getHttpResponseMock(getStatusLineMock(HttpServletResponse.SC_OK), daseinEntity, new Header[] { new BasicHeader("x-ms-request-id", UUID.randomUUID().toString()) }); } else if ("GET".equals(request.getMethod()) && NETWORK_CONFIG_URL.equals(request.getURI().toString())) { DaseinObjectToXmlEntity<NetworkConfigurationModel> daseinEntity = new DaseinObjectToXmlEntity<NetworkConfigurationModel>( createNetworkConfigurationModel(NAME, REGION, CIDR)); return getHttpResponseMock(getStatusLineMock(HttpServletResponse.SC_OK), daseinEntity, new Header[] { new BasicHeader("x-ms-request-id", UUID.randomUUID().toString()) }); } else if ("PUT".equals(request.getMethod())) { putCount.incrementAndGet(); NetworkConfigurationModel networkConfigurationModel = createNetworkConfigurationModel(null, null, null); assertPut(request, NETWORK_CONFIG_URL, new Header[] { new BasicHeader("x-ms-version", "2012-03-01") }, networkConfigurationModel); return getHttpResponseMock(getStatusLineMock(HttpServletResponse.SC_OK), null, new Header[] { new BasicHeader("x-ms-request-id", UUID.randomUUID().toString()) }); } else { throw new IOException("Request is not mocked"); } } }; vlanSupport.removeVlan(ID); assertEquals("removeVlan PUT network config should perform only 1 times", 1, putCount.get()); }
From source file:me.smoe.adar.utils.cam.o.CAMApplication.java
private void go(int cases, boolean buildScore) throws Exception { if (buildScore) { statistics.run();/*from w ww . j a v a2 s . c om*/ } Map<Long, String> cams = new HashMap<>(); for (CAM cam : camRepository.findAll()) { cams.put(cam.getId(), cam.getName()); } AtomicInteger succ = new AtomicInteger(); AtomicInteger fail = new AtomicInteger(); AtomicInteger wrong = new AtomicInteger(); AtomicInteger index = new AtomicInteger(); Page<CAMProduct> products = camProductRepository .findAll(new PageRequest(0, cases, new Sort(Direction.DESC, "id"))); int total = products.getSize(); for (CAMProduct product : products) { THREADPOOLEXECUTOR.execute(() -> { try { Long ca = caMatcher.matcher(product.getName(), product.getBrand(), product.getCategory(), product.getDesc(), 10000); // Long ca = me.smoe.adar.utils.cam.n.matcher.CAMatcher.matcher(product.getCategory(), 20); if (product.getCao().equals(ca)) { System.err.println( String.format("[CAM] Index: %s Id: %s Cao: %s Can: %s", index.incrementAndGet(), product.getId(), cams.get(product.getCao()), cams.get(ca))); } else if (ca != null && cams.get(product.getCao()).equals(cams.get(ca))) { System.err.println( String.format("[CAM] Index: %s Id: %s Cao: %s Can: %s", index.incrementAndGet(), product.getId(), cams.get(product.getCao()), cams.get(ca))); } else if (ca != null) { System.out.println( String.format("[CAM] Index: %s Id: %s Cao: %s Can: %s", index.incrementAndGet(), product.getId(), cams.get(product.getCao()), cams.get(ca))); } else { // System.out.println(String.format("[CAM] Index: %s Id: %s Cao: %s Can: %s", index.incrementAndGet(), product.getId(), cams.get(product.getCao()), cams.get(ca))); } if (ca == null) { fail.incrementAndGet(); return; } if (product.getCao().equals(ca)) { succ.incrementAndGet(); } else if (ca != null && cams.get(product.getCao()).equals(cams.get(ca))) { succ.incrementAndGet(); } else { wrong.incrementAndGet(); } } catch (Exception e) { e.printStackTrace(); } }); } while (!THREADPOOLEXECUTOR.getQueue().isEmpty()) { TimeUnit.SECONDS.sleep(1); } TimeUnit.SECONDS.sleep(2); System.out.println(); System.out.println("[CAM] : " + total); System.out.println("[CAM] ?: " + new BigDecimal(succ.get()).divide(new BigDecimal(total), 4, RoundingMode.HALF_UP) .multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP) + "%"); System.out.println("[CAM] : " + new BigDecimal(fail.get()).divide(new BigDecimal(total), 4, RoundingMode.HALF_UP) .multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP) + "%"); System.out.println("[CAM] : " + new BigDecimal(wrong.get()).divide(new BigDecimal(total), 4, RoundingMode.HALF_UP) .multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP) + "%"); System.exit(0); }
From source file:com.arpnetworking.metrics.impl.ApacheHttpSinkTest.java
@Test public void testRespectsBufferMax() throws InterruptedException { final AtomicInteger droppedEvents = new AtomicInteger(0); final Semaphore semaphoreA = new Semaphore(0); final Semaphore semaphoreB = new Semaphore(0); final Semaphore semaphoreC = new Semaphore(-2); final AtomicInteger recordsReceived = new AtomicInteger(0); _wireMockRule.stubFor(WireMock.requestMatching(new RequestValueMatcher(r -> { recordsReceived.incrementAndGet(); // Annotations Assert.assertEquals(0, r.getAnnotationsCount()); // Dimensions Assert.assertEquals(0, r.getDimensionsCount()); // Samples assertSample(r.getTimersList(), "timer", 7d); assertSample(r.getCountersList(), "counter", 8d); assertSample(r.getGaugesList(), "gauge", 9d); })).willReturn(WireMock.aResponse().withStatus(200))); final Sink sink = new ApacheHttpSink.Builder() .setUri(URI.create("http://localhost:" + _wireMockRule.port() + PATH)).setMaxBatchSize(2) .setParallelism(1).setBufferSize(5).setEmptyQueueInterval(Duration.ofMillis(1000)) .setEventHandler(/*from www. ja v a 2 s . c om*/ new RespectsMaxBufferEventHandler(semaphoreA, semaphoreB, semaphoreC, droppedEvents)) .build(); final TsdEvent event = new TsdEvent(Collections.emptyMap(), createQuantityMap("timer", TsdQuantity.newInstance(7d, null)), createQuantityMap("counter", TsdQuantity.newInstance(8d, null)), createQuantityMap("gauge", TsdQuantity.newInstance(9d, null))); // Add one event to be used as a synchronization point sink.record(event); semaphoreA.acquire(); // Add the actual events to analyze for (int x = 0; x < 10; x++) { sink.record(event); } semaphoreB.release(); semaphoreC.acquire(); // Ensure expected handler was invoked Assert.assertEquals(5, droppedEvents.get()); // Assert number of records received Assert.assertEquals(6, recordsReceived.get()); // Request matcher final RequestPatternBuilder requestPattern = WireMock.postRequestedFor(WireMock.urlEqualTo(PATH)) .withHeader("Content-Type", WireMock.equalTo("application/octet-stream")); // Assert that data was sent _wireMockRule.verify(4, requestPattern); Assert.assertTrue(_wireMockRule.findUnmatchedRequests().getRequests().isEmpty()); }
From source file:com.alibaba.wasp.master.FMaster.java
private boolean isAvailable(final byte[] rootTableName) throws IOException { final AtomicBoolean available = new AtomicBoolean(true); final AtomicInteger entityGroupCount = new AtomicInteger(0); MetaScannerVisitorBase visitor = new MetaScannerVisitorBase() { @Override/* www .jav a2 s . c o m*/ public boolean processRow(Result rowResult) throws IOException { byte[] value = rowResult.getValue(FConstants.CATALOG_FAMILY, FConstants.EGINFO); EntityGroupInfo eginfo = EntityGroupInfo.parseFromOrNull(value); if (eginfo != null) { if (Bytes.equals(eginfo.getTableName(), rootTableName)) { value = rowResult.getValue(FConstants.CATALOG_FAMILY, FConstants.EGLOCATION); if (value == null) { available.set(false); return false; } entityGroupCount.incrementAndGet(); } } // Returning true means "keep scanning" return true; } }; FMetaScanner.metaScan(conf, visitor, rootTableName); return available.get() && (entityGroupCount.get() > 0); }
From source file:com.spectralogic.ds3client.integration.GetJobManagement_Test.java
@Test public void testGetJobUserSuppliedChunkAttemptRetryBehavior() throws IOException, InterruptedException { final String tempPathPrefix = null; final Path tempDirectory = Files.createTempDirectory(Paths.get("."), tempPathPrefix); final String fileName = "beowulf.txt"; try {/*from w ww .j ava 2 s. c om*/ final List<Ds3Object> objects = Lists.newArrayList(new Ds3Object(fileName)); final GetBulkJobSpectraS3Request getBulkJobSpectraS3Request = new GetBulkJobSpectraS3Request( BUCKET_NAME, objects); final GetBulkJobSpectraS3Response getBulkJobSpectraS3Response = client .getBulkJobSpectraS3(getBulkJobSpectraS3Request); final MasterObjectList masterObjectList = getBulkJobSpectraS3Response.getMasterObjectList(); final AtomicInteger numTimesInvokeCalled = new AtomicInteger(0); final AtomicInteger numTimesResetCalled = new AtomicInteger(0); final TransferStrategyBuilder transferStrategyBuilder = new TransferStrategyBuilder() .withDs3Client(client).withMasterObjectList(masterObjectList) .withChannelBuilder(new FileObjectGetter(tempDirectory)) .withRangesForBlobs(PartialObjectHelpers.mapRangesToBlob(masterObjectList.getObjects(), PartialObjectHelpers.getPartialObjectsRanges(objects))) .withChunkAttemptRetryBehavior( new UserSuppliedChunkAttemptRetryBehavior(new ChunkAttemptRetryBehaviorMonitorable() { @Override public void invoke() { numTimesInvokeCalled.getAndIncrement(); } @Override public void reset() { numTimesResetCalled.getAndIncrement(); } })); final TransferStrategy transferStrategy = transferStrategyBuilder.makeGetTransferStrategy(); transferStrategy.transfer(); final Collection<File> filesInTempDirectory = FileUtils.listFiles(tempDirectory.toFile(), null, false); for (final File file : filesInTempDirectory) { assertEquals(fileName, file.getName()); } assertEquals(0, numTimesInvokeCalled.get()); assertEquals(1, numTimesResetCalled.get()); } finally { FileUtils.deleteDirectory(tempDirectory.toFile()); } }
From source file:org.dasein.cloud.azurepack.tests.compute.AzurePackVirtualMachineSupportTest.java
@Test public void lauchVhdVMShouldSendCorrectRequest() throws CloudException, InternalException { final AtomicInteger postCount = new AtomicInteger(0); new StartOrStopVirtualMachinesRequestExecutorMockUp("Start") { @Mock/*from ww w.j a v a2 s . com*/ public void $init(CloudProvider provider, HttpClientBuilder clientBuilder, HttpUriRequest request, ResponseHandler handler) { String requestUri = request.getURI().toString(); if (request.getMethod().equals("POST") && requestUri.equals(String.format(LIST_VM_RESOURCES, ENDPOINT, ACCOUNT_NO))) { requestResourceType = 21; WAPVirtualMachineModel wapVirtualMachineModel = new WAPVirtualMachineModel(); wapVirtualMachineModel.setName(VM_1_NAME); wapVirtualMachineModel.setCloudId(REGION); wapVirtualMachineModel.setStampId(DATACENTER_ID); wapVirtualMachineModel.setVirtualHardDiskId(VHD_1_ID); wapVirtualMachineModel.setHardwareProfileId(HWP_1_ID); List<WAPNewAdapterModel> adapters = new ArrayList<>(); WAPNewAdapterModel newAdapterModel = new WAPNewAdapterModel(); newAdapterModel.setVmNetworkName(VM_1_NETWORK_NAME); adapters.add(newAdapterModel); wapVirtualMachineModel.setNewVirtualNetworkAdapterInput(adapters); assertPost(request, String.format(LIST_VM_RESOURCES, ENDPOINT, ACCOUNT_NO), new Header[0], wapVirtualMachineModel); } else { super.$init(provider, clientBuilder, request, handler); } responseHandler = handler; } @Mock public Object execute() { if (requestResourceType == 21) { postCount.incrementAndGet(); return mapFromModel(this.responseHandler, createWAPVirtualMachineModel()); } else { return super.execute(); } } }; VMLaunchOptions vmLaunchOptions = VMLaunchOptions.getInstance(HWP_1_ID, VHD_1_ID, VM_1_NAME, VM_1_DESCRIPTION); vmLaunchOptions.inVlan(null, DATACENTER_ID, VM_1_NETWORK_ID); VirtualMachine virtualMachine = azurePackVirtualMachineSupport.launch(vmLaunchOptions); assertEquals("terminate doesn't send DELETE request", 1, postCount.get()); assertVirtualMachine(virtualMachine); }