diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/compute/strategy/CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptionsTest.java b/apis/ec2/src/test/java/org/jclouds/ec2/compute/strategy/CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptionsTest.java index 8e9f062aa2..421cb8acb6 100644 --- a/apis/ec2/src/test/java/org/jclouds/ec2/compute/strategy/CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptionsTest.java +++ b/apis/ec2/src/test/java/org/jclouds/ec2/compute/strategy/CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptionsTest.java @@ -20,12 +20,12 @@ import static com.google.common.io.BaseEncoding.base64; import static org.easymock.EasyMock.anyObject; import static org.easymock.EasyMock.createMock; import static org.easymock.EasyMock.expect; +import static org.easymock.EasyMock.partialMockBuilder; import static org.easymock.EasyMock.replay; import static org.easymock.EasyMock.verify; import static org.testng.Assert.assertEquals; import javax.inject.Provider; -import java.lang.reflect.Method; import java.util.Set; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ExecutionException; @@ -103,17 +103,20 @@ public class CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptionsTest { Set generatedGroups = ImmutableSet.of(generatedGroup); // create mocks - CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions strategy = createMock( - CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class, - new Method[] { + CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions strategy = partialMockBuilder( + CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class) + .addMockedMethod( CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class - .getDeclaredMethod("getOptionsProvider"), + .getDeclaredMethod("getOptionsProvider")) + .addMockedMethod( CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class.getDeclaredMethod( "createNewKeyPairUnlessUserSpecifiedOtherwise", String.class, String.class, - TemplateOptions.class), + TemplateOptions.class)) + .addMockedMethod( CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class.getDeclaredMethod( "getSecurityGroupsForTagAndOptions", String.class, String.class, String.class, - TemplateOptions.class) }); + TemplateOptions.class)) + .createMock(); EC2TemplateOptions options = createMock(EC2TemplateOptions.class); Template template = createMock(Template.class); @@ -160,17 +163,20 @@ public class CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptionsTest { Set generatedGroups = ImmutableSet.of(generatedGroup); // create mocks - CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions strategy = createMock( - CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class, - new Method[] { + CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions strategy = partialMockBuilder( + CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class) + .addMockedMethod( CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class - .getDeclaredMethod("getOptionsProvider"), + .getDeclaredMethod("getOptionsProvider")) + .addMockedMethod( CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class.getDeclaredMethod( "createNewKeyPairUnlessUserSpecifiedOtherwise", String.class, String.class, - TemplateOptions.class), + TemplateOptions.class)) + .addMockedMethod( CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class.getDeclaredMethod( "getSecurityGroupsForTagAndOptions", String.class, String.class, String.class, - TemplateOptions.class) }); + TemplateOptions.class)) + .createMock(); EC2TemplateOptions options = createMock(EC2TemplateOptions.class); Template template = createMock(Template.class); diff --git a/project/pom.xml b/project/pom.xml index d1e202ab27..179e628504 100644 --- a/project/pom.xml +++ b/project/pom.xml @@ -275,8 +275,8 @@ org.easymock - easymockclassextension - 3.1 + easymock + 3.4 org.eclipse.jetty @@ -384,7 +384,7 @@ org.easymock - easymockclassextension + easymock test diff --git a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/strategy/CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptionsTest.java b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/strategy/CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptionsTest.java index 3c738a6926..fd49aa27ae 100644 --- a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/strategy/CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptionsTest.java +++ b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/strategy/CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptionsTest.java @@ -21,6 +21,7 @@ import static com.google.common.io.BaseEncoding.base64; import static org.easymock.EasyMock.anyObject; import static org.easymock.EasyMock.createMock; import static org.easymock.EasyMock.expect; +import static org.easymock.EasyMock.partialMockBuilder; import static org.easymock.EasyMock.replay; import static org.easymock.EasyMock.verify; import static org.jclouds.aws.ec2.compute.AWSEC2TemplateOptions.Builder.keyPair; @@ -28,7 +29,6 @@ import static org.jclouds.ec2.compute.strategy.CreateKeyPairAndSecurityGroupsAsN import static org.jclouds.ec2.compute.strategy.CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptionsTest.KEYPAIR; import static org.testng.Assert.assertEquals; -import java.lang.reflect.Method; import java.util.Set; import java.util.concurrent.ConcurrentMap; @@ -84,20 +84,24 @@ public class CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptionsT Set generatedGroups = ImmutableSet.of(generatedGroup); // create mocks - CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions strategy = createMock( - CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.class, - new Method[] { + CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions strategy = partialMockBuilder( + CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.class) + .addMockedMethod( CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class - .getDeclaredMethod("getOptionsProvider"), + .getDeclaredMethod("getOptionsProvider")) + .addMockedMethod( CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class.getDeclaredMethod( "createNewKeyPairUnlessUserSpecifiedOtherwise", String.class, String.class, - TemplateOptions.class), + TemplateOptions.class)) + .addMockedMethod( CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.class.getDeclaredMethod( "createNewPlacementGroupUnlessUserSpecifiedOtherwise", String.class, String.class, - TemplateOptions.class), + TemplateOptions.class)) + .addMockedMethod( CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class.getDeclaredMethod( "getSecurityGroupsForTagAndOptions", String.class, String.class, String.class, - TemplateOptions.class) }); + TemplateOptions.class)) + .createMock(); AWSEC2TemplateOptions options = createMock(AWSEC2TemplateOptions.class); Template template = createMock(Template.class); @@ -147,20 +151,24 @@ public class CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptionsT Set generatedGroups = ImmutableSet.of(generatedGroup); // create mocks - CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions strategy = createMock( - CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.class, - new Method[] { + CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions strategy = partialMockBuilder( + CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.class) + .addMockedMethod( CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class - .getDeclaredMethod("getOptionsProvider"), + .getDeclaredMethod("getOptionsProvider")) + .addMockedMethod( CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class.getDeclaredMethod( "createNewKeyPairUnlessUserSpecifiedOtherwise", String.class, String.class, - TemplateOptions.class), + TemplateOptions.class)) + .addMockedMethod( CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.class.getDeclaredMethod( "createNewPlacementGroupUnlessUserSpecifiedOtherwise", String.class, String.class, - TemplateOptions.class), + TemplateOptions.class)) + .addMockedMethod( CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class.getDeclaredMethod( "getSecurityGroupsForTagAndOptions", String.class, String.class, String.class, - TemplateOptions.class) }); + TemplateOptions.class)) + .createMock(); AWSEC2TemplateOptions options = createMock(AWSEC2TemplateOptions.class); Template template = createMock(Template.class); @@ -213,20 +221,24 @@ public class CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptionsT Set generatedGroups = ImmutableSet.of(generatedGroup); // create mocks - CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions strategy = createMock( - CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.class, - new Method[] { + CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions strategy = partialMockBuilder( + CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.class) + .addMockedMethod( CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class - .getDeclaredMethod("getOptionsProvider"), + .getDeclaredMethod("getOptionsProvider")) + .addMockedMethod( CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class.getDeclaredMethod( "createNewKeyPairUnlessUserSpecifiedOtherwise", String.class, String.class, - TemplateOptions.class), + TemplateOptions.class)) + .addMockedMethod( CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.class.getDeclaredMethod( "createNewPlacementGroupUnlessUserSpecifiedOtherwise", String.class, String.class, - TemplateOptions.class), + TemplateOptions.class)) + .addMockedMethod( CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class.getDeclaredMethod( "getSecurityGroupsForTagAndOptions", String.class, String.class, String.class, - TemplateOptions.class) }); + TemplateOptions.class)) + .createMock(); AWSEC2TemplateOptions options = createMock(AWSEC2TemplateOptions.class); Template template = createMock(Template.class); @@ -277,22 +289,27 @@ public class CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptionsT String systemGeneratedKeyPairName = "systemGeneratedKeyPair"; // create mocks - CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions strategy = createMock( - CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.class, - new Method[] { + CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions strategy = partialMockBuilder( + CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.class) + .addMockedMethod( CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class - .getDeclaredMethod("getOptionsProvider"), + .getDeclaredMethod("getOptionsProvider")) + .addMockedMethod( CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class.getDeclaredMethod( "createNewKeyPairUnlessUserSpecifiedOtherwise", String.class, String.class, - TemplateOptions.class), + TemplateOptions.class)) + .addMockedMethod( CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.class.getDeclaredMethod( "createNewPlacementGroupUnlessUserSpecifiedOtherwise", String.class, String.class, - TemplateOptions.class), + TemplateOptions.class)) + .addMockedMethod( CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class.getDeclaredMethod( "getSecurityGroupsForTagAndOptions", String.class, String.class, String.class, - TemplateOptions.class), + TemplateOptions.class)) + .addMockedMethod( CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class.getDeclaredMethod( - "vpcIdForSubnet", String.class)}); + "vpcIdForSubnet", String.class)) + .createMock(); AWSEC2TemplateOptions options = createMock(AWSEC2TemplateOptions.class); Template template = createMock(Template.class); @@ -342,20 +359,24 @@ public class CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptionsT Set generatedGroups = ImmutableSet.of(generatedGroup); // create mocks - CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions strategy = createMock( - CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.class, - new Method[] { + CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions strategy = partialMockBuilder( + CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.class) + .addMockedMethod( CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class - .getDeclaredMethod("getOptionsProvider"), + .getDeclaredMethod("getOptionsProvider")) + .addMockedMethod( CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class.getDeclaredMethod( "createNewKeyPairUnlessUserSpecifiedOtherwise", String.class, String.class, - TemplateOptions.class), + TemplateOptions.class)) + .addMockedMethod( CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.class.getDeclaredMethod( "createNewPlacementGroupUnlessUserSpecifiedOtherwise", String.class, String.class, - TemplateOptions.class), + TemplateOptions.class)) + .addMockedMethod( CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class.getDeclaredMethod( "getSecurityGroupsForTagAndOptions", String.class, String.class, String.class, - TemplateOptions.class) }); + TemplateOptions.class)) + .createMock(); AWSEC2TemplateOptions options = createMock(AWSEC2TemplateOptions.class); Template template = createMock(Template.class);