use of org.apache.ignite.util.antgar.IgniteDeploymentGarAntTask in project ignite by apache.
the class GridToolsSelfTest method testAntGarTaskWithNullDescriptor.
/**
* @throws Exception If failed.
*/
@SuppressWarnings({ "TypeMayBeWeakened" })
public void testAntGarTaskWithNullDescriptor() throws Exception {
String tmpDirName = GridTestProperties.getProperty("ant.gar.tmpdir");
String srcDirName = GridTestProperties.getProperty("ant.gar.srcdir");
String baseDirName = tmpDirName + File.separator + System.currentTimeMillis() + "_4";
String metaDirName = baseDirName + File.separator + "META-INF";
String garFileName = baseDirName + ".gar";
// Make base and META-INF dir.
boolean mkdir = new File(baseDirName).mkdirs();
assert mkdir;
mkdir = new File(metaDirName).mkdirs();
assert mkdir;
// Copy files to basedir
U.copy(new File(srcDirName), new File(baseDirName), true);
IgniteDeploymentGarAntTask garTask = new IgniteDeploymentGarAntTask();
Project garProject = new Project();
garProject.setName("Gar test project");
garTask.setDestFile(new File(garFileName));
garTask.setBasedir(new File(baseDirName));
garTask.setProject(garProject);
try {
garTask.execute();
} catch (BuildException e) {
if (log().isInfoEnabled())
log().info(e.getMessage());
assert false;
}
}
use of org.apache.ignite.util.antgar.IgniteDeploymentGarAntTask in project ignite by apache.
the class GridToolsSelfTest method testAntGarTaskWithExternalP2PDescriptor.
/**
* @throws Exception If failed.
*/
public void testAntGarTaskWithExternalP2PDescriptor() throws Exception {
String tmpDirName = GridTestProperties.getProperty("ant.gar.tmpdir");
String srcDirName = GridTestProperties.getProperty("ant.gar.srcdir");
String baseDirName = tmpDirName + File.separator + System.currentTimeMillis() + "_1";
String metaDirName = baseDirName + File.separator + "META-INF";
String garFileName = baseDirName + ".gar";
String garDescrDirName = U.resolveIgnitePath(GridTestProperties.getProperty("ant.gar.descriptor.dir")).getAbsolutePath();
// Make base and META-INF dir.
boolean mkdir = new File(baseDirName).mkdirs();
assert mkdir;
mkdir = new File(metaDirName).mkdirs();
assert mkdir;
// Copy files to basedir
U.copy(new File(srcDirName), new File(baseDirName), true);
IgniteDeploymentGarAntTask garTask = new IgniteDeploymentGarAntTask();
Project garProject = new Project();
garProject.setName("Gar test project");
garTask.setDestFile(new File(garFileName));
garTask.setDescrdir(new File(garDescrDirName));
garTask.setBasedir(new File(baseDirName));
garTask.setProject(garProject);
garTask.execute();
File garFile = new File(garFileName);
assert garFile.exists();
boolean res = checkStructure(garFile, true);
assert res;
}
use of org.apache.ignite.util.antgar.IgniteDeploymentGarAntTask in project ignite by apache.
the class GridToolsSelfTest method testCorrectAntGarTask.
/**
* @throws Exception If failed.
*/
@SuppressWarnings({ "TypeMayBeWeakened" })
public void testCorrectAntGarTask() throws Exception {
String tmpDirName = GridTestProperties.getProperty("ant.gar.tmpdir");
String srcDirName = GridTestProperties.getProperty("ant.gar.srcdir");
String baseDirName = tmpDirName + File.separator + System.currentTimeMillis() + "_0";
String metaDirName = baseDirName + File.separator + "META-INF";
String garFileName = baseDirName + ".gar";
String garDescDirName = U.resolveIgnitePath(GridTestProperties.getProperty("ant.gar.descriptor.dir")).getAbsolutePath() + File.separator + "ignite.xml";
// Make base and META-INF dir.
boolean mkdir = new File(baseDirName).mkdirs();
assert mkdir;
mkdir = new File(metaDirName).mkdirs();
assert mkdir;
// Make Gar file
U.copy(new File(garDescDirName), new File(metaDirName + File.separator + "ignite.xml"), true);
// Copy files to basedir
U.copy(new File(srcDirName), new File(baseDirName), true);
IgniteDeploymentGarAntTask garTask = new IgniteDeploymentGarAntTask();
Project garProject = new Project();
garProject.setName("Gar test project");
garTask.setDestFile(new File(garFileName));
garTask.setBasedir(new File(baseDirName));
garTask.setProject(garProject);
garTask.execute();
File garFile = new File(garFileName);
assert garFile.exists();
boolean res = checkStructure(garFile, true);
assert res;
}
use of org.apache.ignite.util.antgar.IgniteDeploymentGarAntTask in project ignite by apache.
the class GridToolsSelfTest method testAntGarTaskWithDoubleP2PDescriptor.
/**
* @throws Exception If failed.
*/
public void testAntGarTaskWithDoubleP2PDescriptor() throws Exception {
String tmpDirName = GridTestProperties.getProperty("ant.gar.tmpdir");
String srcDirName = GridTestProperties.getProperty("ant.gar.srcdir");
String baseDirName = tmpDirName + File.separator + System.currentTimeMillis() + "_2";
String metaDirName = baseDirName + File.separator + "META-INF";
String garFileName = baseDirName + ".gar";
String garDescrDirName = U.resolveIgnitePath(GridTestProperties.getProperty("ant.gar.descriptor.dir")).getAbsolutePath() + File.separator + "ignite.xml";
// Make base and META-INF dir.
boolean mkdir = new File(baseDirName).mkdirs();
assert mkdir;
mkdir = new File(metaDirName).mkdirs();
assert mkdir;
// Make Gar file
U.copy(new File(garDescrDirName), new File(metaDirName + File.separator + "ignite.xml"), true);
// Copy files to basedir
U.copy(new File(srcDirName), new File(baseDirName), true);
IgniteDeploymentGarAntTask garTask = new IgniteDeploymentGarAntTask();
Project garProject = new Project();
garProject.setName("Gar test project");
garTask.setDestFile(new File(garFileName));
garTask.setDescrdir(new File(garDescrDirName));
garTask.setBasedir(new File(baseDirName));
garTask.setProject(garProject);
try {
garTask.execute();
assert false;
} catch (BuildException e) {
if (log().isInfoEnabled())
log().info(e.getMessage());
}
}
use of org.apache.ignite.util.antgar.IgniteDeploymentGarAntTask in project ignite by apache.
the class GridUriDeploymentFileProcessorSelfTest method proceedTest.
/**
* @param garFileName Name of .gar file.
* @param garDescFileName Name of Ignite descriptor file.
* @param taskId Task id.
* @param deployed If {@code true} then givent task should be deployed after test,
* if {@code false} then it should be undeployed.
* @throws Exception If failed.
*/
private void proceedTest(String garFileName, String garDescFileName, final String taskId, final boolean deployed) throws Exception {
info("This test checks broken tasks. All exceptions that might happen are the part of the test.");
String tmpDirName = GridTestProperties.getProperty("ant.gar.tmpdir");
String srcDirName = GridTestProperties.getProperty("ant.gar.srcdir");
String baseDirName = tmpDirName + File.separator + System.currentTimeMillis();
String metaDirName = baseDirName + File.separator + "META-INF";
String garDescDirName = U.resolveIgnitePath(GridTestProperties.getProperty("deploy.gar.descriptor.dir")) + File.separator + garDescFileName;
// Make base, META-INF and deployment dirs.
File destDir = new File(GridTestProperties.getProperty("deploy.uri.file2.path"));
if (!destDir.exists()) {
boolean mkdir = destDir.mkdirs();
assert mkdir;
}
boolean mkdir = new File(baseDirName).mkdirs();
assert mkdir;
mkdir = new File(metaDirName).mkdirs();
assert mkdir;
// Make Gar file
U.copy(new File(garDescDirName), new File(metaDirName + File.separator + "ignite.xml"), true);
// Copy files to basedir
U.copy(new File(srcDirName), new File(baseDirName), true);
File garFile = new File(baseDirName + File.separator + garFileName);
IgniteDeploymentGarAntTask garTask = new IgniteDeploymentGarAntTask();
Project garProject = new Project();
garProject.setName("Gar test project");
garTask.setDestFile(garFile);
garTask.setBasedir(new File(baseDirName));
garTask.setProject(garProject);
garTask.execute();
assert garFile.exists();
// Copy to deployment directory.
U.copy(garFile, destDir, true);
try {
// Wait for SPI
GridTestUtils.waitForCondition(new GridAbsPredicateX() {
@Override
public boolean applyx() throws IgniteCheckedException {
if (deployed)
return getSpi().findResource(taskId) != null;
else
return getSpi().findResource(taskId) == null;
}
}, 5000);
if (deployed)
assert getSpi().findResource(taskId) != null;
else
assert getSpi().findResource(taskId) == null;
} finally {
U.delete(destDir);
// Wait for SPI refresh
Thread.sleep(1000);
}
}
Aggregations