Methods Summary |
---|
static void | copy(java.io.File templatesDir, java.io.File dest)
File[] fa = templatesDir.listFiles();
for (int i = 0; i < fa.length; i++)
{
copyFile(fa[i], dest);
}
|
static void | copyFile(java.io.File src, java.io.File destDir)
FileInputStream inStream = new FileInputStream(src);
FileOutputStream outStream = new FileOutputStream(
new File(destDir, src.getName()));
try
{
byte[] buf = new byte[1024];
int len = 0;
while (len != -1)
{
len = inStream.read(buf, 0, buf.length);
if (len == -1) { break; }
outStream.write(buf, 0, len);
}
}
finally
{
inStream.close();
outStream.close();
}
|
static void | createClean(java.io.File f)
f.delete();
f.mkdirs();
if (!f.exists())
{
throw new IOException("Could not create " + f.getAbsolutePath());
}
|
private java.util.Map | getDomainConfig()
final Map domainConfig = new HashMap();
domainConfig.put(DomainConfig.K_INSTALL_ROOT, getInstallRoot());
domainConfig.put(DomainConfig.K_DOMAINS_ROOT, getDomainRoot());
domainConfig.put(DomainConfig.K_HOST_NAME, "surya10");
domainConfig.put(DomainConfig.K_ADMIN_PORT, Integer.valueOf(8888));
domainConfig.put(DomainConfig.K_INSTANCE_PORT, Integer.valueOf(8889));
domainConfig.put(DomainConfig.K_ORB_LISTENER_PORT, Integer.valueOf(1025));
domainConfig.put(DomainConfig.K_JAVA_HOME, getDomainRoot());
domainConfig.put(DomainConfig.K_JMS_PASSWORD, "admin1");
domainConfig.put(DomainConfig.K_JMS_USER, "admin1");
domainConfig.put(DomainConfig.K_JMS_PORT, Integer.valueOf(7677));
domainConfig.put(DomainConfig.K_HTTP_SSL_PORT, Integer.valueOf(8181));
domainConfig.put(DomainConfig.K_IIOP_SSL_PORT, Integer.valueOf(1060));
domainConfig.put(DomainConfig.K_IIOP_MUTUALAUTH_PORT,
Integer.valueOf(1061));
return domainConfig;
|
private java.lang.String | getDomainName()
return "domain5";
|
private java.lang.String | getDomainRoot()
File f = new File(getInstallRoot(), "domains");
f.mkdir();
f.deleteOnExit();
return f.getAbsolutePath();
|
private PEFileLayout | getFileLayout()
return new PEFileLayout(getInstallRoot(), getDomainRoot(),
getDomainName());
|
private static java.lang.String | getInstallRoot()
File f = new File(System.getProperty("java.io.tmpdir"),
System.getProperty("user.name", "install"));
f.mkdir();
f.deleteOnExit();
return f.getAbsolutePath();
|
private java.lang.String | getInstanceName()
return "server";
|
private boolean | isValidXml(java.io.File xml)
boolean isValid = true;
try
{
InputSource is = new InputSource(new FileInputStream(xml));
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setValidating(true);
DocumentBuilder db = dbf.newDocumentBuilder();
db.parse(is);
}
catch (Exception e) { e.printStackTrace(); isValid = false; }
return isValid;
|
public static void | main(java.lang.String[] args)
final TestRunner runner= new TestRunner();
final TestResult result = runner.doRun(PEDomainsManagerTest.suite(), false);
System.exit(result.errorCount() + result.failureCount());
|
private void | nyi()
fail("Not yet implemented");
|
protected void | setUp()
|
public static junit.framework.Test | suite()
TestSuite suite = new TestSuite(PEDomainsManagerTest.class);
return suite;
|
protected void | tearDown()
|
public void | testCreate()
assertNotNull("Couldnt create PEDomainManager",
new PEDomainsManager());
|
public void | testCreateAccXml()
final PEDomainsManager mgr = new PEDomainsManager();
mgr.createAppClientContainerXml(getDomainName(), getDomainConfig());
assertTrue("Acc Xml file not created",
getFileLayout().getAppClientContainerXml(getDomainName(),
getInstanceName()).exists());
|
public void | testCreateDefaultWebXml()
final PEDomainsManager mgr = new PEDomainsManager();
mgr.createDefaultWebXml(getDomainName(), getDomainConfig());
assertTrue("Default Web Xml file not created",
getFileLayout().getDefaultWebXml(getDomainName(),
getInstanceName()).exists());
|
public void | testCreateDomainXml()
final PEDomainsManager mgr = new PEDomainsManager();
mgr.createDomainXml(getDomainName(), getDomainConfig());
final PEFileLayout layout = getFileLayout();
final String domainName = getDomainName();
final File domainXml = layout.getDomainConfigFile(domainName,
getInstanceName());
final File domainXmlBackup =
layout.getDomainConfigBackupFile(domainName, getInstanceName());
assertTrue("Domain xml not created", domainXml.exists());
assertTrue("Domain xml backup not created", domainXmlBackup.exists());
// assertTrue("Invalid domain xml", isValidXml(domainXml));
|
public void | testCreateFileLayout()
final Map domainConfig = getDomainConfig();
final PEDomainsManager mgr = new PEDomainsManager();
mgr.createFileLayout(getDomainName(), domainConfig);
final String domainRoot =
(String)domainConfig.get(DomainConfig.K_DOMAINS_ROOT);
final String domainName = getDomainName();
assertTrue("Domain dir not created",
new File(domainRoot, domainName).exists());
final File repositoryRoot =
getFileLayout().getRepositoryRoot(domainName, getInstanceName());
assertTrue("Repository dir not created", repositoryRoot.exists());
final File repositoryBackup =
getFileLayout().getRepositoryBackupRoot(domainName,
getInstanceName());
assertTrue("Repository backup dir not created",
repositoryBackup.exists());
|
public void | testCreateScripts()
final PEDomainsManager mgr = new PEDomainsManager();
mgr.createScripts(getDomainName(), getDomainConfig());
final PEFileLayout layout = getFileLayout();
final File startServ = layout.getStartServ(getDomainName(),
getInstanceName());
final File stopServ = layout.getStopServ(getDomainName(),
getInstanceName());
assertTrue("startserv not created", startServ.exists());
assertTrue("stopserv not created", stopServ.exists());
|
public void | testCreateServerPolicyFile()
final PEDomainsManager mgr = new PEDomainsManager();
mgr.createServerPolicyFile(getDomainName(), getDomainConfig());
assertTrue("Policy file not created",
getFileLayout().getPolicyFile(getDomainName(),
getInstanceName()).exists());
|
public void | testValidate()
final Map domainConfig = getDomainConfig();
final PEDomainsManager mgr = new PEDomainsManager();
mgr.validate(getDomainName(), domainConfig);
|