Package org.jclouds.rackspace.clouddns.v1.features

Examples of org.jclouds.rackspace.clouddns.v1.features.ReverseDNSApiLiveTest


      assertEquals(job.getStatus(), Job.Status.COMPLETED);
      assertTrue(job.getResource().isPresent());
     
      Set<RecordDetail> records = job.getResource().get();
      Date now = new Date();
      RecordDetail ptrRecordIPv4 = null;
      RecordDetail ptrRecordIPv6 = null;
     
      for (RecordDetail record: records) {
         if (record.getData().startsWith("166")) {
            ptrRecordIPv4 = record;
         } else if (record.getData().startsWith("2001")) {
            ptrRecordIPv6 = record;
         }
      }
     
      assertNotNull(ptrRecordIPv4.getId());
      assertEquals(ptrRecordIPv4.getType(), "PTR");
      assertEquals(ptrRecordIPv4.getName(), JCLOUDS_EXAMPLE);
      assertEquals(ptrRecordIPv4.getData(), "166.78.146.80");
      assertEquals(ptrRecordIPv4.getTTL(), 11235);
      assertNull(ptrRecordIPv4.getPriority());
      assertNull(ptrRecordIPv4.getComment());
      assertTrue(ptrRecordIPv4.getCreated().before(now));
      assertTrue(ptrRecordIPv4.getUpdated().before(now));
     
      assertNotNull(ptrRecordIPv6.getId());
      assertEquals(ptrRecordIPv6.getType(), "PTR");
      assertEquals(ptrRecordIPv6.getName(), JCLOUDS_EXAMPLE);
      assertEquals(ptrRecordIPv6.getData(), "2001:4800:7812:514:9a32:3c2a:ff04:aed2"); // leading 0 in 0514 removed
      assertTrue(ptrRecordIPv6.getTTL() > 0);
      assertNull(ptrRecordIPv6.getPriority());
      assertEquals(ptrRecordIPv6.getComment(), "Hello IPv6");
      assertTrue(ptrRecordIPv6.getCreated().before(now));
      assertTrue(ptrRecordIPv6.getUpdated().before(now));
   }
View Full Code Here


            responseWithAccess,
            authenticatedGET().endpoint(endpoint).build(),
            HttpResponse.builder().statusCode(OK.getStatusCode()).payload(payloadFromResource("/record-ptr-get.json")).build())
            .getReverseDNSApiForService(CLOUD_SERVERS_OPEN_STACK);

      RecordDetail record = api.get(SERVER_URI, "PTR-557437");
      Date now = new Date();

      assertEquals(record.getId(), "PTR-557437");
      assertEquals(record.getType(), "PTR");
      assertEquals(record.getName(), JCLOUDS_EXAMPLE);
      assertEquals(record.getData(), "166.78.146.80");
      assertEquals(record.getTTL(), 11235);
      assertNull(record.getPriority());
      assertNull(record.getComment());
      assertTrue(record.getCreated().before(now));
      assertTrue(record.getUpdated().before(now));
   }
View Full Code Here

      assertEquals(job.getStatus(), Job.Status.COMPLETED);
      assertTrue(job.getResource().isPresent());
     
      Set<RecordDetail> records = job.getResource().get();
      Date now = new Date();
      RecordDetail mxRecord = null;
      RecordDetail aRecord = null;
     
      for (RecordDetail record : records) {
         if (record.getType().equals("MX")) {
            mxRecord = record;
         } else if (record.getType().equals("A")) {
            aRecord = record;
         }
      }
     
      assertNotNull(mxRecord.getId());
      assertEquals(mxRecord.getType(), "MX");
      assertEquals(mxRecord.getName(), JCLOUDS_EXAMPLE);
      assertEquals(mxRecord.getPriority().intValue(), 11235);
      assertEquals(mxRecord.getComment(), "MX Record");
      assertEquals(mxRecord.getTTL(), 60000);
      assertTrue(mxRecord.getCreated().before(now));
      assertTrue(mxRecord.getUpdated().before(now));
     
      assertNotNull(aRecord.getId());
      assertEquals(aRecord.getType(), "A");
      assertEquals(aRecord.getName(), JCLOUDS_EXAMPLE);
      assertNull(aRecord.getPriority());
      assertEquals(aRecord.getTTL(), 60000);
      assertTrue(aRecord.getCreated().before(now));
      assertTrue(aRecord.getUpdated().before(now));
   }
