assertEquals(handoverInfoArguments.size(), 2, String.valueOf(handoverInfoArguments));
Iterator<HandoverInfoArgument> handoverInfoIterator = handoverInfoArguments.iterator();
HandoverInfoArgument handoverInfoArgument = handoverInfoIterator.next();
HandoverInfo handoverInfo = handoverInfoArgument.handoverInfo;
InputStream cliScriptContent = getClass().getClassLoader().getResourceAsStream("prepareDatasource.cli");
assertNotNull(cliScriptContent);
FileInputStream actualContent = new FileInputStream(handoverInfoArgument.handoverInfoTestContentFile);
assertEquals(slurp(actualContent), slurp(cliScriptContent));
assertEquals(handoverInfo.getFilename(), "prepareDatasource.cli");
assertEquals(handoverInfo.getAction(), "execute-script");
assertEquals(handoverInfo.getParams(), Collections.emptyMap());
assertEquals(handoverInfo.isRevert(), false);
handoverInfoArgument = handoverInfoIterator.next();
handoverInfo = handoverInfoArgument.handoverInfo;
final Properties[] propertiesHolder = new Properties[1];
ZipUtil.walkZipFile(handoverInfoArgument.handoverInfoTestContentFile, new ZipUtil.ZipEntryVisitor() {
@Override
public boolean visit(ZipEntry entry, ZipInputStream stream) throws Exception {
String entryName = entry.getName();
if (entryName.equals("archived-subdir/archived-file-in-subdir.properties")) {
Properties properties = new Properties();
properties.load(stream);
propertiesHolder[0] = properties;
}
return true;
}
});
Properties properties = propertiesHolder[0];
assertNotNull(properties);
assertEquals(properties.size(), 3, String.valueOf(properties));
assertEquals(properties.getProperty("templatized.variable"), "9777", String.valueOf(properties));
assertEquals(handoverInfo.getFilename(), "fileToHandover.zip");
assertEquals(handoverInfo.getAction(), "deployment");
assertEquals(handoverInfo.getParams(), new HashMap<String, String>() {
{
put("runtimeName", "site.war");
}
});
assertEquals(handoverInfo.isRevert(), false);
}