Package com.dyn.client.v3.traffic

Examples of com.dyn.client.v3.traffic.DynTrafficApi


   HttpResponse getResponse = HttpResponse.builder().statusCode(OK.getStatusCode())
         .payload(payloadFromResourceWithContentType("/get_redirect.json", APPLICATION_JSON)).build();

   public void testGetWhenResponseIs2xx() {
      DynTrafficApi success = requestsSendResponses(createSession, createSessionResponse, get, getResponse);
      assertEquals(success.getHttpRedirectApiForZone("redirect.adriancole.zone.dynecttest.jclouds.org").getHttpRedirect("redirect.adriancole.zone.dynecttest.jclouds.org").toString(),
                   HttpRedirect.builder().url("http://foo.com/").code(301).keepUri(true).fqdn("redirect.adriancole.zone.dynecttest.jclouds.org").zone("redirect.adriancole.zone.dynecttest.jclouds.org").build().toString());
   }
View Full Code Here


   HttpResponse createResponse = HttpResponse.builder().statusCode(OK.getStatusCode())
         .payload(payloadFromResourceWithContentType("/new_redirect.json", APPLICATION_JSON)).build();

   public void testCreateWhenResponseIs2xx() {
    DynTrafficApi success = requestsSendResponses(createSession, createSessionResponse, create, createResponse);
      assertEquals(success.getHttpRedirectApiForZone("redirect.adriancole.zone.dynecttest.jclouds.org").scheduleCreate(
          HttpRedirect.builder().url("http://foo.com/").code(301).keepUri(true).fqdn("redirect.adriancole.zone.dynecttest.jclouds.org")
          .zone("redirect.adriancole.zone.dynecttest.jclouds.org").build()), Job.success(387928810l));
   }
View Full Code Here

   HttpResponse listResponse = HttpResponse.builder().statusCode(OK.getStatusCode())
         .payload(payloadFromResourceWithContentType("/list_redirects.json", APPLICATION_JSON)).build();

   public void testListWhenResponseIs2xx() {
    DynTrafficApi success = requestsSendResponses(createSession, createSessionResponse, list, listResponse);
      assertEquals(success.getHttpRedirectApiForZone("redirect.adriancole.zone.dynecttest.jclouds.org").list().toString(),
                   "[redirect.adriancole.zone.dynecttest.jclouds.org]");
   }
View Full Code Here

   HttpResponse deleteResponse = HttpResponse.builder().statusCode(OK.getStatusCode())
         .payload(payloadFromResourceWithContentType("/delete_redirect.json", APPLICATION_JSON)).build();

   public void testDeleteWhenResponseIs2xx() {
    DynTrafficApi success = requestsSendResponses(createSession, createSessionResponse, delete, deleteResponse);
      assertEquals(success.getHttpRedirectApiForZone("redirect.adriancole.zone.dynecttest.jclouds.org").scheduleDelete("redirect.adriancole.zone.dynecttest.jclouds.org").toString(),
                   Job.success(387955406l).toString());
   }
View Full Code Here

   HttpResponse listResponse = HttpResponse.builder().statusCode(OK.getStatusCode())
         .payload(payloadFromResourceWithContentType("/list_geo_regiongroups.json", APPLICATION_JSON)).build();

   public void testListWhenResponseIs2xx() {
      DynTrafficApi success = requestsSendResponses(createSession, createSessionResponse, list, listResponse);
      assertEquals(success.getGeoRegionGroupApiForService("srv").list().toString(),
            new ListGeoRegionGroupsResponseTest().expected().toString());
   }
View Full Code Here

   HttpResponse getResponse = HttpResponse.builder().statusCode(OK.getStatusCode())
         .payload(payloadFromResourceWithContentType("/get_geo_regiongroup.json", APPLICATION_JSON)).build();

   public void testGetWhenResponseIs2xx() {
      DynTrafficApi success = requestsSendResponses(createSession, createSessionResponse, get, getResponse);
      assertEquals(success.getGeoRegionGroupApiForService("srv").get("Everywhere Else").toString(),
            new GetGeoRegionGroupResponseTest().expected().toString());
   }
View Full Code Here

         byte[] data = closeClientButKeepContentStream(response);
         String message = data != null ? new String(data) : null;
         if (message != null) {
            exception = new HttpResponseException(command, response, message);
            if (message.indexOf(JOB_STILL_RUNNING) != -1)
               exception = new JobStillRunningException(JOB_STILL_RUNNING, exception);
            else if (message.indexOf(OPERATION_BLOCKED) != -1)
               exception = new JobStillRunningException(OPERATION_BLOCKED, exception);
            else if (message.indexOf(TARGET_EXISTS) != -1)
               exception = new TargetExistsException(TARGET_EXISTS, exception);
         } else {
            exception = new HttpResponseException(command, response);
         }
View Full Code Here

            if (message.indexOf(JOB_STILL_RUNNING) != -1)
               exception = new JobStillRunningException(JOB_STILL_RUNNING, exception);
            else if (message.indexOf(OPERATION_BLOCKED) != -1)
               exception = new JobStillRunningException(OPERATION_BLOCKED, exception);
            else if (message.indexOf(TARGET_EXISTS) != -1)
               exception = new TargetExistsException(TARGET_EXISTS, exception);
         } else {
            exception = new HttpResponseException(command, response);
         }
      } finally {
         releasePayload(response);
View Full Code Here

   @Test
   protected void testListAndGetGeoServices() {
      ImmutableList<String> geos = api().list().toList();
      getAnonymousLogger().info("geo services: " + geos.size());
      for (String fqdn : geos) {
         GeoService geo = api().get(fqdn);
         checkGeoService(geo);
      }
   }
View Full Code Here

   String fqdn = System.getProperty("user.name").replace('.', '-') + ".zone.dynecttest.jclouds.org";
   String contact = JcloudsVersion.get() + ".jclouds.org";

   @Test
   public void testCreateZone() {
      Job job = api().scheduleCreateWithContact(fqdn, contact);
      checkNotNull(job, "unable to create zone %s", fqdn);
      getAnonymousLogger().info("created zone: " + job);
      assertEquals(job.getStatus(), Status.SUCCESS);
      assertEquals(api.getJob(job.getId()), job);
   }
View Full Code Here

TOP

Related Classes of com.dyn.client.v3.traffic.DynTrafficApi

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.