@Test
public final void testCreateCommand() {
String sample =
"{\"volId\":10,\"pool\":{\"id\":201,\"uuid\":\"" + s_testLocalStoreUUID + "\",\"host\":\"10.70.176.29\"" + ",\"path\":" + s_testLocalStorePathJSON +
",\"port\":0,\"type\":\"Filesystem\"}," + "\"diskCharacteristics\":{\"size\":0," + "\"tags\":[],\"type\":\"ROOT\",\"name\":\"ROOT-9\"," +
"\"useLocalStorage\":true,\"recreatable\":true," + "\"diskOfferingId\":11," + "\"volumeId\":10,\"hyperType\":\"Hyperv\"}," + "\"templateUrl\":" +
s_testSampleTemplateURLJSON + ",\"contextMap\":{},\"wait\":0}";
File destDir = new File(s_testLocalStorePath);
Assert.assertTrue(destDir.isDirectory());
File testSampleTemplateURLFile = new File(s_testLocalStorePath + File.separator + s_gson.fromJson(s_testSampleTemplateURLJSON, String.class));
Assert.assertTrue("The template that create should make" + " volumes from is missing from path " + testSampleTemplateURLFile.getPath(),
testSampleTemplateURLFile.exists());
int fileCount = destDir.listFiles().length;
s_logger.debug(" test local store has " + fileCount + "files");
CreateCommand cmd = s_gson.fromJson(sample, CreateCommand.class);
CreateAnswer ans = (CreateAnswer)s_hypervresource.executeRequest(cmd);
Assert.assertTrue(ans.getDetails(), ans.getResult());
Assert.assertTrue("CreateCommand should add a file to the folder", fileCount + 1 == destDir.listFiles().length);
File newFile = new File(ans.getVolume().getPath());
Assert.assertTrue("The new file should have a size greater than zero", newFile.length() > 0);
newFile.delete();
}