FabricApi extends NsxClientApi { public void createTransportZone(TransportZoneCreateSpec request, FutureCallback<TransportZone> responseCallback) throws IOException { postAsync(TRANSPORT_ZONES_BASE_PATH, serializeObjectAsJson(request), HttpStatus.SC_CREATED, new TypeReference<TransportZone>() {}, responseCallback); } FabricApi(RestClient restClient); void registerFabricNode(FabricNodeCreateSpec request,
                                 FutureCallback<FabricNode> responseCallback); void getFabricNode(String id,
                            FutureCallback<FabricNode> responseCallback); void getFabricNodeState(String id,
                                 FutureCallback<FabricNodeState> responseCallback); void unregisterFabricNode(String id,
                                   FutureCallback<Void> responseCallback); void createTransportNode(TransportNodeCreateSpec request,
                                  FutureCallback<TransportNode> responseCallback); void getTransportNode(String id,
                               FutureCallback<TransportNode> responseFutureCallback); void getTransportNodeState(String id,
                                    FutureCallback<TransportNodeState> responseCallback); void deleteTransportNode(String id,
                                  FutureCallback<Void> responseCallback); void createTransportZone(TransportZoneCreateSpec request,
                                  FutureCallback<TransportZone> responseCallback); void getTransportZone(String id,
                               FutureCallback<TransportZone> responseCallback); void getTransportZoneSummary(String id,
                                      FutureCallback<TransportZoneSummary> responseCallback); void deleteTransportZone(String id,
                                  FutureCallback<Void> responseCallback); static final String FABRIC_NODES_BASE_PATH; static final String TRANSPORT_NODES_BASE_PATH; static final String TRANSPORT_ZONES_BASE_PATH; }
@Test public void testCreateTransportZone() throws IOException, InterruptedException { final TransportZone mockResponse = new TransportZone(); mockResponse.setId("id"); setupMocks(objectMapper.writeValueAsString(mockResponse), HttpStatus.SC_CREATED); FabricApi client = new FabricApi(restClient); final CountDownLatch latch = new CountDownLatch(1); client.createTransportZone(new TransportZoneCreateSpec(), new com.google.common.util.concurrent.FutureCallback<TransportZone>() { @Override public void onSuccess(TransportZone result) { assertEquals(result, mockResponse); latch.countDown(); } @Override public void onFailure(Throwable t) { fail(t.toString()); latch.countDown(); } }); assertThat(latch.await(COUNTDOWNLATCH_AWAIT_TIMEOUT, TimeUnit.SECONDS), is(true)); }