@Test public void testApply() { IpPermissions authorization = IpPermissions.permitAnyProtocol(); org.jclouds.ec2.domain.SecurityGroup origGroup = org.jclouds.ec2.domain.SecurityGroup.builder() .region("us-east-1") .id("some-id") .name("some-group") .ownerId("some-owner") .description("some-description") .ipPermission(authorization) .build(); EC2SecurityGroupToSecurityGroup parser = createGroupParser(ImmutableSet.of(provider)); SecurityGroup group = parser.apply(origGroup); assertEquals(group.getLocation(), provider); assertEquals(group.getId(), provider.getId() + "/" + origGroup.getName()); assertEquals(group.getProviderId(), origGroup.getId()); assertEquals(group.getName(), origGroup.getName()); assertEquals(group.getIpPermissions(), (Set<IpPermission>)origGroup); assertEquals(group.getOwnerId(), origGroup.getOwnerId()); }
@Override public SecurityGroup apply(org.jclouds.ec2.domain.SecurityGroup group) { SecurityGroupBuilder builder = new SecurityGroupBuilder(); Location location = findLocationWithId(group.getRegion()); builder.location(location); builder.id(group.getRegion() + "/" + idOrName(group)); builder.providerId(group.getId()); builder.name(group.getName()); builder.ipPermissions(group); builder.ownerId(group.getOwnerId()); return builder.build(); }
EC2SecurityGroupToSecurityGroup implements Function<org.jclouds.ec2.domain.SecurityGroup, SecurityGroup> { @Override public SecurityGroup apply(org.jclouds.ec2.domain.SecurityGroup group) { SecurityGroupBuilder builder = new SecurityGroupBuilder(); Location location = findLocationWithId(group.getRegion()); builder.location(location); builder.id(group.getRegion() + "/" + idOrName(group)); builder.providerId(group.getId()); builder.name(group.getName()); builder.ipPermissions(group); builder.ownerId(group.getOwnerId()); return builder.build(); } }
EC2SecurityGroupToSecurityGroup implements Function<org.jclouds.ec2.domain.SecurityGroup, SecurityGroup> { @Override public SecurityGroup apply(org.jclouds.ec2.domain.SecurityGroup group) { SecurityGroupBuilder builder = new SecurityGroupBuilder(); Location location = findLocationWithId(group.getRegion()); builder.location(location); builder.id(group.getRegion() + "/" + idOrName(group)); builder.providerId(group.getId()); builder.name(group.getName()); builder.ipPermissions(group); builder.ownerId(group.getOwnerId()); return builder.build(); } @Inject  EC2SecurityGroupToSecurityGroup(@Memoized Supplier<Set<? extends Location>> locations); }
EC2SecurityGroupToSecurityGroup implements Function<org.jclouds.ec2.domain.SecurityGroup, SecurityGroup> { @Override public SecurityGroup apply(org.jclouds.ec2.domain.SecurityGroup group) { SecurityGroupBuilder builder = new SecurityGroupBuilder(); Location location = findLocationWithId(group.getRegion()); builder.location(location); builder.id(group.getRegion() + "/" + idOrName(group)); builder.providerId(group.getId()); builder.name(group.getName()); builder.ipPermissions(group); builder.ownerId(group.getOwnerId()); return builder.build(); } @Inject  EC2SecurityGroupToSecurityGroup(@Memoized Supplier<Set<? extends Location>> locations); @Override SecurityGroup apply(org.jclouds.ec2.domain.SecurityGroup group); }
EC2SecurityGroupToSecurityGroup implements Function<org.jclouds.ec2.domain.SecurityGroup, SecurityGroup> { @Override public SecurityGroup apply(org.jclouds.ec2.domain.SecurityGroup group) { SecurityGroupBuilder builder = new SecurityGroupBuilder(); Location location = findLocationWithId(group.getRegion()); builder.location(location); builder.id(group.getRegion() + "/" + idOrName(group)); builder.providerId(group.getId()); builder.name(group.getName()); builder.ipPermissions(group); builder.ownerId(group.getOwnerId()); return builder.build(); } @Inject  EC2SecurityGroupToSecurityGroup(@Memoized Supplier<Set<? extends Location>> locations); @Override SecurityGroup apply(org.jclouds.ec2.domain.SecurityGroup group);  }