@Test public void DescribeStorageSnapshots_BasicTest() throws Exception { SnapshotInfo good = new SnapshotInfo(); good.setStatus(StorageProperties.Status.available.toString()); good.setProgress("100"); good.setSizeGb(new Integer(1)); good.setShouldTransfer(Boolean.FALSE); good.setSnapPointId(null); good.setStartTime(new Date()); good.setUserName("unittestuser0"); good.setVolumeId("vol-0000"); good.setSnapshotId("snap-0000"); good.setSnapshotLocation("http: try (TransactionResource tran = Entities.transactionFor(SnapshotInfo.class)) { Entities.persist(good); tran.commit(); } final LogicalStorageManager storageManager = context.mock(LogicalStorageManager.class); context.checking(new Expectations() { { } }); BlockStorageController bsc = new BlockStorageController(storageManager); DescribeStorageSnapshotsType request = new DescribeStorageSnapshotsType(); DescribeStorageSnapshotsResponseType response = bsc.DescribeStorageSnapshots(request); assertTrue("expected at least one snapshot in the response", response != null && response.getSnapshotSet() != null && response.getSnapshotSet().size() > 0); assertTrue("expected to find manually created snapshot in the response", response.getSnapshotSet().get(0).getSnapshotId().equals("snap-0000")); }
@Override public DescribeStorageSnapshotsResponseType DescribeStorageSnapshots(DescribeStorageSnapshotsType request) throws EucalyptusCloudException { DescribeStorageSnapshotsResponseType reply = (DescribeStorageSnapshotsResponseType) request.getReply(); List<String> snapshotSet = request.getSnapshotSet(); ArrayList<SnapshotInfo> snapshotInfos = new ArrayList<SnapshotInfo>(); try (TransactionResource tran = Entities.transactionFor(SnapshotInfo.class)) { if ((snapshotSet != null) && !snapshotSet.isEmpty()) { for (String snapshotSetEntry : snapshotSet) { SnapshotInfo snapshotInfo = new SnapshotInfo(snapshotSetEntry); List<SnapshotInfo> foundSnapshotInfos = Entities.query(snapshotInfo); if (foundSnapshotInfos.size() > 0) { snapshotInfos.add(foundSnapshotInfos.get(0)); } } } else { SnapshotInfo snapshotInfo = new SnapshotInfo(); List<SnapshotInfo> foundSnapshotInfos = Entities.query(snapshotInfo); for (SnapshotInfo snapInfo : foundSnapshotInfos) { snapshotInfos.add(snapInfo); } } ArrayList<StorageSnapshot> snapshots = reply.getSnapshotSet(); for (SnapshotInfo snapshotInfo : snapshotInfos) { snapshots.add(convertSnapshotInfo(snapshotInfo)); } tran.commit(); } return reply; }
BlockStorageController implements BlockStorageService { @Override public DescribeStorageSnapshotsResponseType DescribeStorageSnapshots(DescribeStorageSnapshotsType request) throws EucalyptusCloudException { DescribeStorageSnapshotsResponseType reply = (DescribeStorageSnapshotsResponseType) request.getReply(); List<String> snapshotSet = request.getSnapshotSet(); ArrayList<SnapshotInfo> snapshotInfos = new ArrayList<SnapshotInfo>(); try (TransactionResource tran = Entities.transactionFor(SnapshotInfo.class)) { if ((snapshotSet != null) && !snapshotSet.isEmpty()) { for (String snapshotSetEntry : snapshotSet) { SnapshotInfo snapshotInfo = new SnapshotInfo(snapshotSetEntry); List<SnapshotInfo> foundSnapshotInfos = Entities.query(snapshotInfo); if (foundSnapshotInfos.size() > 0) { snapshotInfos.add(foundSnapshotInfos.get(0)); } } } else { SnapshotInfo snapshotInfo = new SnapshotInfo(); List<SnapshotInfo> foundSnapshotInfos = Entities.query(snapshotInfo); for (SnapshotInfo snapInfo : foundSnapshotInfos) { snapshotInfos.add(snapInfo); } } ArrayList<StorageSnapshot> snapshots = reply.getSnapshotSet(); for (SnapshotInfo snapshotInfo : snapshotInfos) { snapshots.add(convertSnapshotInfo(snapshotInfo)); } tran.commit(); } return reply; } }
BlockStorageController implements BlockStorageService { @Override public DescribeStorageSnapshotsResponseType DescribeStorageSnapshots(DescribeStorageSnapshotsType request) throws EucalyptusCloudException { DescribeStorageSnapshotsResponseType reply = (DescribeStorageSnapshotsResponseType) request.getReply(); List<String> snapshotSet = request.getSnapshotSet(); ArrayList<SnapshotInfo> snapshotInfos = new ArrayList<SnapshotInfo>(); try (TransactionResource tran = Entities.transactionFor(SnapshotInfo.class)) { if ((snapshotSet != null) && !snapshotSet.isEmpty()) { for (String snapshotSetEntry : snapshotSet) { SnapshotInfo snapshotInfo = new SnapshotInfo(snapshotSetEntry); List<SnapshotInfo> foundSnapshotInfos = Entities.query(snapshotInfo); if (foundSnapshotInfos.size() > 0) { snapshotInfos.add(foundSnapshotInfos.get(0)); } } } else { SnapshotInfo snapshotInfo = new SnapshotInfo(); List<SnapshotInfo> foundSnapshotInfos = Entities.query(snapshotInfo); for (SnapshotInfo snapInfo : foundSnapshotInfos) { snapshotInfos.add(snapInfo); } } ArrayList<StorageSnapshot> snapshots = reply.getSnapshotSet(); for (SnapshotInfo snapshotInfo : snapshotInfos) { snapshots.add(convertSnapshotInfo(snapshotInfo)); } tran.commit(); } return reply; } BlockStorageController();  BlockStorageController(LogicalStorageManager blockManager); }
BlockStorageController implements BlockStorageService { @Override public DescribeStorageSnapshotsResponseType DescribeStorageSnapshots(DescribeStorageSnapshotsType request) throws EucalyptusCloudException { DescribeStorageSnapshotsResponseType reply = (DescribeStorageSnapshotsResponseType) request.getReply(); List<String> snapshotSet = request.getSnapshotSet(); ArrayList<SnapshotInfo> snapshotInfos = new ArrayList<SnapshotInfo>(); try (TransactionResource tran = Entities.transactionFor(SnapshotInfo.class)) { if ((snapshotSet != null) && !snapshotSet.isEmpty()) { for (String snapshotSetEntry : snapshotSet) { SnapshotInfo snapshotInfo = new SnapshotInfo(snapshotSetEntry); List<SnapshotInfo> foundSnapshotInfos = Entities.query(snapshotInfo); if (foundSnapshotInfos.size() > 0) { snapshotInfos.add(foundSnapshotInfos.get(0)); } } } else { SnapshotInfo snapshotInfo = new SnapshotInfo(); List<SnapshotInfo> foundSnapshotInfos = Entities.query(snapshotInfo); for (SnapshotInfo snapInfo : foundSnapshotInfos) { snapshotInfos.add(snapInfo); } } ArrayList<StorageSnapshot> snapshots = reply.getSnapshotSet(); for (SnapshotInfo snapshotInfo : snapshotInfos) { snapshots.add(convertSnapshotInfo(snapshotInfo)); } tran.commit(); } return reply; } BlockStorageController();  BlockStorageController(LogicalStorageManager blockManager); static void configure(); static void check(); static void stop(); static void enable(); static void disable(); static void updateStuckVolumes(); static void updateStuckSnapshots(); @Override UpdateStorageConfigurationResponseType UpdateStorageConfiguration(UpdateStorageConfigurationType request); @Override GetStorageConfigurationResponseType GetStorageConfiguration(GetStorageConfigurationType request); @Override GetVolumeTokenResponseType GetVolumeToken(GetVolumeTokenType request); @Override UnexportVolumeResponseType UnexportVolume(UnexportVolumeType request); @Override ExportVolumeResponseType ExportVolume(ExportVolumeType request); @Override GetStorageVolumeResponseType GetStorageVolume(GetStorageVolumeType request); @Override DeleteStorageVolumeResponseType DeleteStorageVolume(DeleteStorageVolumeType request); @Override CreateStorageSnapshotResponseType CreateStorageSnapshot(CreateStorageSnapshotType request); @Override DescribeStorageSnapshotsResponseType DescribeStorageSnapshots(DescribeStorageSnapshotsType request); @Override DeleteStorageSnapshotResponseType DeleteStorageSnapshot(DeleteStorageSnapshotType request); @Override CreateStorageVolumeResponseType CreateStorageVolume(CreateStorageVolumeType request); @Override DescribeStorageVolumesResponseType DescribeStorageVolumes(DescribeStorageVolumesType request); @Override ConvertVolumesResponseType ConvertVolumes(ConvertVolumesType request); @Override AttachStorageVolumeResponseType attachVolume(AttachStorageVolumeType request); @Override DetachStorageVolumeResponseType detachVolume(DetachStorageVolumeType request); @Override CloneVolumeResponseType CloneVolume(CloneVolumeType request); }
BlockStorageController implements BlockStorageService { @Override public DescribeStorageSnapshotsResponseType DescribeStorageSnapshots(DescribeStorageSnapshotsType request) throws EucalyptusCloudException { DescribeStorageSnapshotsResponseType reply = (DescribeStorageSnapshotsResponseType) request.getReply(); List<String> snapshotSet = request.getSnapshotSet(); ArrayList<SnapshotInfo> snapshotInfos = new ArrayList<SnapshotInfo>(); try (TransactionResource tran = Entities.transactionFor(SnapshotInfo.class)) { if ((snapshotSet != null) && !snapshotSet.isEmpty()) { for (String snapshotSetEntry : snapshotSet) { SnapshotInfo snapshotInfo = new SnapshotInfo(snapshotSetEntry); List<SnapshotInfo> foundSnapshotInfos = Entities.query(snapshotInfo); if (foundSnapshotInfos.size() > 0) { snapshotInfos.add(foundSnapshotInfos.get(0)); } } } else { SnapshotInfo snapshotInfo = new SnapshotInfo(); List<SnapshotInfo> foundSnapshotInfos = Entities.query(snapshotInfo); for (SnapshotInfo snapInfo : foundSnapshotInfos) { snapshotInfos.add(snapInfo); } } ArrayList<StorageSnapshot> snapshots = reply.getSnapshotSet(); for (SnapshotInfo snapshotInfo : snapshotInfos) { snapshots.add(convertSnapshotInfo(snapshotInfo)); } tran.commit(); } return reply; } BlockStorageController();  BlockStorageController(LogicalStorageManager blockManager); static void configure(); static void check(); static void stop(); static void enable(); static void disable(); static void updateStuckVolumes(); static void updateStuckSnapshots(); @Override UpdateStorageConfigurationResponseType UpdateStorageConfiguration(UpdateStorageConfigurationType request); @Override GetStorageConfigurationResponseType GetStorageConfiguration(GetStorageConfigurationType request); @Override GetVolumeTokenResponseType GetVolumeToken(GetVolumeTokenType request); @Override UnexportVolumeResponseType UnexportVolume(UnexportVolumeType request); @Override ExportVolumeResponseType ExportVolume(ExportVolumeType request); @Override GetStorageVolumeResponseType GetStorageVolume(GetStorageVolumeType request); @Override DeleteStorageVolumeResponseType DeleteStorageVolume(DeleteStorageVolumeType request); @Override CreateStorageSnapshotResponseType CreateStorageSnapshot(CreateStorageSnapshotType request); @Override DescribeStorageSnapshotsResponseType DescribeStorageSnapshots(DescribeStorageSnapshotsType request); @Override DeleteStorageSnapshotResponseType DeleteStorageSnapshot(DeleteStorageSnapshotType request); @Override CreateStorageVolumeResponseType CreateStorageVolume(CreateStorageVolumeType request); @Override DescribeStorageVolumesResponseType DescribeStorageVolumes(DescribeStorageVolumesType request); @Override ConvertVolumesResponseType ConvertVolumes(ConvertVolumesType request); @Override AttachStorageVolumeResponseType attachVolume(AttachStorageVolumeType request); @Override DetachStorageVolumeResponseType detachVolume(DetachStorageVolumeType request); @Override CloneVolumeResponseType CloneVolume(CloneVolumeType request);  }