@Test public void testApply() { IngressRule ruleToConvert = IngressRule.builder() .id("some-id") .account("some-account") .securityGroupName("some-group-name") .protocol(IpProtocol.TCP.toString()) .startPort(10) .endPort(20) .CIDR("0.0.0.0/0") .build(); org.jclouds.cloudstack.domain.SecurityGroup origGroup = org.jclouds.cloudstack.domain.SecurityGroup.builder() .id("some-id") .name("some-group") .description("some-description") .account("some-account") .ingressRules(ImmutableSet.of(ruleToConvert)) .build(); CloudStackSecurityGroupToSecurityGroup parser = createGroupParser(); SecurityGroup group = parser.apply(origGroup); assertEquals(group.getId(), origGroup.getId()); assertEquals(group.getProviderId(), origGroup.getId()); assertEquals(group.getName(), origGroup.getName()); assertEquals(group.getOwnerId(), origGroup.getAccount()); assertEquals(group.getIpPermissions(), ImmutableSet.copyOf(transform(origGroup.getIngressRules(), ruleConverter))); }
@Override public SecurityGroup apply(org.jclouds.cloudstack.domain.SecurityGroup group) { SecurityGroupBuilder builder = new SecurityGroupBuilder(); builder.id(group.getId()); builder.providerId(group.getId()); builder.name(group.getName()); builder.ownerId(group.getAccount()); builder.ipPermissions(transform(group.getIngressRules(), ruleToPermission)); return builder.build(); }
CloudStackSecurityGroupToSecurityGroup implements Function<org.jclouds.cloudstack.domain.SecurityGroup, SecurityGroup> { @Override public SecurityGroup apply(org.jclouds.cloudstack.domain.SecurityGroup group) { SecurityGroupBuilder builder = new SecurityGroupBuilder(); builder.id(group.getId()); builder.providerId(group.getId()); builder.name(group.getName()); builder.ownerId(group.getAccount()); builder.ipPermissions(transform(group.getIngressRules(), ruleToPermission)); return builder.build(); } }
CloudStackSecurityGroupToSecurityGroup implements Function<org.jclouds.cloudstack.domain.SecurityGroup, SecurityGroup> { @Override public SecurityGroup apply(org.jclouds.cloudstack.domain.SecurityGroup group) { SecurityGroupBuilder builder = new SecurityGroupBuilder(); builder.id(group.getId()); builder.providerId(group.getId()); builder.name(group.getName()); builder.ownerId(group.getAccount()); builder.ipPermissions(transform(group.getIngressRules(), ruleToPermission)); return builder.build(); } @Inject  CloudStackSecurityGroupToSecurityGroup(Function<IngressRule, IpPermission> ruleToPermission); }
CloudStackSecurityGroupToSecurityGroup implements Function<org.jclouds.cloudstack.domain.SecurityGroup, SecurityGroup> { @Override public SecurityGroup apply(org.jclouds.cloudstack.domain.SecurityGroup group) { SecurityGroupBuilder builder = new SecurityGroupBuilder(); builder.id(group.getId()); builder.providerId(group.getId()); builder.name(group.getName()); builder.ownerId(group.getAccount()); builder.ipPermissions(transform(group.getIngressRules(), ruleToPermission)); return builder.build(); } @Inject  CloudStackSecurityGroupToSecurityGroup(Function<IngressRule, IpPermission> ruleToPermission); @Override SecurityGroup apply(org.jclouds.cloudstack.domain.SecurityGroup group); }
CloudStackSecurityGroupToSecurityGroup implements Function<org.jclouds.cloudstack.domain.SecurityGroup, SecurityGroup> { @Override public SecurityGroup apply(org.jclouds.cloudstack.domain.SecurityGroup group) { SecurityGroupBuilder builder = new SecurityGroupBuilder(); builder.id(group.getId()); builder.providerId(group.getId()); builder.name(group.getName()); builder.ownerId(group.getAccount()); builder.ipPermissions(transform(group.getIngressRules(), ruleToPermission)); return builder.build(); } @Inject  CloudStackSecurityGroupToSecurityGroup(Function<IngressRule, IpPermission> ruleToPermission); @Override SecurityGroup apply(org.jclouds.cloudstack.domain.SecurityGroup group);  }