View Full Code Here

            responseWithAccess,
            authenticatedGET().endpoint(endpoint).build(),
            HttpResponse.builder().statusCode(OK.getStatusCode()).payload(payloadFromResource("/record-list-with-filter.json")).build())
            .getRecordApiForDomain(3650908);

      RecordDetail record = api.getByNameAndTypeAndData(JCLOUDS_EXAMPLE, "A", "10.0.1.0");
      Date now = new Date();
     
      assertEquals(record.getId(), "A-9846146");
      assertEquals(record.getName(), JCLOUDS_EXAMPLE);
      assertEquals(record.getType(), "A");
      assertEquals(record.getData(), "10.0.1.0");
      assertEquals(record.getTTL(), 60000);
      assertTrue(record.getCreated().before(now));
      assertTrue(record.getUpdated().before(now));
   }
View Full Code Here

            responseWithAccess,
            authenticatedGET().endpoint(endpoint).build(),
            HttpResponse.builder().statusCode(OK.getStatusCode()).payload(payloadFromResource("/record-get.json")).build())
            .getRecordApiForDomain(3650908);

      RecordDetail record = api.get("A-9846146");
      Date now = new Date();

      assertEquals(record.getId(), "A-9846146");
      assertEquals(record.getName(), JCLOUDS_EXAMPLE);
      assertEquals(record.getType(), "A");
      assertEquals(record.getData(), "10.0.1.0");
      assertEquals(record.getTTL(), 60000);
      assertTrue(record.getCreated().before(now));
      assertTrue(record.getUpdated().before(now));
   }
View Full Code Here

      assertEquals(job.getStatus(), Job.Status.COMPLETED);
      assertTrue(job.getResource().isPresent());
     
      Set<RecordDetail> records = job.getResource().get();
      Date now = new Date();
      RecordDetail ptrRecordIPv4 = null;
      RecordDetail ptrRecordIPv6 = null;
     
      for (RecordDetail record : records) {
         if (record.getData().startsWith("166")) {
            ptrRecordIPv4 = record;
         } else if (record.getData().startsWith("2001")) {
            ptrRecordIPv6 = record;
         }
      }
     
      assertNotNull(ptrRecordIPv4.getId());
      assertEquals(ptrRecordIPv4.getType(), "PTR");
      assertEquals(ptrRecordIPv4.getName(), JCLOUDS_EXAMPLE);
      assertEquals(ptrRecordIPv4.getData(), "166.78.146.80");
      assertEquals(ptrRecordIPv4.getTTL(), 11235);
      assertNull(ptrRecordIPv4.getPriority());
      assertNull(ptrRecordIPv4.getComment());
      assertTrue(ptrRecordIPv4.getCreated().before(now));
      assertTrue(ptrRecordIPv4.getUpdated().before(now));
     
      assertNotNull(ptrRecordIPv6.getId());
      assertEquals(ptrRecordIPv6.getType(), "PTR");
      assertEquals(ptrRecordIPv6.getName(), JCLOUDS_EXAMPLE);
      assertEquals(ptrRecordIPv6.getData(), "2001:4800:7812:514:9a32:3c2a:ff04:aed2"); // leading 0 in 0514 removed
      assertTrue(ptrRecordIPv6.getTTL() > 0);
      assertNull(ptrRecordIPv6.getPriority());
      assertEquals(ptrRecordIPv6.getComment(), "Hello IPv6");
      assertTrue(ptrRecordIPv6.getCreated().before(now));
      assertTrue(ptrRecordIPv6.getUpdated().before(now));
   }
View Full Code Here

            responseWithAccess,
            authenticatedGET().endpoint(endpoint).build(),
            HttpResponse.builder().statusCode(OK.getStatusCode()).payload(payloadFromResource("/record-ptr-get.json")).build())
            .getReverseDNSApiForService(CLOUD_SERVERS_OPEN_STACK);

      RecordDetail record = api.get(SERVER_URI, "PTR-557437");
      Date now = new Date();

      assertEquals(record.getId(), "PTR-557437");
      assertEquals(record.getType(), "PTR");
      assertEquals(record.getName(), JCLOUDS_EXAMPLE);
      assertEquals(record.getData(), "166.78.146.80");
      assertEquals(record.getTTL(), 11235);
      assertNull(record.getPriority());
      assertNull(record.getComment());
      assertTrue(record.getCreated().before(now));
      assertTrue(record.getUpdated().before(now));
   }
