コード例 #1
0
  @Test
  public void testUpdateNetwork() {
    VCloudDirectorClient client =
        requestsSendResponses(
            loginRequest,
            sessionResponse,
            new VcloudHttpRequestPrimer()
                .apiCommand("GET", "/admin/network/b466c0c5-8a5c-4335-b703-a2e2e6b5f3e1")
                .xmlFilePayload(
                    "/network/admin/updateNetworkSource.xml", VCloudDirectorMediaType.ORG_NETWORK)
                .acceptMedia(VCloudDirectorMediaType.TASK)
                .httpRequestBuilder()
                .build(),
            new VcloudHttpResponsePrimer()
                .xmlFilePayload(
                    "/network/admin/updateNetworkTask.xml", VCloudDirectorMediaType.TASK)
                .httpResponseBuilder()
                .build());

    Task expected = updateNetworkTask();

    assertEquals(
        client.getAdminNetworkClient().updateNetwork(networkRef.getHref(), updateNetwork()),
        expected);
  }
コード例 #2
0
  @Test(enabled = false)
  public void testResetNetwork() {
    VCloudDirectorClient client =
        requestsSendResponses(
            loginRequest,
            sessionResponse,
            new VcloudHttpRequestPrimer()
                .apiCommand(
                    "POST", "/admin/network/b466c0c5-8a5c-4335-b703-a2e2e6b5f3e1/action/reset")
                .acceptMedia(VCloudDirectorMediaType.TASK)
                .httpRequestBuilder()
                .build(),
            new VcloudHttpResponsePrimer()
                .xmlFilePayload("/network/admin/resetNetworkTask.xml", VCloudDirectorMediaType.TASK)
                .httpResponseBuilder()
                .build());

    Task expected = resetNetworkTask();

    assertEquals(client.getAdminNetworkClient().resetNetwork(networkRef.getHref()), expected);
  }