@Test public void testgetVolumesState() throws Exception{ List<Volume> volumes = new ArrayList<Volume>(); Volume volume = new Volume(); volume.setVolumeId("123"); volume.setState("attached"); volumes.add(volume); PowerMockito.when(describeVolumesResult.getVolumes()).thenReturn(volumes); Map volumeState = ebsRaiderImplUnderTest.getVolumesState("123"); Assert.assertNotNull(volumeState); Assert.assertEquals(volumeState.get("123"),"attached"); }
public Map getVolumesState(String... volumeIds) { Map volumeState = new HashMap(); List<Volume> volumes = ec2Delegator.getEc2().describeVolumes(new DescribeVolumesRequest().withVolumeIds(volumeIds)).getVolumes(); for (Volume volume : volumes) { String status = volume.getState(); String volumeId = volume.getVolumeId(); volumeState.put(volumeId, status); } return volumeState; }
EBSRaiderImpl implements EBSRaider { public Map getVolumesState(String... volumeIds) { Map volumeState = new HashMap(); List<Volume> volumes = ec2Delegator.getEc2().describeVolumes(new DescribeVolumesRequest().withVolumeIds(volumeIds)).getVolumes(); for (Volume volume : volumes) { String status = volume.getState(); String volumeId = volume.getVolumeId(); volumeState.put(volumeId, status); } return volumeState; } }
EBSRaiderImpl implements EBSRaider { public Map getVolumesState(String... volumeIds) { Map volumeState = new HashMap(); List<Volume> volumes = ec2Delegator.getEc2().describeVolumes(new DescribeVolumesRequest().withVolumeIds(volumeIds)).getVolumes(); for (Volume volume : volumes) { String status = volume.getState(); String volumeId = volume.getVolumeId(); volumeState.put(volumeId, status); } return volumeState; } EBSRaiderImpl(); }
EBSRaiderImpl implements EBSRaider { public Map getVolumesState(String... volumeIds) { Map volumeState = new HashMap(); List<Volume> volumes = ec2Delegator.getEc2().describeVolumes(new DescribeVolumesRequest().withVolumeIds(volumeIds)).getVolumes(); for (Volume volume : volumes) { String status = volume.getState(); String volumeId = volume.getVolumeId(); volumeState.put(volumeId, status); } return volumeState; } EBSRaiderImpl(); String detachEbsVolume(String volumeId); String attachEbsVolume(String instanceId, String deviceName, String volumeId); Map getVolumesState(String... volumeIds); List<Volume> getVolumesForGivenInstanceId(String instanceId); }
EBSRaiderImpl implements EBSRaider { public Map getVolumesState(String... volumeIds) { Map volumeState = new HashMap(); List<Volume> volumes = ec2Delegator.getEc2().describeVolumes(new DescribeVolumesRequest().withVolumeIds(volumeIds)).getVolumes(); for (Volume volume : volumes) { String status = volume.getState(); String volumeId = volume.getVolumeId(); volumeState.put(volumeId, status); } return volumeState; } EBSRaiderImpl(); String detachEbsVolume(String volumeId); String attachEbsVolume(String instanceId, String deviceName, String volumeId); Map getVolumesState(String... volumeIds); List<Volume> getVolumesForGivenInstanceId(String instanceId);  }