nacx commented on a change in pull request #1: JCLOUDS-1492 Dimension Data 
Feature API Predicates are not usable
URL: https://github.com/apache/jclouds-labs/pull/1#discussion_r270677364
 
 

 ##########
 File path: 
dimensiondata/src/test/java/org/jclouds/dimensiondata/cloudcontrol/features/NetworkApiLiveTest.java
 ##########
 @@ -42,114 +42,134 @@
 import static org.testng.Assert.assertTrue;
 
 @Test(groups = "live", testName = "NetworkApiLiveTest", singleThreaded = true)
-public class NetworkApiLiveTest extends 
BaseDimensionDataCloudControlApiLiveTest {
-
-   private String networkDomainId;
-   private String networkDomainName;
-   private String vlanId;
-   private String portListId;
-   private String firewallRuleId;
-
-   private List<String> firewallRuleIds;
-
-   @BeforeClass
-   public void init() {
-      firewallRuleIds = Lists.newArrayList();
-   }
-
-   @Test(dependsOnMethods = "testDeployVlan")
-   public void testCreatePortList() {
-      portListId = api()
-            .createPortList(networkDomainId, 
this.getClass().getCanonicalName(), this.getClass().getCanonicalName(),
-                  ImmutableList.of(FirewallRuleTarget.Port.create(22, null)), 
Lists.<String>newArrayList());
-      assertNotNull(portListId);
-   }
-
-   @Test(dependsOnMethods = "testCreatePortList")
-   public void testGetPortList() {
-      FirewallRuleTarget.PortList portList = api().getPortList(portListId);
-      assertNotNull(portList);
-      assertTrue(portList.port().get(0).begin() == 22);
-   }
-
-   @Test(dependsOnMethods = "testGetPortList")
-   public void testCreateFirewallRuleWithPortList() {
-      firewallRuleId = api().createFirewallRule(networkDomainId, 
generateFirewallRuleName("server-id"), DEFAULT_ACTION,
-            DEFAULT_IP_VERSION, DEFAULT_PROTOCOL, 
FirewallRuleTarget.builder().ip(IpRange.create("ANY", null)).build(),
-            FirewallRuleTarget.builder().ip(IpRange.create("ANY", 
null)).portListId(portListId).build(), Boolean.TRUE,
-            Placement.builder().position("LAST").build());
-      firewallRuleIds.add(firewallRuleId);
-   }
-
-   @Test(dependsOnMethods = "testCreateFirewallRuleWithPortList")
-   public void testListFirewallRules() {
-      PagedIterable<FirewallRule> firewallRulesList = 
api().listFirewallRules(networkDomainId);
-      assertFalse(firewallRulesList.isEmpty());
-      
assertEquals(firewallRulesList.last().get().first().get().networkDomainId(), 
networkDomainId);
-   }
-
-   @Test(dependsOnMethods = "testListFirewallRules")
-   public void testDeleteFirewallRule() {
-      api().deleteFirewallRule(firewallRuleId);
-      FirewallRule rule = 
findById(api().listFirewallRules(networkDomainId).concat().toList(), 
firewallRuleId);
-      assertNull(rule);
-   }
-
-   @Test(dependsOnMethods = "testDeployNetworkDomain")
-   public void testDeployVlan() {
-      vlanId = api().deployVlan(networkDomainId, 
NetworkApiLiveTest.class.getSimpleName() + new Date().getTime(),
-            NetworkApiLiveTest.class.getSimpleName() + new Date().getTime(), 
DEFAULT_PRIVATE_IPV4_BASE_ADDRESS,
-            DEFAULT_PRIVATE_IPV4_PREFIX_SIZE);
-      assertNotNull(vlanId);
-      assertTrue(vlanNormalPredicate.apply(vlanId), "vlan is not in a NORMAL 
state after timeout");
-   }
-
-   @Test
-   public void testDeployNetworkDomain() {
-      networkDomainName = NetworkApiLiveTest.class.getSimpleName() + new 
Date().getTime();
-      networkDomainId = 
api().deployNetworkDomain(datacenters.iterator().next(), networkDomainName,
-            NetworkApiLiveTest.class.getSimpleName() + new Date().getTime() + 
"description", "ESSENTIALS");
-      assertNotNull(networkDomainId);
-      assertTrue(networkDomainNormalPredicate.apply(networkDomainId),
-            "network domain is not in a NORMAL state after timeout");
-   }
-
-   @Test(expectedExceptions = ResourceAlreadyExistsException.class)
-   public void testDeploySameNetworkDomain() {
-      api().deployNetworkDomain(datacenters.iterator().next(), 
networkDomainName, networkDomainName, "ESSENTIALS");
-   }
-
-   @AfterClass
-   public void tearDown() {
-      if (!firewallRuleIds.isEmpty()) {
-         for (String firewallRuleId : firewallRuleIds) {
-            api().deleteFirewallRule(firewallRuleId);
-         }
-      }
-      if (portListId != null) {
-         api().deletePortList(portListId);
-      }
-      if (vlanId != null) {
-         api().deleteVlan(vlanId);
-         assertTrue(vlanDeletedPredicate.apply(vlanId), "vlan is not in a 
DELETED state after timeout");
-      }
-      if (networkDomainId != null) {
-         api().deleteNetworkDomain(networkDomainId);
-         assertTrue(networkDomainDeletedPredicate.apply(networkDomainId),
-               "network domain is not in a DELETED state after timeout");
-      }
-   }
-
-   private NetworkApi api() {
-      return api.getNetworkApi();
-   }
-
-   private FirewallRule findById(List<FirewallRule> collection, String id) {
-      for (FirewallRule rule : collection) {
-         if (rule.id().equals(id)) {
-            return rule;
-         }
-      }
-      return null;
-   }
+public class NetworkApiLiveTest extends 
BaseDimensionDataCloudControlApiLiveTest
 
 Review comment:
   Can you please reformat this file according to the jclouds style guidelines?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to