
atg.test.configuration.BasicConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of atgdust Show documentation
Show all versions of atgdust Show documentation
ATG DUST is a framework for building JUnit tests for
applications built on the ATG Dynamo platform. This framework allows
one to quickly write test code that depends up Nucleus or ATG
Repositories. By using this framework one can drastically cut down
on development time. It takes only a few seconds to start up a test
with a repository, but it may take multiple minutes to start up an
application server. To get started with DUST, take a look at
http://atgdust.sourceforge.net/first-test.html. This page will walk
you through the process of running a basic test which starts
Nucleus. After that, read the other getting started guides to
describe how to create standalone Junit tests which can startup
repositories and use the DynamoHttpServletResponse classes.
For only ATG10 and tested.
The newest version!
/**
*
*/
package atg.test.configuration;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.apache.log4j.Logger;
import atg.nucleus.Nucleus;
import atg.nucleus.logging.PrintStreamLogger;
import atg.service.lockmanager.ClientLockManager;
import atg.test.util.FileUtil;
import atg.xml.tools.apache.ApacheXMLToolsFactory;
/**
* This class is a merger of atg.test.util.DBUtils and
* atg.adapter.gsa.GSATestUtils. The result will hopefully be a class that just
* has the bare minimums needed for testing against an existing and/or in-memory
* database.
*
* This class will created all properties files needed for non repository based
* tests.
*
*
* @author robert
*
*/
public final class BasicConfiguration {
protected String isDebug = Boolean.FALSE.toString();
protected final Map settings = new HashMap();
private static Logger log = Logger.getLogger(BasicConfiguration.class);
public void setDebug(final boolean isDebug) {
this.isDebug = Boolean.toString(isDebug);
}
/**
*
* @param isDebug
*/
public BasicConfiguration() {
super();
}
/**
*
* @param root
* @throws IOException
*/
public void createPropertiesByConfigurationLocation(final File root)
throws IOException {
this.createClientLockManager(root);
this.createGlobal(root);
this.createInitialServices(root);
this.createScreenLog(root);
this.createXMLToolsFactory(root);
log.info("Created basic configuration fileset");
}
/**
*
* @param root
* @throws IOException
*/
private void createClientLockManager(final File root) throws IOException {
this.settings.clear();
settings.put("lockServerAddress", "localhost");
settings.put("lockServerPort", "9010");
settings.put("useLockServer", "false");
FileUtil.createPropertyFile("ClientLockManager", new File(root
.getAbsolutePath()
+ "/atg/dynamo/service"), ClientLockManager.class, settings);
}
/**
*
* @param root
* @throws IOException
*/
private void createGlobal(final File root) throws IOException {
this.settings.clear();
settings.put("logListeners", "/atg/dynamo/service/logging/ScreenLog");
settings.put("loggingDebug", isDebug);
FileUtil.createPropertyFile("GLOBAL",
new File(root.getAbsolutePath() + "/"), null, settings);
}
/**
*
* Creates initial services properties like Initial, AppServerConfig, Nucleus,
* etc, etc.
*
* @param root
* @throws IOException
*/
private void createInitialServices(final File root) throws IOException {
this.settings.clear();
settings.put("initialServiceName", "/Initial");
FileUtil.createPropertyFile("Nucleus", root, Nucleus.class, settings);
}
/**
*
* @param root
* @throws IOException
*/
private void createScreenLog(final File root) throws IOException {
this.settings.clear();
settings.put("cropStackTrace", "false");
settings.put("loggingEnabled", isDebug);
FileUtil.createPropertyFile("ScreenLog", new File(root.getAbsolutePath()
+ "/atg/dynamo/service/logging"), PrintStreamLogger.class, settings);
}
/**
*
* @param root
* @throws IOException
*/
private void createXMLToolsFactory(final File root) throws IOException {
FileUtil.createPropertyFile("XMLToolsFactory", new File(root
.getAbsolutePath()
+ "/atg/dynamo/service/xml"), ApacheXMLToolsFactory.class,
new HashMap());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy