예제 #1
0
 @Test
 public void testUpdateDomain() throws Exception {
   domainApi.update(
       testDomain, DomainOptions.Builder.responsiblePerson("another-tester.jclouds.org."));
   Domain domain = domainApi.get(testDomain);
   assertEquals(domain.getResponsiblePerson(), "another-tester.jclouds.org.");
 }
예제 #2
0
  @Test
  public void testUpdateRecord() throws Exception {
    int before = domainApi.listRecords(testDomain).size();

    domainApi.createRecord(testDomain, "testeditbefore", "A", "127.0.0.1");

    assertTrue(recordCounter.apply(before + 1));

    String recordId = null;
    for (DomainRecord record : domainApi.listRecords(testDomain)) {
      if ("testeditbefore".equals(record.getHost())) {
        assertEquals(record.getType(), "A");
        assertEquals(record.getData(), "127.0.0.1");
        recordId = record.getId();
      }
    }

    assertNotNull(recordId);

    domainApi.updateRecord(recordId, UpdateRecordOptions.Builder.host("testeditafter"));

    boolean found = false;
    for (DomainRecord record : domainApi.listRecords(testDomain)) {
      if (recordId.equals(record.getId())) {
        assertEquals(record.getHost(), "testeditafter");
        assertEquals(record.getType(), "A");
        assertEquals(record.getData(), "127.0.0.1");
        found = true;
      }
    }
    assertTrue(found);
  }
예제 #3
0
  @Test
  public void testDeleteRecord() throws Exception {
    Set<DomainRecord> domainRecords = domainApi.listRecords(testDomain);

    int before = domainRecords.size();

    domainApi.deleteRecord(domainRecords.iterator().next().getId());

    assertTrue(recordCounter.apply(before - 1));
  }
예제 #4
0
  @Test
  public void testCreateRecord() throws Exception {
    int before = domainApi.listRecords(testDomain).size();

    domainApi.createRecord(testDomain, "test", "A", "127.0.0.1");

    assertTrue(recordCounter.apply(before + 1));

    for (DomainRecord record : domainApi.listRecords(testDomain)) {
      if ("test".equals(record.getHost())) {
        assertEquals(record.getType(), "A");
        assertEquals(record.getData(), "127.0.0.1");
      }
    }
  }
예제 #5
0
 @Test
 public void testGetDomain() throws Exception {
   Domain domain = domainApi.get(testDomain);
   assertNotNull(domain);
   assertEquals(domain.getName(), testDomain);
   assertNotNull(domain.getCreateTime());
 }