View Full Code Here

      List<Record> createRecords = ImmutableList.of(createPTRRecordIPv4, createPTRRecordIPv6);
      Set<RecordDetail> records = awaitComplete(api,
            api.getReverseDNSApiForService(CLOUD_SERVERS_OPEN_STACK).create(serverURI, createRecords));

      Date now = new Date();
      RecordDetail ptrRecordIPv4 = null;
      RecordDetail ptrRecordIPv6 = null;

      for (RecordDetail record : records) {
         if (record.getData().equals(serverIPv4)) {
            ptrRecordIPv4 = record;
            ptrRecordIPv4Id = record.getId();
         }
         else {
            ptrRecordIPv6 = record;
            ptrRecordIPv6Id = record.getId();
         }
      }

      assertNotNull(ptrRecordIPv4.getId());
      assertEquals(ptrRecordIPv4.getType(), "PTR");
      assertEquals(ptrRecordIPv4.getName(), JCLOUDS_EXAMPLE);
      assertEquals(ptrRecordIPv4.getData(), serverIPv4);
      assertEquals(ptrRecordIPv4.getTTL(), 11235);
      assertNull(ptrRecordIPv4.getPriority());
      assertNull(ptrRecordIPv4.getComment());
      assertTrue(ptrRecordIPv4.getCreated().before(now));
      assertTrue(ptrRecordIPv4.getUpdated().before(now));

      assertNotNull(ptrRecordIPv6.getId());
      assertEquals(ptrRecordIPv6.getType(), "PTR");
      assertEquals(ptrRecordIPv6.getName(), JCLOUDS_EXAMPLE);
      // can't test equals for data as CDNS will remove leading 0s from IPv6 Addrs
      assertNotNull(ptrRecordIPv6.getData());
      assertTrue(ptrRecordIPv6.getTTL() > 0);
      assertNull(ptrRecordIPv6.getPriority());
      assertEquals(ptrRecordIPv6.getComment(), "Hello IPv6");
      assertTrue(ptrRecordIPv6.getCreated().before(now));
      assertTrue(ptrRecordIPv6.getUpdated().before(now));
   }
View Full Code Here

      Map<String, Record> idsToRecords = ImmutableMap.<String, Record> of(ptrRecordIPv4Id, updatePTRRecordIPv4);

      awaitComplete(api, api.getReverseDNSApiForService(CLOUD_SERVERS_OPEN_STACK).update(serverURI, idsToRecords));

      RecordDetail record = api.getReverseDNSApiForService(CLOUD_SERVERS_OPEN_STACK).get(serverURI, ptrRecordIPv4Id);
      Date now = new Date();

      assertNotNull(record.getId());
      assertEquals(record.getType(), "PTR");
      assertEquals(record.getName(), JCLOUDS_EXAMPLE);
      assertEquals(record.getData(), serverIPv4);
      assertEquals(record.getTTL(), 12358);
      assertNull(record.getPriority());
      assertNull(record.getComment());
      assertTrue(record.getCreated().before(now));
      assertTrue(record.getUpdated().before(now));
   }
View Full Code Here

      Set<RecordDetail> records = awaitComplete(api, api.getRecordApiForDomain(domainId).create(createRecords));

      Thread.sleep(1000);
      Date now = new Date();
     
      RecordDetail mxRecord = null;
      RecordDetail aRecord = null;
      RecordDetail srvRecord = null;
     
      for (RecordDetail record : records) {
         if (record.getType().equals("MX")) {
            mxRecord = record;
         } else if (record.getType().equals("A")) {
            aRecord = record;
         } else if (record.getType().equals("SRV")) {
            srvRecord = record;
         }
      }
     
      assertNotNull(mxRecord.getId());
      assertEquals(mxRecord.getType(), "MX");
      assertEquals(mxRecord.getName(), JCLOUDS_EXAMPLE);
      assertEquals(mxRecord.getPriority().intValue(), 11235);
      assertEquals(mxRecord.getComment(), "MX Record");
      assertEquals(mxRecord.getTTL(), 60000);
      assertTrue(mxRecord.getCreated().before(now));
      assertTrue(mxRecord.getUpdated().before(now));
     
      assertNotNull(aRecord.getId());
      assertEquals(aRecord.getType(), "A");
      assertEquals(aRecord.getName(), JCLOUDS_EXAMPLE);
      assertEquals(aRecord.getData(), "10.0.0.1");
      assertNull(aRecord.getPriority());
      assertEquals(aRecord.getTTL(), 60000);
      assertTrue(aRecord.getCreated().before(now));
      assertTrue(aRecord.getUpdated().before(now));
     
      assertNotNull(srvRecord.getId());
      assertEquals(srvRecord.getType(), "SRV");
      assertEquals(srvRecord.getName(), "_sip._tcp." + JCLOUDS_EXAMPLE);
      assertEquals(srvRecord.getData(), "1 3443 sip." + JCLOUDS_EXAMPLE);
      assertEquals(srvRecord.getPriority().intValue(), 11235);
      assertEquals(srvRecord.getTTL(), 86400);
      assertTrue(srvRecord.getCreated().before(now));
      assertTrue(srvRecord.getUpdated().before(now));
   }
View Full Code Here

TOP

Related Classes of org.jclouds.rackspace.clouddns.v1.features.ReverseDNSApiLiveTest

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.