You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2005/08/12 17:23:08 UTC
svn commit: r232310 [19/92] - in /beehive/trunk/controls/test: common/
infra/gtlf/ infra/gtlf/xsl/ infra/mantis/ infra/tch/ infra/tch/messages/
infra/tch/runtime/ infra/tch/schema/ perf/ perf/bin/ perf/cases/
perf/ctlsrc/org/apache/beehive/controls/per...
Modified: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/junit/HtmlReportTestCase.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/junit/HtmlReportTestCase.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/junit/HtmlReportTestCase.java (original)
+++ beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/junit/HtmlReportTestCase.java Fri Aug 12 08:12:28 2005
@@ -1,187 +1,187 @@
-package org.apache.beehive.test.tools.milton.junit;
-
-import com.meterware.httpunit.WebLink;
-import com.meterware.httpunit.WebResponse;
-import com.meterware.httpunit.WebRequest;
-import com.meterware.httpunit.WebTable;
-import com.meterware.httpunit.TableCell;
-import com.meterware.httpunit.WebConversation;
-
-import org.apache.beehive.test.tools.milton.junit.ReportTestCase;
-import org.apache.beehive.test.tools.milton.junit.AbortTestException;
-import org.apache.beehive.test.tools.milton.junit.FailTestError;
-import org.apache.beehive.test.tools.milton.common.Report;
-
-
-public abstract class HtmlReportTestCase extends ReportTestCase
-{
- public HtmlReportTestCase(String name)
- {
- super(name);
- }
-
- public void assertReport(String p_url)
- throws Exception
- {
- assertReport(new WebConversation(), p_url);
- }
-
- public void assertReport(String p_url, String p_link)
- throws Exception
- {
- assertReport(new WebConversation(), p_url, p_link);
- }
-
- public void assertReport(String p_url, String p_userName, String p_password)
- throws Exception
- {
- assertReport(p_url, null, p_userName, p_password);
- }
-
- /**
- * @param p_url Url to connect to
- * @param p_link Link on the Url to "Click"
- * @param p_userName User name for Authentication
- * @param p_password Password for Authentication
- **/
- public void assertReport(String p_url, String p_link, String p_userName, String p_password)
- throws Exception
- {
- WebConversation wc = new WebConversation();
- wc.setAuthorization(p_userName, p_password);
- assertReport(wc, p_url, p_link);
- }
-
- public void assertReport(WebConversation p_wc, String p_url)
- throws Exception
- {
- assertReport(p_wc, p_url, (String)null);
- }
-
- public void assertReport(WebConversation p_wc, String p_url, String p_link)
- throws Exception
- {
- String url = createUrl(p_url);
- WebResponse wr = null;
-
- if (null == p_wc)
- throw new IllegalArgumentException("WebConversation cannot be null");
-
- try {
- wr = p_wc.getResponse(url);
- }
- catch(java.net.MalformedURLException mue) {
- throw new AbortTestException("Error getting WebResponse", mue);
- }
- catch(java.io.IOException ioe) {
- throw new AbortTestException("Error getting WebResponse", ioe);
- }
- catch(org.xml.sax.SAXException saxe) {
- throw new AbortTestException("Error getting WebResponse", saxe);
- }
-
- if (null != p_link) {
- clickLink(wr, p_link);
- assertReport(p_wc.getCurrentPage());
- }
- else {
- assertReport(wr);
- }
- }
-
- public void assertReport(WebRequest p_wr)
- throws Exception
- {
- assertReport(new WebConversation(), p_wr);
- }
-
- public void assertReport(WebConversation wc, WebRequest wr)
- throws Exception
- {
- assertReport(wc.getResponse(wr));
- }
-
- public void assertReport(WebResponse p_wr)
- throws Exception
- {
-
- if (null == p_wr)
- throw new AbortTestException("WebResponse cannot be null");
-
- if (p_wr.getResponseCode() != 200)
- throw new AbortTestException("Bad HTTP Response Code: " +
- p_wr.getResponseCode());
-
- String status = null;
- String message = null;
- String exception = null;
-
- WebTable wt = p_wr.getTableWithID(Report.RESULT_TABLE_ID);
-
- if (null == wt)
- throw new AbortTestException("Table not found: \n" +
- p_wr.getText());
-
- TableCell statusCell = wt.getTableCellWithID(Report.STATUS_ID);
- TableCell messageCell = wt.getTableCellWithID(Report.MESSAGE_ID);
- TableCell exceptionCell = wt.getTableCellWithID(Report.EXCEPTION_ID);
-
- if (null != statusCell)
- status = statusCell.asText().trim();
-
- if (null != messageCell)
- message = messageCell.asText().trim();
-
- if (null != exceptionCell)
- exception = exceptionCell.asText().trim();
-
- // Print Messages && Exceptions
- if (null != message && ! message.equals(""))
- System.out.println("Message: " + message);
-
- if (null != exception && ! exception.equals(""))
- System.out.println("Exception: " + exception);
-
- // Check the status and report accordingly
- if (null == status || status.equals(""))
- throw new AbortTestException("No Status Found!");
-
- // If it does not PASS, check for other valid statuses or ABORT
- if (! status.equals(Report.PASS)) {
-
- if (status.equals(Report.ABORT))
- throw new AbortTestException("Abort Status Detected: \n" +
- p_wr.getText());
- else if (status.equals(Report.FAIL))
- throw new FailTestError("Failure Status Detected: \n" +
- p_wr.getText());
- else
- throw new AbortTestException("Invalid Status Was Found: \n" +
- p_wr.getText());
- }
- }
-
- private void clickLink (WebResponse p_wr, String p_link)
- {
- WebLink webLink = null;
-
- try {
- webLink = p_wr.getLinkWith(p_link);
- webLink.click();
- }
- catch (NullPointerException npe) {
- throw new AbortTestException("Link '" + p_link + "' not found in " +
- p_wr.getURL(), npe);
- }
- catch(java.io.IOException ioe) {
- throw new AbortTestException("Error clicking link: " +
- p_link, ioe);
- }
- catch(org.xml.sax.SAXException saxe) {
- throw new AbortTestException("Error clicking link: " +
- p_link, saxe);
- }
-
- }
-}
-
+package org.apache.beehive.test.tools.milton.junit;
+
+import com.meterware.httpunit.WebLink;
+import com.meterware.httpunit.WebResponse;
+import com.meterware.httpunit.WebRequest;
+import com.meterware.httpunit.WebTable;
+import com.meterware.httpunit.TableCell;
+import com.meterware.httpunit.WebConversation;
+
+import org.apache.beehive.test.tools.milton.junit.ReportTestCase;
+import org.apache.beehive.test.tools.milton.junit.AbortTestException;
+import org.apache.beehive.test.tools.milton.junit.FailTestError;
+import org.apache.beehive.test.tools.milton.common.Report;
+
+
+public abstract class HtmlReportTestCase extends ReportTestCase
+{
+ public HtmlReportTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void assertReport(String p_url)
+ throws Exception
+ {
+ assertReport(new WebConversation(), p_url);
+ }
+
+ public void assertReport(String p_url, String p_link)
+ throws Exception
+ {
+ assertReport(new WebConversation(), p_url, p_link);
+ }
+
+ public void assertReport(String p_url, String p_userName, String p_password)
+ throws Exception
+ {
+ assertReport(p_url, null, p_userName, p_password);
+ }
+
+ /**
+ * @param p_url Url to connect to
+ * @param p_link Link on the Url to "Click"
+ * @param p_userName User name for Authentication
+ * @param p_password Password for Authentication
+ **/
+ public void assertReport(String p_url, String p_link, String p_userName, String p_password)
+ throws Exception
+ {
+ WebConversation wc = new WebConversation();
+ wc.setAuthorization(p_userName, p_password);
+ assertReport(wc, p_url, p_link);
+ }
+
+ public void assertReport(WebConversation p_wc, String p_url)
+ throws Exception
+ {
+ assertReport(p_wc, p_url, (String)null);
+ }
+
+ public void assertReport(WebConversation p_wc, String p_url, String p_link)
+ throws Exception
+ {
+ String url = createUrl(p_url);
+ WebResponse wr = null;
+
+ if (null == p_wc)
+ throw new IllegalArgumentException("WebConversation cannot be null");
+
+ try {
+ wr = p_wc.getResponse(url);
+ }
+ catch(java.net.MalformedURLException mue) {
+ throw new AbortTestException("Error getting WebResponse", mue);
+ }
+ catch(java.io.IOException ioe) {
+ throw new AbortTestException("Error getting WebResponse", ioe);
+ }
+ catch(org.xml.sax.SAXException saxe) {
+ throw new AbortTestException("Error getting WebResponse", saxe);
+ }
+
+ if (null != p_link) {
+ clickLink(wr, p_link);
+ assertReport(p_wc.getCurrentPage());
+ }
+ else {
+ assertReport(wr);
+ }
+ }
+
+ public void assertReport(WebRequest p_wr)
+ throws Exception
+ {
+ assertReport(new WebConversation(), p_wr);
+ }
+
+ public void assertReport(WebConversation wc, WebRequest wr)
+ throws Exception
+ {
+ assertReport(wc.getResponse(wr));
+ }
+
+ public void assertReport(WebResponse p_wr)
+ throws Exception
+ {
+
+ if (null == p_wr)
+ throw new AbortTestException("WebResponse cannot be null");
+
+ if (p_wr.getResponseCode() != 200)
+ throw new AbortTestException("Bad HTTP Response Code: " +
+ p_wr.getResponseCode());
+
+ String status = null;
+ String message = null;
+ String exception = null;
+
+ WebTable wt = p_wr.getTableWithID(Report.RESULT_TABLE_ID);
+
+ if (null == wt)
+ throw new AbortTestException("Table not found: \n" +
+ p_wr.getText());
+
+ TableCell statusCell = wt.getTableCellWithID(Report.STATUS_ID);
+ TableCell messageCell = wt.getTableCellWithID(Report.MESSAGE_ID);
+ TableCell exceptionCell = wt.getTableCellWithID(Report.EXCEPTION_ID);
+
+ if (null != statusCell)
+ status = statusCell.asText().trim();
+
+ if (null != messageCell)
+ message = messageCell.asText().trim();
+
+ if (null != exceptionCell)
+ exception = exceptionCell.asText().trim();
+
+ // Print Messages && Exceptions
+ if (null != message && ! message.equals(""))
+ System.out.println("Message: " + message);
+
+ if (null != exception && ! exception.equals(""))
+ System.out.println("Exception: " + exception);
+
+ // Check the status and report accordingly
+ if (null == status || status.equals(""))
+ throw new AbortTestException("No Status Found!");
+
+ // If it does not PASS, check for other valid statuses or ABORT
+ if (! status.equals(Report.PASS)) {
+
+ if (status.equals(Report.ABORT))
+ throw new AbortTestException("Abort Status Detected: \n" +
+ p_wr.getText());
+ else if (status.equals(Report.FAIL))
+ throw new FailTestError("Failure Status Detected: \n" +
+ p_wr.getText());
+ else
+ throw new AbortTestException("Invalid Status Was Found: \n" +
+ p_wr.getText());
+ }
+ }
+
+ private void clickLink (WebResponse p_wr, String p_link)
+ {
+ WebLink webLink = null;
+
+ try {
+ webLink = p_wr.getLinkWith(p_link);
+ webLink.click();
+ }
+ catch (NullPointerException npe) {
+ throw new AbortTestException("Link '" + p_link + "' not found in " +
+ p_wr.getURL(), npe);
+ }
+ catch(java.io.IOException ioe) {
+ throw new AbortTestException("Error clicking link: " +
+ p_link, ioe);
+ }
+ catch(org.xml.sax.SAXException saxe) {
+ throw new AbortTestException("Error clicking link: " +
+ p_link, saxe);
+ }
+
+ }
+}
+
Propchange: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/junit/HtmlReportTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonProcessor.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonProcessor.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonProcessor.java (original)
+++ beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonProcessor.java Fri Aug 12 08:12:28 2005
@@ -1,251 +1,251 @@
-package org.apache.beehive.test.tools.milton.mantis;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.beehive.test.tools.mantis.AbstractMantisProcessor;
-import org.apache.beehive.test.tools.milton.annotations.Milton;
-import org.apache.beehive.test.tools.milton.mantis.generator.JpfClient;
-import org.apache.beehive.test.tools.milton.mantis.generator.JpfAccesser;
-import org.apache.beehive.test.tools.milton.mantis.generator.JwsAccesser;
-import org.apache.beehive.test.tools.milton.mantis.generator.JwsClient;
-import org.apache.beehive.test.tools.milton.mantis.generator.MiltonClientGenerator;
-import org.apache.beehive.test.tools.milton.mantis.generator.VelocityGenerator;
-
-import com.sun.mirror.apt.AnnotationProcessorEnvironment;
-import com.sun.mirror.declaration.AnnotationTypeDeclaration;
-import com.sun.mirror.declaration.ClassDeclaration;
-import com.sun.mirror.declaration.MethodDeclaration;
-import com.sun.mirror.declaration.PackageDeclaration;
-import com.sun.mirror.declaration.ParameterDeclaration;
-import com.sun.mirror.declaration.TypeDeclaration;
-import com.sun.mirror.type.ClassType;
-import com.sun.mirror.type.InterfaceType;
-
-/*
- * A Mantis processor for generating Control Test clients (jpf, jws, etc)
- *
- * @see Mantis
- */
-public class MiltonProcessor extends AbstractMantisProcessor
-{
- protected HashSet<PackageDeclaration> _pkgdecls;
- protected MiltonClientGenerator _generator;
-
- /*
- * Mantis initialization method. Called after Factory based construction.
- * @param p_atds AnnotationTypeDeclaration passed from Mantis Factory @param
- * p_env AnnotationProcessorEnvironment passed from Mantis Factory
- *
- * @see Mantis
- */
- public void init(Set<AnnotationTypeDeclaration> p_atds,
- AnnotationProcessorEnvironment p_env)
- {
- super.init(p_atds,p_env);
- this._pkgdecls = new HashSet<PackageDeclaration>();
-
- // init the package list
- Collection<TypeDeclaration> tdecls =
- _env.getSpecifiedTypeDeclarations();
- for(TypeDeclaration tdecl : tdecls)
- {
- _pkgdecls.add(tdecl.getPackage());
- }
-
- try {
- //TODO: decide if there is a need to have this be dynamic
- this._generator = new VelocityGenerator();
- }
- catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- /*
- * Implementation of Mantis process method.
- */
- public void process()
- {
- Collection<MiltonTestSuite> miltonSuites = new ArrayList<MiltonTestSuite>();
-
- // Loop over packages and process the classes in each
- for (PackageDeclaration pd : _pkgdecls) {
- miltonSuites.addAll(processClasses(pd.getClasses()));
- }
-
- // Loop over suites and generate clients and client accessers for each
- for (MiltonTestSuite mts : miltonSuites) {
- try {
- if (mts.isJpfClient()) {
- this._generator.generate(new JpfClient(mts, this._env));
- if (mts.isJunitClient())
- this._generator.generate(new JpfAccesser(mts, this._env));
- }
- if (mts.isJwsClient()) {
- this._generator.generate(new JwsClient(mts, this._env));
- if (mts.isJunitClient())
- this._generator.generate(new JwsAccesser(mts, this._env));
- }
- }
- catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
- }
-
- /*
- * process() generatates a Collection of ClassDeclaration and passes them to
- * processClasses which process annotations on the Class and generates a
- * Collection of MiltonTestSuite.
- */
- protected Collection<MiltonTestSuite> processClasses(Collection<ClassDeclaration> p_testClasses)
- {
- Collection<MiltonTestSuite> miltonTests = new ArrayList<MiltonTestSuite>();
- Map<String, String> options = _env.getOptions();
- String[] webappOptions;
- int i;
-
- for (ClassDeclaration cd : p_testClasses)
- {
- Milton.TestSuite a_mts = (Milton.TestSuite)cd.getAnnotation(Milton.TestSuite.class);
-
- if (null == a_mts)
- continue;
-
- webappOptions = a_mts.webapps().split("[\\s,]+");
- for (i=0; i<webappOptions.length; i++)
- {
- if (webappOptions[i].equals(MiltonUtil.getOption(options, "webapp.name")))
- break;
- }
- if (i==webappOptions.length)
- continue;
-
- MiltonTestSuite mts = new MiltonTestSuite(cd.getPackage().getQualifiedName(),
- cd.getSimpleName(), a_mts.clients(),
- a_mts.junit(),
- a_mts.webapps());
-
- Collection<MiltonTestMethod> mtm = processMethods(cd.getMethods());
- mts.addAllTests(mtm);
- miltonTests.add(mts);
- }
-
- return miltonTests;
- }
-
- /*
- * processClasses generates a Collection of MethodDeclarations and passes it
- * to processMethods which inspects the methods for meaningful annotations.
- */
- protected Collection<MiltonTestMethod> processMethods(Collection<MethodDeclaration> p_testMethods)
- {
- Collection<MiltonTestMethod> tests = new ArrayList<MiltonTestMethod>();
-
- for (MethodDeclaration md : p_testMethods)
- {
- //only look at 'test' methods
- String testName = md.getSimpleName();
- HashMap<String, String> attributes = new HashMap<String, String>();
-
- if (! testName.startsWith("test"))
- continue;
-
- Milton.Test a_miltonTest = (Milton.Test)md.getAnnotation(Milton.Test.class);
-
- attributes.put("frequency", a_miltonTest.frequency());
- attributes.put("status", a_miltonTest.status());
- attributes.put("description", a_miltonTest.description());
- attributes.put("misc", a_miltonTest.description());
-
- if (null == a_miltonTest)
- throw new IllegalStateException("All methods in a @Milton.TestSuite beginning with 'test' must have a @Milton.Test annotation");
-
- //only look at 'test' methods which return Report
- if (! md.getReturnType().toString().equals("org.apache.beehive.test.tools.milton.common.Report"))
- throw new IllegalStateException("All methods with @Milton.Test must return Report: " + md.getReturnType().toString());
-
- //get collection of parameters to this test - there must be at
- // least 1 and it must be a control bean
- Collection<ParameterDeclaration> pd = md.getParameters();
-
- // must have some parameters
- if (pd.size() <= 0)
- throw new IllegalStateException("All Milton test methods must accept at least one ControlBean parameter");
-
- Collection<MiltonTestControl> controls = new ArrayList<MiltonTestControl>();
-
- //Will store the name of the Control type
- String controlType = null;
-
- //all parameters to a milton test method must be control beans
- for (ParameterDeclaration p : pd) {
- boolean isControlBean = false;
- try {
- ClassType sct = ((ClassType)p.getType()).getSuperclass();
-
- // Make sure that the parameter is a ControlBean
- while (! sct.toString().equals("java.lang.Object")) {
-
- if (sct.toString().equals(
- "org.apache.beehive.controls.runtime.bean.ControlBean"
- )
- )
- {
- isControlBean = true;
- controlType = ((ClassType)p.getType()).toString();
- break;
- }
- sct = (ClassType)sct.getSuperclass();
- }
- }
- catch (ClassCastException cce) {
- InterfaceType sct = (InterfaceType)p.getType();
- //if we have an interface instead of a ControlBean subclass
- //we assume that its a control interface
- isControlBean = true;
- controlType = ((InterfaceType)p.getType()).toString();
- }
-
- if (! isControlBean)
- throw new IllegalStateException("All parameters to a Milton test must be instances of ControlBean");
-
- //get @Milton.TestControl annotations off parameters
- Milton.TestControl a_mtc = (Milton.TestControl)p.getAnnotation(Milton.TestControl.class);
-
- String controlName = md.getSimpleName() + "_" + p.getSimpleName();
- String[] controlAnnotations = Milton.DEFAULT_CONTROL_ANNOTATIONS;
- String controlModifier = Milton.DEFAULT_CONTROL_MODIFIER;
- Milton.Instantiate controlInstantiate = Milton.DEFAULT_CONTROL_INSTANTIATE;
- String controlGenericType = Milton.DEFAULT_CONTROL_GENERIC_TYPE;
-
- // if there is a @Milton.TestControl get values from it
- if (a_mtc != null) {
- if (! a_mtc.name().equals(Milton.DEFAULT_CONTROL_NAME))
- controlName = a_mtc.name();
-
- controlAnnotations = a_mtc.annotations();
- controlModifier = a_mtc.modifier();
- controlInstantiate = a_mtc.instantiate();
- controlGenericType = a_mtc.genericType();
- }
-
- controls.add(new MiltonTestControl(controlName,
- controlType,controlAnnotations,
- controlInstantiate,
- controlModifier, controlGenericType));
- }
-
- MiltonTestMethod mtm = new MiltonTestMethod(testName, controls, attributes);
-
- tests.add(mtm);
- }
-
- return tests;
- }
-}
+package org.apache.beehive.test.tools.milton.mantis;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.beehive.test.tools.mantis.AbstractMantisProcessor;
+import org.apache.beehive.test.tools.milton.annotations.Milton;
+import org.apache.beehive.test.tools.milton.mantis.generator.JpfClient;
+import org.apache.beehive.test.tools.milton.mantis.generator.JpfAccesser;
+import org.apache.beehive.test.tools.milton.mantis.generator.JwsAccesser;
+import org.apache.beehive.test.tools.milton.mantis.generator.JwsClient;
+import org.apache.beehive.test.tools.milton.mantis.generator.MiltonClientGenerator;
+import org.apache.beehive.test.tools.milton.mantis.generator.VelocityGenerator;
+
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.declaration.AnnotationTypeDeclaration;
+import com.sun.mirror.declaration.ClassDeclaration;
+import com.sun.mirror.declaration.MethodDeclaration;
+import com.sun.mirror.declaration.PackageDeclaration;
+import com.sun.mirror.declaration.ParameterDeclaration;
+import com.sun.mirror.declaration.TypeDeclaration;
+import com.sun.mirror.type.ClassType;
+import com.sun.mirror.type.InterfaceType;
+
+/*
+ * A Mantis processor for generating Control Test clients (jpf, jws, etc)
+ *
+ * @see Mantis
+ */
+public class MiltonProcessor extends AbstractMantisProcessor
+{
+ protected HashSet<PackageDeclaration> _pkgdecls;
+ protected MiltonClientGenerator _generator;
+
+ /*
+ * Mantis initialization method. Called after Factory based construction.
+ * @param p_atds AnnotationTypeDeclaration passed from Mantis Factory @param
+ * p_env AnnotationProcessorEnvironment passed from Mantis Factory
+ *
+ * @see Mantis
+ */
+ public void init(Set<AnnotationTypeDeclaration> p_atds,
+ AnnotationProcessorEnvironment p_env)
+ {
+ super.init(p_atds,p_env);
+ this._pkgdecls = new HashSet<PackageDeclaration>();
+
+ // init the package list
+ Collection<TypeDeclaration> tdecls =
+ _env.getSpecifiedTypeDeclarations();
+ for(TypeDeclaration tdecl : tdecls)
+ {
+ _pkgdecls.add(tdecl.getPackage());
+ }
+
+ try {
+ //TODO: decide if there is a need to have this be dynamic
+ this._generator = new VelocityGenerator();
+ }
+ catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /*
+ * Implementation of Mantis process method.
+ */
+ public void process()
+ {
+ Collection<MiltonTestSuite> miltonSuites = new ArrayList<MiltonTestSuite>();
+
+ // Loop over packages and process the classes in each
+ for (PackageDeclaration pd : _pkgdecls) {
+ miltonSuites.addAll(processClasses(pd.getClasses()));
+ }
+
+ // Loop over suites and generate clients and client accessers for each
+ for (MiltonTestSuite mts : miltonSuites) {
+ try {
+ if (mts.isJpfClient()) {
+ this._generator.generate(new JpfClient(mts, this._env));
+ if (mts.isJunitClient())
+ this._generator.generate(new JpfAccesser(mts, this._env));
+ }
+ if (mts.isJwsClient()) {
+ this._generator.generate(new JwsClient(mts, this._env));
+ if (mts.isJunitClient())
+ this._generator.generate(new JwsAccesser(mts, this._env));
+ }
+ }
+ catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ /*
+ * process() generatates a Collection of ClassDeclaration and passes them to
+ * processClasses which process annotations on the Class and generates a
+ * Collection of MiltonTestSuite.
+ */
+ protected Collection<MiltonTestSuite> processClasses(Collection<ClassDeclaration> p_testClasses)
+ {
+ Collection<MiltonTestSuite> miltonTests = new ArrayList<MiltonTestSuite>();
+ Map<String, String> options = _env.getOptions();
+ String[] webappOptions;
+ int i;
+
+ for (ClassDeclaration cd : p_testClasses)
+ {
+ Milton.TestSuite a_mts = (Milton.TestSuite)cd.getAnnotation(Milton.TestSuite.class);
+
+ if (null == a_mts)
+ continue;
+
+ webappOptions = a_mts.webapps().split("[\\s,]+");
+ for (i=0; i<webappOptions.length; i++)
+ {
+ if (webappOptions[i].equals(MiltonUtil.getOption(options, "webapp.name")))
+ break;
+ }
+ if (i==webappOptions.length)
+ continue;
+
+ MiltonTestSuite mts = new MiltonTestSuite(cd.getPackage().getQualifiedName(),
+ cd.getSimpleName(), a_mts.clients(),
+ a_mts.junit(),
+ a_mts.webapps());
+
+ Collection<MiltonTestMethod> mtm = processMethods(cd.getMethods());
+ mts.addAllTests(mtm);
+ miltonTests.add(mts);
+ }
+
+ return miltonTests;
+ }
+
+ /*
+ * processClasses generates a Collection of MethodDeclarations and passes it
+ * to processMethods which inspects the methods for meaningful annotations.
+ */
+ protected Collection<MiltonTestMethod> processMethods(Collection<MethodDeclaration> p_testMethods)
+ {
+ Collection<MiltonTestMethod> tests = new ArrayList<MiltonTestMethod>();
+
+ for (MethodDeclaration md : p_testMethods)
+ {
+ //only look at 'test' methods
+ String testName = md.getSimpleName();
+ HashMap<String, String> attributes = new HashMap<String, String>();
+
+ if (! testName.startsWith("test"))
+ continue;
+
+ Milton.Test a_miltonTest = (Milton.Test)md.getAnnotation(Milton.Test.class);
+
+ attributes.put("frequency", a_miltonTest.frequency());
+ attributes.put("status", a_miltonTest.status());
+ attributes.put("description", a_miltonTest.description());
+ attributes.put("misc", a_miltonTest.description());
+
+ if (null == a_miltonTest)
+ throw new IllegalStateException("All methods in a @Milton.TestSuite beginning with 'test' must have a @Milton.Test annotation");
+
+ //only look at 'test' methods which return Report
+ if (! md.getReturnType().toString().equals("org.apache.beehive.test.tools.milton.common.Report"))
+ throw new IllegalStateException("All methods with @Milton.Test must return Report: " + md.getReturnType().toString());
+
+ //get collection of parameters to this test - there must be at
+ // least 1 and it must be a control bean
+ Collection<ParameterDeclaration> pd = md.getParameters();
+
+ // must have some parameters
+ if (pd.size() <= 0)
+ throw new IllegalStateException("All Milton test methods must accept at least one ControlBean parameter");
+
+ Collection<MiltonTestControl> controls = new ArrayList<MiltonTestControl>();
+
+ //Will store the name of the Control type
+ String controlType = null;
+
+ //all parameters to a milton test method must be control beans
+ for (ParameterDeclaration p : pd) {
+ boolean isControlBean = false;
+ try {
+ ClassType sct = ((ClassType)p.getType()).getSuperclass();
+
+ // Make sure that the parameter is a ControlBean
+ while (! sct.toString().equals("java.lang.Object")) {
+
+ if (sct.toString().equals(
+ "org.apache.beehive.controls.runtime.bean.ControlBean"
+ )
+ )
+ {
+ isControlBean = true;
+ controlType = ((ClassType)p.getType()).toString();
+ break;
+ }
+ sct = (ClassType)sct.getSuperclass();
+ }
+ }
+ catch (ClassCastException cce) {
+ InterfaceType sct = (InterfaceType)p.getType();
+ //if we have an interface instead of a ControlBean subclass
+ //we assume that its a control interface
+ isControlBean = true;
+ controlType = ((InterfaceType)p.getType()).toString();
+ }
+
+ if (! isControlBean)
+ throw new IllegalStateException("All parameters to a Milton test must be instances of ControlBean");
+
+ //get @Milton.TestControl annotations off parameters
+ Milton.TestControl a_mtc = (Milton.TestControl)p.getAnnotation(Milton.TestControl.class);
+
+ String controlName = md.getSimpleName() + "_" + p.getSimpleName();
+ String[] controlAnnotations = Milton.DEFAULT_CONTROL_ANNOTATIONS;
+ String controlModifier = Milton.DEFAULT_CONTROL_MODIFIER;
+ Milton.Instantiate controlInstantiate = Milton.DEFAULT_CONTROL_INSTANTIATE;
+ String controlGenericType = Milton.DEFAULT_CONTROL_GENERIC_TYPE;
+
+ // if there is a @Milton.TestControl get values from it
+ if (a_mtc != null) {
+ if (! a_mtc.name().equals(Milton.DEFAULT_CONTROL_NAME))
+ controlName = a_mtc.name();
+
+ controlAnnotations = a_mtc.annotations();
+ controlModifier = a_mtc.modifier();
+ controlInstantiate = a_mtc.instantiate();
+ controlGenericType = a_mtc.genericType();
+ }
+
+ controls.add(new MiltonTestControl(controlName,
+ controlType,controlAnnotations,
+ controlInstantiate,
+ controlModifier, controlGenericType));
+ }
+
+ MiltonTestMethod mtm = new MiltonTestMethod(testName, controls, attributes);
+
+ tests.add(mtm);
+ }
+
+ return tests;
+ }
+}
Propchange: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonProcessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonTestControl.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonTestControl.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonTestControl.java (original)
+++ beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonTestControl.java Fri Aug 12 08:12:28 2005
@@ -1,111 +1,111 @@
-package org.apache.beehive.test.tools.milton.mantis;
-
-import org.apache.beehive.test.tools.milton.annotations.Milton;
-
-/*
- * A MiltonTestControl represents a Control passed to a test method where
- * the information about the control is derived from APT metadata.
- */
-public class MiltonTestControl
-{
- String _name;
- String _type;
- String[] _annotations = Milton.DEFAULT_CONTROL_ANNOTATIONS;
- Milton.Instantiate _instantiate = Milton.DEFAULT_CONTROL_INSTANTIATE;
- String _modifier = Milton.DEFAULT_CONTROL_MODIFIER;
- String _genericType = Milton.DEFAULT_CONTROL_GENERIC_TYPE;
-
- /*
- * Constructs a new MiltonTestControl
- *
- * @param p_name The name of the control as it would be declared in src
- * @param p_type The name of the type of the control represented
- * @param p_annotations Array containing additional annotations for declaration time for this control
- * @param p_instantiate Milton.Instantiate representing how this control should be instantiated
- * @param p_modifier Access modifier for this control
- */
- public MiltonTestControl(String p_name, String p_type,
- String[] p_annotations,
- Milton.Instantiate p_instantiate,
- String p_modifier, String p_genericType)
- {
- if (p_name == null) {
- throw new IllegalArgumentException("Control Name cannot be null");
- }
-
- if (p_type == null) {
- throw new IllegalArgumentException("Control Type cannot be null");
- }
-
- if (p_annotations != null)
- this._annotations = p_annotations;
-
- if (p_instantiate != null)
- this._instantiate = p_instantiate;
-
- if (p_modifier != null)
- this._modifier = p_modifier;
-
- if (p_genericType != null && !p_genericType.equals("")) {
- String gt = p_genericType;
-
- if (!p_genericType.startsWith("<") && !p_genericType.endsWith(">"))
- gt = "<" + p_genericType + ">";
- this._genericType = gt;
- }
-
- this._name = p_name;
- this._type = p_type;
- }
-
- /*
- * Returns the name of this Control
- */
- public String getName()
- {
- return this._name;
- }
-
- /*
- * Returns array of annatations for this Control
- */
- public String[] getAnnotations()
- {
- return this._annotations;
- }
-
- /*
- * Returns modifier for this Control
- */
- public String getModifier()
- {
- return this._modifier;
- }
-
- /*
- * Return generic type for this Control
- */
- public String getGenericType()
- {
- return this._genericType;
- }
-
- /*
- * Returns the fully qualified name of the type of this Control
- */
- public String getType()
- {
- return this._type;
- }
-
- /*
- * Returns boolean representing wether or not this control will be
- * declared Declaratively.
- */
- public boolean isDeclaritive()
- {
- if (this._instantiate == Milton.Instantiate.DECLARATIVE)
- return true;
- return false;
- }
-}
+package org.apache.beehive.test.tools.milton.mantis;
+
+import org.apache.beehive.test.tools.milton.annotations.Milton;
+
+/*
+ * A MiltonTestControl represents a Control passed to a test method where
+ * the information about the control is derived from APT metadata.
+ */
+public class MiltonTestControl
+{
+ String _name;
+ String _type;
+ String[] _annotations = Milton.DEFAULT_CONTROL_ANNOTATIONS;
+ Milton.Instantiate _instantiate = Milton.DEFAULT_CONTROL_INSTANTIATE;
+ String _modifier = Milton.DEFAULT_CONTROL_MODIFIER;
+ String _genericType = Milton.DEFAULT_CONTROL_GENERIC_TYPE;
+
+ /*
+ * Constructs a new MiltonTestControl
+ *
+ * @param p_name The name of the control as it would be declared in src
+ * @param p_type The name of the type of the control represented
+ * @param p_annotations Array containing additional annotations for declaration time for this control
+ * @param p_instantiate Milton.Instantiate representing how this control should be instantiated
+ * @param p_modifier Access modifier for this control
+ */
+ public MiltonTestControl(String p_name, String p_type,
+ String[] p_annotations,
+ Milton.Instantiate p_instantiate,
+ String p_modifier, String p_genericType)
+ {
+ if (p_name == null) {
+ throw new IllegalArgumentException("Control Name cannot be null");
+ }
+
+ if (p_type == null) {
+ throw new IllegalArgumentException("Control Type cannot be null");
+ }
+
+ if (p_annotations != null)
+ this._annotations = p_annotations;
+
+ if (p_instantiate != null)
+ this._instantiate = p_instantiate;
+
+ if (p_modifier != null)
+ this._modifier = p_modifier;
+
+ if (p_genericType != null && !p_genericType.equals("")) {
+ String gt = p_genericType;
+
+ if (!p_genericType.startsWith("<") && !p_genericType.endsWith(">"))
+ gt = "<" + p_genericType + ">";
+ this._genericType = gt;
+ }
+
+ this._name = p_name;
+ this._type = p_type;
+ }
+
+ /*
+ * Returns the name of this Control
+ */
+ public String getName()
+ {
+ return this._name;
+ }
+
+ /*
+ * Returns array of annatations for this Control
+ */
+ public String[] getAnnotations()
+ {
+ return this._annotations;
+ }
+
+ /*
+ * Returns modifier for this Control
+ */
+ public String getModifier()
+ {
+ return this._modifier;
+ }
+
+ /*
+ * Return generic type for this Control
+ */
+ public String getGenericType()
+ {
+ return this._genericType;
+ }
+
+ /*
+ * Returns the fully qualified name of the type of this Control
+ */
+ public String getType()
+ {
+ return this._type;
+ }
+
+ /*
+ * Returns boolean representing wether or not this control will be
+ * declared Declaratively.
+ */
+ public boolean isDeclaritive()
+ {
+ if (this._instantiate == Milton.Instantiate.DECLARATIVE)
+ return true;
+ return false;
+ }
+}
Propchange: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonTestControl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonTestMethod.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonTestMethod.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonTestMethod.java (original)
+++ beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonTestMethod.java Fri Aug 12 08:12:28 2005
@@ -1,127 +1,127 @@
-package org.apache.beehive.test.tools.milton.mantis;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-
-/*
- * A MiltonTestMethod represents a test method where the information about the
- * test method is represented in APT metadata and Java reflection.
- */
-public class MiltonTestMethod
-{
- private String _name;
- private String _frequency;
- private String _misc;
- private String _status;
- private String _description;
- private Collection<MiltonTestControl> _controls =
- new ArrayList<MiltonTestControl>();
- private HashMap<String, String> _attributes;
-
- /*
- * Construct MiltonTestMethod
- *
- * @param p_testName Name of the test method
- * @param p_mtc A Collection of MiltonTestControl for controls associated with this method
- */
- public MiltonTestMethod(String p_testName, Collection<MiltonTestControl> p_mtc)
- {
- this(p_testName, p_mtc, new HashMap<String, String>());
- }
-
- /*
- * Construct MiltonTestMethod
- *
- * @param p_testName Name of the test method
- * @param p_mtc Collection of MiltonTestControl for controls associated with this method
- * @param p_attributes HashMap<String, String> containing additional metadata from Milton.TestControl annotation
- */
- public MiltonTestMethod(String p_testName,
- Collection<MiltonTestControl> p_mtc,
- HashMap<String, String> p_attributes)
- {
- if (p_testName == null)
- throw new IllegalArgumentException("Test Name cannot be null");
-
- if (p_mtc == null || p_mtc.size() <= 0)
- throw new IllegalArgumentException("Milton Tests require at least one MiltonTestControl");
-
- this._name = p_testName;
- this._controls = p_mtc;
- this._attributes = p_attributes;
- }
-
- /*
- * Returns Collection of MiltonTestControl associated with the method.
- */
- public Collection<MiltonTestControl> getControls()
- {
- return this._controls;
- }
-
- /*
- * Returns the name of the method
- */
- public String getName()
- {
- return this._name;
- }
-
- /*
- * Returns a list comma separated String of parameters to be passed to the method.
- */
- public String getParameters()
- {
- String parameters = "";
-
- Object[] mtc = this._controls.toArray();
-
- for (int i = 0; i < mtc.length; ++i) {
- parameters += ((MiltonTestControl)mtc[i]).getName();
- if (i < mtc.length -1) {
- parameters += ",";
- }
- }
-
- return parameters;
- }
-
- /*
- * Returns a HashMap of name=value attributes. This is useful to call from a Velocity template
- */
- public HashMap<String, String> getAttributes()
- {
- return this._attributes;
- }
-
- /*
- * Returns Collection on MiltonTestControl which are to be instantiated Declaratively
- */
- public Collection<MiltonTestControl> getDeclarativeControls()
- {
- Collection<MiltonTestControl> decControls =
- new ArrayList<MiltonTestControl>();
- for (MiltonTestControl mtc : _controls) {
- if (mtc.isDeclaritive())
- decControls.add(mtc);
- }
-
- return decControls;
- }
-
- /*
- * Returns Collection of MiltonTestControl which are to be instantiated Programatically
- */
- public Collection<MiltonTestControl> getProgramaticControls()
- {
- Collection<MiltonTestControl> progControls =
- new ArrayList<MiltonTestControl>();
- for (MiltonTestControl mtc : _controls) {
- if (! mtc.isDeclaritive())
- progControls.add(mtc);
- }
-
- return progControls;
- }
-}
+package org.apache.beehive.test.tools.milton.mantis;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+
+/*
+ * A MiltonTestMethod represents a test method where the information about the
+ * test method is represented in APT metadata and Java reflection.
+ */
+public class MiltonTestMethod
+{
+ private String _name;
+ private String _frequency;
+ private String _misc;
+ private String _status;
+ private String _description;
+ private Collection<MiltonTestControl> _controls =
+ new ArrayList<MiltonTestControl>();
+ private HashMap<String, String> _attributes;
+
+ /*
+ * Construct MiltonTestMethod
+ *
+ * @param p_testName Name of the test method
+ * @param p_mtc A Collection of MiltonTestControl for controls associated with this method
+ */
+ public MiltonTestMethod(String p_testName, Collection<MiltonTestControl> p_mtc)
+ {
+ this(p_testName, p_mtc, new HashMap<String, String>());
+ }
+
+ /*
+ * Construct MiltonTestMethod
+ *
+ * @param p_testName Name of the test method
+ * @param p_mtc Collection of MiltonTestControl for controls associated with this method
+ * @param p_attributes HashMap<String, String> containing additional metadata from Milton.TestControl annotation
+ */
+ public MiltonTestMethod(String p_testName,
+ Collection<MiltonTestControl> p_mtc,
+ HashMap<String, String> p_attributes)
+ {
+ if (p_testName == null)
+ throw new IllegalArgumentException("Test Name cannot be null");
+
+ if (p_mtc == null || p_mtc.size() <= 0)
+ throw new IllegalArgumentException("Milton Tests require at least one MiltonTestControl");
+
+ this._name = p_testName;
+ this._controls = p_mtc;
+ this._attributes = p_attributes;
+ }
+
+ /*
+ * Returns Collection of MiltonTestControl associated with the method.
+ */
+ public Collection<MiltonTestControl> getControls()
+ {
+ return this._controls;
+ }
+
+ /*
+ * Returns the name of the method
+ */
+ public String getName()
+ {
+ return this._name;
+ }
+
+ /*
+ * Returns a list comma separated String of parameters to be passed to the method.
+ */
+ public String getParameters()
+ {
+ String parameters = "";
+
+ Object[] mtc = this._controls.toArray();
+
+ for (int i = 0; i < mtc.length; ++i) {
+ parameters += ((MiltonTestControl)mtc[i]).getName();
+ if (i < mtc.length -1) {
+ parameters += ",";
+ }
+ }
+
+ return parameters;
+ }
+
+ /*
+ * Returns a HashMap of name=value attributes. This is useful to call from a Velocity template
+ */
+ public HashMap<String, String> getAttributes()
+ {
+ return this._attributes;
+ }
+
+ /*
+ * Returns Collection on MiltonTestControl which are to be instantiated Declaratively
+ */
+ public Collection<MiltonTestControl> getDeclarativeControls()
+ {
+ Collection<MiltonTestControl> decControls =
+ new ArrayList<MiltonTestControl>();
+ for (MiltonTestControl mtc : _controls) {
+ if (mtc.isDeclaritive())
+ decControls.add(mtc);
+ }
+
+ return decControls;
+ }
+
+ /*
+ * Returns Collection of MiltonTestControl which are to be instantiated Programatically
+ */
+ public Collection<MiltonTestControl> getProgramaticControls()
+ {
+ Collection<MiltonTestControl> progControls =
+ new ArrayList<MiltonTestControl>();
+ for (MiltonTestControl mtc : _controls) {
+ if (! mtc.isDeclaritive())
+ progControls.add(mtc);
+ }
+
+ return progControls;
+ }
+}
Propchange: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonTestMethod.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonTestSuite.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonTestSuite.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonTestSuite.java (original)
+++ beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonTestSuite.java Fri Aug 12 08:12:28 2005
@@ -1,104 +1,104 @@
-package org.apache.beehive.test.tools.milton.mantis;
-
-import java.util.Collection;
-import java.util.ArrayList;
-
-import org.apache.beehive.test.tools.milton.annotations.Milton;
-import org.apache.beehive.test.tools.milton.mantis.generator.MiltonTestClient;
-
-/*
- * A MiltonTestSuite represents a Test Driver
- */
-public class MiltonTestSuite
-{
- private String _name;
- private String _packageName;
- private Collection<MiltonTestMethod> _tests =
- new ArrayList<MiltonTestMethod>();
- private String _webapps;
-
- private boolean _jpfClient = false;
- private boolean _jwsClient = false;
- private boolean _junitClient = false;
-
- /*
- * Construct a MiltonTestSuite
- *
- * @param p_pn Package Name (org.foo.bar) @param p_sn Suite Name
- * (TestSomething) @param p_clients Comma separated String of clients this
- * suite needs generated ("jws,jpf") @param p_junit set to true if clients
- * should have junit accessers generated for them @param p_webapps Space
- * separated list of webapps this suite is applicable to
- */
- public MiltonTestSuite(String p_pn, String p_sn, Milton.ClientType[] p_clients, boolean p_junit, String p_webapps)
- {
- System.out.println("Adding webapps: " + p_webapps);
- if (null == p_pn || null == p_sn || null == p_clients || null == p_webapps)
- throw new IllegalArgumentException("Package Name, Suite Name, Clients and Webapps must not be null");
- this._name = p_sn;
- this._packageName = p_pn;
- this._junitClient = p_junit;
- this._webapps = p_webapps;
-
- for (int i = 0; i < p_clients.length; ++i) {
- if (p_clients[i] == Milton.ClientType.JWS)
- this._jwsClient = true;
- else if (p_clients[i] == Milton.ClientType.JPF)
- this._jpfClient = true;
- else
- System.out.println("Found " + p_clients[i] + " which appears to be supported " +
- "in the ClientType enumeration but there is no handling code");
- }
- }
-
- /*
- * Returns true if MiltonTestSuite will have JPF clients generated
- */
- public boolean isJpfClient()
- {
- return _jpfClient;
- }
-
- /*
- * Returns true if MiltonTestSuite will have JUnit clients generated
- */
- public boolean isJunitClient()
- {
- return _junitClient;
- }
-
- /*
- * Returns true if MiltonTestSuite will have JWS clients generated
- */
- public boolean isJwsClient()
- {
- return _jwsClient;
- }
-
- public void addTest(MiltonTestMethod p_mtm)
- {
- this._tests.add(p_mtm);
- }
-
- public void addAllTests(Collection<MiltonTestMethod> p_mtm)
- {
- this._tests.addAll(p_mtm);
- }
-
- public String getName() {
- return _name;
- }
-
- public Collection<MiltonTestMethod> getTests()
- {
- return this._tests;
- }
-
- public String getPackageName() {
- return _packageName;
- }
-
- public String getWebapps() {
- return _webapps;
- }
-}
+package org.apache.beehive.test.tools.milton.mantis;
+
+import java.util.Collection;
+import java.util.ArrayList;
+
+import org.apache.beehive.test.tools.milton.annotations.Milton;
+import org.apache.beehive.test.tools.milton.mantis.generator.MiltonTestClient;
+
+/*
+ * A MiltonTestSuite represents a Test Driver
+ */
+public class MiltonTestSuite
+{
+ private String _name;
+ private String _packageName;
+ private Collection<MiltonTestMethod> _tests =
+ new ArrayList<MiltonTestMethod>();
+ private String _webapps;
+
+ private boolean _jpfClient = false;
+ private boolean _jwsClient = false;
+ private boolean _junitClient = false;
+
+ /*
+ * Construct a MiltonTestSuite
+ *
+ * @param p_pn Package Name (org.foo.bar) @param p_sn Suite Name
+ * (TestSomething) @param p_clients Comma separated String of clients this
+ * suite needs generated ("jws,jpf") @param p_junit set to true if clients
+ * should have junit accessers generated for them @param p_webapps Space
+ * separated list of webapps this suite is applicable to
+ */
+ public MiltonTestSuite(String p_pn, String p_sn, Milton.ClientType[] p_clients, boolean p_junit, String p_webapps)
+ {
+ System.out.println("Adding webapps: " + p_webapps);
+ if (null == p_pn || null == p_sn || null == p_clients || null == p_webapps)
+ throw new IllegalArgumentException("Package Name, Suite Name, Clients and Webapps must not be null");
+ this._name = p_sn;
+ this._packageName = p_pn;
+ this._junitClient = p_junit;
+ this._webapps = p_webapps;
+
+ for (int i = 0; i < p_clients.length; ++i) {
+ if (p_clients[i] == Milton.ClientType.JWS)
+ this._jwsClient = true;
+ else if (p_clients[i] == Milton.ClientType.JPF)
+ this._jpfClient = true;
+ else
+ System.out.println("Found " + p_clients[i] + " which appears to be supported " +
+ "in the ClientType enumeration but there is no handling code");
+ }
+ }
+
+ /*
+ * Returns true if MiltonTestSuite will have JPF clients generated
+ */
+ public boolean isJpfClient()
+ {
+ return _jpfClient;
+ }
+
+ /*
+ * Returns true if MiltonTestSuite will have JUnit clients generated
+ */
+ public boolean isJunitClient()
+ {
+ return _junitClient;
+ }
+
+ /*
+ * Returns true if MiltonTestSuite will have JWS clients generated
+ */
+ public boolean isJwsClient()
+ {
+ return _jwsClient;
+ }
+
+ public void addTest(MiltonTestMethod p_mtm)
+ {
+ this._tests.add(p_mtm);
+ }
+
+ public void addAllTests(Collection<MiltonTestMethod> p_mtm)
+ {
+ this._tests.addAll(p_mtm);
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public Collection<MiltonTestMethod> getTests()
+ {
+ return this._tests;
+ }
+
+ public String getPackageName() {
+ return _packageName;
+ }
+
+ public String getWebapps() {
+ return _webapps;
+ }
+}
Propchange: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonTestSuite.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonUtil.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonUtil.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonUtil.java (original)
+++ beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonUtil.java Fri Aug 12 08:12:28 2005
@@ -1,29 +1,29 @@
-package org.apache.beehive.test.tools.milton.mantis;
-
-import java.util.Set;
-import java.util.Map;
-
-public class MiltonUtil
-{
- /*
- * there is a bug in apt AnnotationProcesserEnvironment.getOptions()
- * in that the Map that is returned has the key and the value stored in the key.
- * for example -Afoo=bar will actually have a key of: -Afoo=bar and no value.
- */
- public static String getOption(Map<String, String> p_options, String p_key)
- {
- if (null == p_key)
- throw new IllegalArgumentException("Key cannot be null");
-
- Set<String> keys = p_options.keySet();
- for (String key : keys) {
- String[] option = key.split("=");
- if (option.length != 2)
- continue;
- if (option[0].equalsIgnoreCase("-A" + p_key))
- return option[1];
- }
-
- return null; // return null if no matches are found
- }
+package org.apache.beehive.test.tools.milton.mantis;
+
+import java.util.Set;
+import java.util.Map;
+
+public class MiltonUtil
+{
+ /*
+ * there is a bug in apt AnnotationProcesserEnvironment.getOptions()
+ * in that the Map that is returned has the key and the value stored in the key.
+ * for example -Afoo=bar will actually have a key of: -Afoo=bar and no value.
+ */
+ public static String getOption(Map<String, String> p_options, String p_key)
+ {
+ if (null == p_key)
+ throw new IllegalArgumentException("Key cannot be null");
+
+ Set<String> keys = p_options.keySet();
+ for (String key : keys) {
+ String[] option = key.split("=");
+ if (option.length != 2)
+ continue;
+ if (option[0].equalsIgnoreCase("-A" + p_key))
+ return option[1];
+ }
+
+ return null; // return null if no matches are found
+ }
}
Propchange: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonUtil.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/JpfAccesser.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/JpfAccesser.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/JpfAccesser.java (original)
+++ beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/JpfAccesser.java Fri Aug 12 08:12:28 2005
@@ -1,72 +1,72 @@
-package org.apache.beehive.test.tools.milton.mantis.generator;
-
-import org.apache.beehive.controls.runtime.generator.IndentingWriter;
-import org.apache.beehive.test.tools.milton.mantis.MiltonTestSuite;
-
-import com.sun.mirror.apt.AnnotationProcessorEnvironment;
-import com.sun.mirror.apt.Filer;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.Writer;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/*
- * A JpfAccesser is will generate a Junit test suite to access the methods in the generated JPF
- */
-public class JpfAccesser extends JpfClient
-{
- protected final String JPF_ACCESSER_TEMPLATE_NAME = "org/apache/beehive/test/tools/milton/mantis/generator/MiltonJpfAccesser.vm";
- protected String _jpfAccesserPackage = "tests.jpf.";
- protected String _jpfAccesserLocation = null;
- protected String _jpfAccesserName = "";
-
- /*
- * Construct a JpfAccesser
- *
- * @param p_mts the MiltonTestSuite to represent a JPF client for
- * @param p_env APT environment. Needed for accessing the Filer.
- */
- public JpfAccesser(MiltonTestSuite p_mts, AnnotationProcessorEnvironment p_env)
- {
- super(p_mts, p_env);
- this._templateName = JPF_ACCESSER_TEMPLATE_NAME;
- this._jpfAccesserLocation = super._accesserDir;
-
- // Create a client accessor package
- String packageReWriter = "(.*)\\.(.+)$";
- Pattern packagePattern = Pattern.compile(packageReWriter);
-
- Matcher m = packagePattern.matcher(p_mts.getPackageName());
-
- //TODO: consider rethinking how i handle package mangling here
- if (m.matches())
- this._jpfAccesserPackage = "test.milton.jpf." + m.group(2);
- else
- this._jpfAccesserPackage = "test.milton.jpf." + p_mts.getPackageName();
-
- this._jpfAccesserName = p_mts.getName().startsWith("Test") ?
- p_mts.getName() : "Test" + p_mts.getName();
-
- this._jpfAccesserLocation += this._jpfAccesserPackage.replace(".", "/") +
- "/" + _jpfAccesserName + ".java";
-
- this._context.put("jpf_webapp_name", super._webappName);
- this._context.put("jpf_accesser_package", this._jpfAccesserPackage);
- this._context.put("jpf_accesser_name", _jpfAccesserName);
- this._context.put("jpf_action_call_prefix", super._jpfActionPath);
- }
-
- /*
- * Overriding the getWriter() in the parent class to return a Writer with
- * for the correct JPF Accesser file.
- */
- public Writer getWriter()
- throws IOException
- {
- this._writer = new IndentingWriter(this._filer.createTextFile(Filer.Location.SOURCE_TREE,
- "", new File(this._jpfAccesserLocation), null));
- return this._writer;
- }
-}
+package org.apache.beehive.test.tools.milton.mantis.generator;
+
+import org.apache.beehive.controls.runtime.generator.IndentingWriter;
+import org.apache.beehive.test.tools.milton.mantis.MiltonTestSuite;
+
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.apt.Filer;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/*
+ * A JpfAccesser is will generate a Junit test suite to access the methods in the generated JPF
+ */
+public class JpfAccesser extends JpfClient
+{
+ protected final String JPF_ACCESSER_TEMPLATE_NAME = "org/apache/beehive/test/tools/milton/mantis/generator/MiltonJpfAccesser.vm";
+ protected String _jpfAccesserPackage = "tests.jpf.";
+ protected String _jpfAccesserLocation = null;
+ protected String _jpfAccesserName = "";
+
+ /*
+ * Construct a JpfAccesser
+ *
+ * @param p_mts the MiltonTestSuite to represent a JPF client for
+ * @param p_env APT environment. Needed for accessing the Filer.
+ */
+ public JpfAccesser(MiltonTestSuite p_mts, AnnotationProcessorEnvironment p_env)
+ {
+ super(p_mts, p_env);
+ this._templateName = JPF_ACCESSER_TEMPLATE_NAME;
+ this._jpfAccesserLocation = super._accesserDir;
+
+ // Create a client accessor package
+ String packageReWriter = "(.*)\\.(.+)$";
+ Pattern packagePattern = Pattern.compile(packageReWriter);
+
+ Matcher m = packagePattern.matcher(p_mts.getPackageName());
+
+ //TODO: consider rethinking how i handle package mangling here
+ if (m.matches())
+ this._jpfAccesserPackage = "test.milton.jpf." + m.group(2);
+ else
+ this._jpfAccesserPackage = "test.milton.jpf." + p_mts.getPackageName();
+
+ this._jpfAccesserName = p_mts.getName().startsWith("Test") ?
+ p_mts.getName() : "Test" + p_mts.getName();
+
+ this._jpfAccesserLocation += this._jpfAccesserPackage.replace(".", "/") +
+ "/" + _jpfAccesserName + ".java";
+
+ this._context.put("jpf_webapp_name", super._webappName);
+ this._context.put("jpf_accesser_package", this._jpfAccesserPackage);
+ this._context.put("jpf_accesser_name", _jpfAccesserName);
+ this._context.put("jpf_action_call_prefix", super._jpfActionPath);
+ }
+
+ /*
+ * Overriding the getWriter() in the parent class to return a Writer with
+ * for the correct JPF Accesser file.
+ */
+ public Writer getWriter()
+ throws IOException
+ {
+ this._writer = new IndentingWriter(this._filer.createTextFile(Filer.Location.SOURCE_TREE,
+ "", new File(this._jpfAccesserLocation), null));
+ return this._writer;
+ }
+}
Propchange: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/JpfAccesser.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/JpfClient.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/JpfClient.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/JpfClient.java (original)
+++ beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/JpfClient.java Fri Aug 12 08:12:28 2005
@@ -1,61 +1,61 @@
-package org.apache.beehive.test.tools.milton.mantis.generator;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.Writer;
-
-import org.apache.beehive.controls.runtime.generator.IndentingWriter;
-import org.apache.beehive.test.tools.milton.mantis.MiltonTestSuite;
-
-import com.sun.mirror.apt.AnnotationProcessorEnvironment;
-import com.sun.mirror.apt.Filer;
-
-/*
- * A JpfClient extends MiltonTestClient and represents the information
- * necessary to generate a JPF client for a given MiltonTestSuite.
- *
- * @see MiltonTestClient
- */
-public class JpfClient extends MiltonTestClient
-{
- protected final String JPF_TEMPLATE_NAME = "org/apache/beehive/test/tools/milton/mantis/generator/MiltonJpf.vm";
-
- protected String _jpfPackage;
- protected String _jpfLocation;
- protected String _jpfActionPath;
-
- /*
- * Construct a JpfClient
- *
- * @param p_mts the MiltonTestSuite to represent a JPF client for
- * @param p_env APT environment. Needed for accessing the Filer.
- */
- public JpfClient(MiltonTestSuite p_mts, AnnotationProcessorEnvironment p_env)
- {
- super(p_mts, p_env);
- this._templateName = JPF_TEMPLATE_NAME;
-
- String[] pkg = p_mts.getPackageName().split("\\.");
- //TODO: should i handle the 'noPackage' case or error out?
- this._jpfPackage = pkg.length >= 1 ? pkg[pkg.length-1] : "noPackage";
- //TODO: make some of these values into externally overridable properties
- this._jpfPackage = "milton.pageflows." + this._jpfPackage + "." + p_mts.getName();
- this._jpfActionPath = super._webappName + "/" + this._jpfPackage.replace(".", "/");
- this._jpfLocation = super._webappDir + super._webappName + "/WEB-INF/src/" + this._jpfPackage.replace(".", "/") +
- "/Controller.jpf";
-
- this._context.put("jpf_package", this._jpfPackage);
- }
-
- /*
- * Overriding the getWriter() in the parent class to return a Writer with
- * for the correct JPF file.
- */
- public Writer getWriter()
- throws IOException
- {
- this._writer = new IndentingWriter(this._filer.createTextFile(Filer.Location.SOURCE_TREE,
- "", new File(this._jpfLocation), null));
- return this._writer;
- }
-}
+package org.apache.beehive.test.tools.milton.mantis.generator;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.Writer;
+
+import org.apache.beehive.controls.runtime.generator.IndentingWriter;
+import org.apache.beehive.test.tools.milton.mantis.MiltonTestSuite;
+
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.apt.Filer;
+
+/*
+ * A JpfClient extends MiltonTestClient and represents the information
+ * necessary to generate a JPF client for a given MiltonTestSuite.
+ *
+ * @see MiltonTestClient
+ */
+public class JpfClient extends MiltonTestClient
+{
+ protected final String JPF_TEMPLATE_NAME = "org/apache/beehive/test/tools/milton/mantis/generator/MiltonJpf.vm";
+
+ protected String _jpfPackage;
+ protected String _jpfLocation;
+ protected String _jpfActionPath;
+
+ /*
+ * Construct a JpfClient
+ *
+ * @param p_mts the MiltonTestSuite to represent a JPF client for
+ * @param p_env APT environment. Needed for accessing the Filer.
+ */
+ public JpfClient(MiltonTestSuite p_mts, AnnotationProcessorEnvironment p_env)
+ {
+ super(p_mts, p_env);
+ this._templateName = JPF_TEMPLATE_NAME;
+
+ String[] pkg = p_mts.getPackageName().split("\\.");
+ //TODO: should i handle the 'noPackage' case or error out?
+ this._jpfPackage = pkg.length >= 1 ? pkg[pkg.length-1] : "noPackage";
+ //TODO: make some of these values into externally overridable properties
+ this._jpfPackage = "milton.pageflows." + this._jpfPackage + "." + p_mts.getName();
+ this._jpfActionPath = super._webappName + "/" + this._jpfPackage.replace(".", "/");
+ this._jpfLocation = super._webappDir + super._webappName + "/WEB-INF/src/" + this._jpfPackage.replace(".", "/") +
+ "/Controller.jpf";
+
+ this._context.put("jpf_package", this._jpfPackage);
+ }
+
+ /*
+ * Overriding the getWriter() in the parent class to return a Writer with
+ * for the correct JPF file.
+ */
+ public Writer getWriter()
+ throws IOException
+ {
+ this._writer = new IndentingWriter(this._filer.createTextFile(Filer.Location.SOURCE_TREE,
+ "", new File(this._jpfLocation), null));
+ return this._writer;
+ }
+}
Propchange: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/JpfClient.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/JwsAccesser.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/JwsAccesser.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/JwsAccesser.java (original)
+++ beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/JwsAccesser.java Fri Aug 12 08:12:28 2005
@@ -1,72 +1,72 @@
-package org.apache.beehive.test.tools.milton.mantis.generator;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.Writer;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.beehive.controls.runtime.generator.IndentingWriter;
-import org.apache.beehive.test.tools.milton.mantis.MiltonTestSuite;
-
-import com.sun.mirror.apt.AnnotationProcessorEnvironment;
-import com.sun.mirror.apt.Filer;
-
-/*
- * A JwsAccesser is will generate a Junit test suite to access the methods in the generated JWS
- */
-public class JwsAccesser extends JwsClient
-{
- protected final String JWS_ACCESSER_TEMPLATE_NAME = "org/apache/beehive/test/tools/milton/mantis/generator/MiltonJwsAccesser.vm";
- protected String _jwsAccesserPackage = "tests.jws.";
- protected String _jwsAccesserLocation = null;
- protected String _jwsAccesserName = "";
-
- /*
- * Construct a JwsAccesser
- *
- * @param p_mts the MiltonTestSuite to represent a JWS client for
- * @param p_env APT environment. Needed for accessing the Filer.
- */
- public JwsAccesser(MiltonTestSuite p_mts, AnnotationProcessorEnvironment p_env)
- {
- super(p_mts, p_env);
- this._templateName = JWS_ACCESSER_TEMPLATE_NAME;
- this._jwsAccesserLocation = super._accesserDir;
-
- // Create a client accessor package
- String packageReWriter = "(.*)\\.(.+)$";
- Pattern packagePattern = Pattern.compile(packageReWriter);
-
- Matcher m = packagePattern.matcher(p_mts.getPackageName());
-
- //TODO: consider rethinking how i handle package mangling here
- // my intension is to make it clear which code has been gen'ed
- if (m.matches())
- this._jwsAccesserPackage = "test.milton.jws." + m.group(2);
- else
- this._jwsAccesserPackage = "test.milton.jws." + p_mts.getPackageName();
-
- this._jwsAccesserName = p_mts.getName().startsWith("Test") ?
- p_mts.getName() : "Test" + p_mts.getName();
-
- this._jwsAccesserLocation += this._jwsAccesserPackage.replace(".", "/") +
- "/" + _jwsAccesserName + ".java";
-
- this._context.put("jws_accesser_package", this._jwsAccesserPackage);
- this._context.put("jws_accesser_name", _jwsAccesserName);
- this._context.put("jws_accesser_call_path", super._jwsCallPath);
- }
-
- /*
- * Overriding the getWriter() in the parent class to return a Writer with
- * for the correct JWS Accesser file.
- */
- public Writer getWriter()
- throws IOException
- {
- this._writer = new IndentingWriter(this._filer.createTextFile(Filer.Location.SOURCE_TREE,
- "", new File(this._jwsAccesserLocation), null));
- return this._writer;
- }
-}
+package org.apache.beehive.test.tools.milton.mantis.generator;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.beehive.controls.runtime.generator.IndentingWriter;
+import org.apache.beehive.test.tools.milton.mantis.MiltonTestSuite;
+
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.apt.Filer;
+
+/*
+ * A JwsAccesser is will generate a Junit test suite to access the methods in the generated JWS
+ */
+public class JwsAccesser extends JwsClient
+{
+ protected final String JWS_ACCESSER_TEMPLATE_NAME = "org/apache/beehive/test/tools/milton/mantis/generator/MiltonJwsAccesser.vm";
+ protected String _jwsAccesserPackage = "tests.jws.";
+ protected String _jwsAccesserLocation = null;
+ protected String _jwsAccesserName = "";
+
+ /*
+ * Construct a JwsAccesser
+ *
+ * @param p_mts the MiltonTestSuite to represent a JWS client for
+ * @param p_env APT environment. Needed for accessing the Filer.
+ */
+ public JwsAccesser(MiltonTestSuite p_mts, AnnotationProcessorEnvironment p_env)
+ {
+ super(p_mts, p_env);
+ this._templateName = JWS_ACCESSER_TEMPLATE_NAME;
+ this._jwsAccesserLocation = super._accesserDir;
+
+ // Create a client accessor package
+ String packageReWriter = "(.*)\\.(.+)$";
+ Pattern packagePattern = Pattern.compile(packageReWriter);
+
+ Matcher m = packagePattern.matcher(p_mts.getPackageName());
+
+ //TODO: consider rethinking how i handle package mangling here
+ // my intension is to make it clear which code has been gen'ed
+ if (m.matches())
+ this._jwsAccesserPackage = "test.milton.jws." + m.group(2);
+ else
+ this._jwsAccesserPackage = "test.milton.jws." + p_mts.getPackageName();
+
+ this._jwsAccesserName = p_mts.getName().startsWith("Test") ?
+ p_mts.getName() : "Test" + p_mts.getName();
+
+ this._jwsAccesserLocation += this._jwsAccesserPackage.replace(".", "/") +
+ "/" + _jwsAccesserName + ".java";
+
+ this._context.put("jws_accesser_package", this._jwsAccesserPackage);
+ this._context.put("jws_accesser_name", _jwsAccesserName);
+ this._context.put("jws_accesser_call_path", super._jwsCallPath);
+ }
+
+ /*
+ * Overriding the getWriter() in the parent class to return a Writer with
+ * for the correct JWS Accesser file.
+ */
+ public Writer getWriter()
+ throws IOException
+ {
+ this._writer = new IndentingWriter(this._filer.createTextFile(Filer.Location.SOURCE_TREE,
+ "", new File(this._jwsAccesserLocation), null));
+ return this._writer;
+ }
+}
Propchange: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/JwsAccesser.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/JwsClient.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/JwsClient.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/JwsClient.java (original)
+++ beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/JwsClient.java Fri Aug 12 08:12:28 2005
@@ -1,63 +1,63 @@
-package org.apache.beehive.test.tools.milton.mantis.generator;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.Writer;
-
-import org.apache.beehive.controls.runtime.generator.IndentingWriter;
-import org.apache.beehive.test.tools.milton.mantis.MiltonTestSuite;
-
-import com.sun.mirror.apt.AnnotationProcessorEnvironment;
-import com.sun.mirror.apt.Filer;
-
-/*
- * A JwsClient extends MiltonTestClient and represents the information
- * necessary to generate a JWS client for a given MiltonTestSuite.
- *
- * @see MiltonTestClient
- */
-public class JwsClient extends MiltonTestClient
-{
- protected final String TEMPLATE_NAME = "org/apache/beehive/test/tools/milton/mantis/generator/MiltonJws.vm";
- protected final String PKGPREFIX = "milton.webservices.";
-
- protected String _jwsPackage = PKGPREFIX;
- protected String _jwsLocation;
- protected String _jwsCallPath;
- protected String _jwsPath;
-
- /*
- * Construct a JwsClient
- *
- * @param p_mts the MiltonTestSuite to represent a JPF client for
- * @param p_env APT environment. Needed for accessing the Filer.
- */
- public JwsClient(MiltonTestSuite p_mts, AnnotationProcessorEnvironment p_env)
- {
- super(p_mts, p_env);
- this._templateName = TEMPLATE_NAME;
-
- String[] pkg = p_mts.getPackageName().split("\\.");
-
- //TODO: should i handle the 'noPackage' case or error out?
- this._jwsPackage += pkg.length >= 1 ? pkg[pkg.length-1] : "noPackage";
- this._jwsPath = this._jwsPackage.replace(".", "/") +
- "/" + p_mts.getName()+"WebService.jws";
- this._jwsCallPath = "/" + super._webappName + "/" + this._jwsPath;
- this._jwsLocation = super._webappDir + super._webappName + "/WEB-INF/src/" + this._jwsPath;
-
- this._context.put("jws_package", this._jwsPackage);
- }
-
- /*
- * Overriding the getWriter() in the parent class to return a Writer with
- * for the correct JPF file.
- */
- public Writer getWriter()
- throws IOException
- {
- this._writer = new IndentingWriter(this._filer.createTextFile(Filer.Location.SOURCE_TREE,
- "", new File(this._jwsLocation), null));
- return this._writer;
- }
-}
+package org.apache.beehive.test.tools.milton.mantis.generator;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.Writer;
+
+import org.apache.beehive.controls.runtime.generator.IndentingWriter;
+import org.apache.beehive.test.tools.milton.mantis.MiltonTestSuite;
+
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.apt.Filer;
+
+/*
+ * A JwsClient extends MiltonTestClient and represents the information
+ * necessary to generate a JWS client for a given MiltonTestSuite.
+ *
+ * @see MiltonTestClient
+ */
+public class JwsClient extends MiltonTestClient
+{
+ protected final String TEMPLATE_NAME = "org/apache/beehive/test/tools/milton/mantis/generator/MiltonJws.vm";
+ protected final String PKGPREFIX = "milton.webservices.";
+
+ protected String _jwsPackage = PKGPREFIX;
+ protected String _jwsLocation;
+ protected String _jwsCallPath;
+ protected String _jwsPath;
+
+ /*
+ * Construct a JwsClient
+ *
+ * @param p_mts the MiltonTestSuite to represent a JPF client for
+ * @param p_env APT environment. Needed for accessing the Filer.
+ */
+ public JwsClient(MiltonTestSuite p_mts, AnnotationProcessorEnvironment p_env)
+ {
+ super(p_mts, p_env);
+ this._templateName = TEMPLATE_NAME;
+
+ String[] pkg = p_mts.getPackageName().split("\\.");
+
+ //TODO: should i handle the 'noPackage' case or error out?
+ this._jwsPackage += pkg.length >= 1 ? pkg[pkg.length-1] : "noPackage";
+ this._jwsPath = this._jwsPackage.replace(".", "/") +
+ "/" + p_mts.getName()+"WebService.jws";
+ this._jwsCallPath = "/" + super._webappName + "/" + this._jwsPath;
+ this._jwsLocation = super._webappDir + super._webappName + "/WEB-INF/src/" + this._jwsPath;
+
+ this._context.put("jws_package", this._jwsPackage);
+ }
+
+ /*
+ * Overriding the getWriter() in the parent class to return a Writer with
+ * for the correct JPF file.
+ */
+ public Writer getWriter()
+ throws IOException
+ {
+ this._writer = new IndentingWriter(this._filer.createTextFile(Filer.Location.SOURCE_TREE,
+ "", new File(this._jwsLocation), null));
+ return this._writer;
+ }
+}
Propchange: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/JwsClient.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/MiltonClientGenerator.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/MiltonClientGenerator.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/MiltonClientGenerator.java (original)
+++ beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/MiltonClientGenerator.java Fri Aug 12 08:12:28 2005
@@ -1,14 +1,14 @@
-package org.apache.beehive.test.tools.milton.mantis.generator;
-
-/*
- * Inteface to describe a generater
- */
-public interface MiltonClientGenerator
-{
- /*
- * Given a MiltonTestClient this method must generate the appropriate files
- *
- * @see MiltonTestClient
- */
- public void generate(MiltonTestClient p_mtc);
-}
+package org.apache.beehive.test.tools.milton.mantis.generator;
+
+/*
+ * Inteface to describe a generater
+ */
+public interface MiltonClientGenerator
+{
+ /*
+ * Given a MiltonTestClient this method must generate the appropriate files
+ *
+ * @see MiltonTestClient
+ */
+ public void generate(MiltonTestClient p_mtc);
+}
Propchange: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/MiltonClientGenerator.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/MiltonJpf.vm
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/MiltonJpf.vm?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/MiltonJpf.vm (original)
+++ beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/MiltonJpf.vm Fri Aug 12 08:12:28 2005
@@ -1,80 +1,80 @@
-##
-## The Velocity code generation template for the Milton JPF controllerfor
-## generated as a control client for testing beehive-controls.
-##
-## Copyright 2004 The Apache Software Foundation.
-##
-## Licensed under the Apache License, Version 2.0 (the "License");
-## you may not use this file except in compliance with the License.
-## You may obtain a copy of the License at
-##
-## http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS,
-## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-## See the License for the specific language governing permissions and
-## limitations under the License.
-##
-## $Header:$
-##
-#macro (defineActions)
- #foreach ($test in $suite.tests)
- @Jpf.Action
- public Forward ${test.name}()
- {
- #programaticControls($test)
-
- ${suite.packageName}.${suite.name} driver = new ${suite.packageName}.${suite.name}();
- return new Forward(Report.RESULTS, Report.KEY, driver.${test.name}(${test.parameters}));
- }
-
- #end
-#end
-##
-#macro (declarativeControls $test)
- #foreach ($control in $test.getDeclarativeControls())
- @Control
- #foreach ($annotation in $control.getAnnotations())
- $annotation
- #end
- $control.modifier ${control.type}${control.genericType} $control.name;
-
- #end
-#end
-##
-#macro (programaticControls $test)
- #foreach ($control in $test.getProgramaticControls())
- $control.type $control.name = ($control.type) java.beans.Beans.instantiate(Thread.currentThread().getContextClassLoader(), "$control.type");
-
- #end
-#end
-##
-package $client.jpf_package;
-
-import org.apache.beehive.netui.pageflow.PageFlowController;
-import org.apache.beehive.netui.pageflow.Forward;
-import org.apache.beehive.netui.pageflow.annotations.Jpf;
-
-import org.apache.beehive.controls.api.bean.Control;
-
-import org.apache.beehive.test.tools.milton.common.Report;
-
-@Jpf.Controller(
- forwards = { @Jpf.Forward(name=Report.RESULTS,path = Report.RESULTSJSP) }
-)
-public class Controller extends PageFlowController
-{
- #foreach ($test in $suite.tests)
- #declarativeControls($test)
- #end
-
- @Jpf.Action
- protected Forward begin()
- {
- return new Forward(Report.RESULTS, Report.KEY, new
- Report(Report.ABORT,"begin() is not a test method!"));
- }
-
- #defineActions()
-}
+##
+## The Velocity code generation template for the Milton JPF controllerfor
+## generated as a control client for testing beehive-controls.
+##
+## Copyright 2004 The Apache Software Foundation.
+##
+## Licensed under the Apache License, Version 2.0 (the "License");
+## you may not use this file except in compliance with the License.
+## You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+##
+## $Header:$
+##
+#macro (defineActions)
+ #foreach ($test in $suite.tests)
+ @Jpf.Action
+ public Forward ${test.name}()
+ {
+ #programaticControls($test)
+
+ ${suite.packageName}.${suite.name} driver = new ${suite.packageName}.${suite.name}();
+ return new Forward(Report.RESULTS, Report.KEY, driver.${test.name}(${test.parameters}));
+ }
+
+ #end
+#end
+##
+#macro (declarativeControls $test)
+ #foreach ($control in $test.getDeclarativeControls())
+ @Control
+ #foreach ($annotation in $control.getAnnotations())
+ $annotation
+ #end
+ $control.modifier ${control.type}${control.genericType} $control.name;
+
+ #end
+#end
+##
+#macro (programaticControls $test)
+ #foreach ($control in $test.getProgramaticControls())
+ $control.type $control.name = ($control.type) java.beans.Beans.instantiate(Thread.currentThread().getContextClassLoader(), "$control.type");
+
+ #end
+#end
+##
+package $client.jpf_package;
+
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+import org.apache.beehive.controls.api.bean.Control;
+
+import org.apache.beehive.test.tools.milton.common.Report;
+
+@Jpf.Controller(
+ forwards = { @Jpf.Forward(name=Report.RESULTS,path = Report.RESULTSJSP) }
+)
+public class Controller extends PageFlowController
+{
+ #foreach ($test in $suite.tests)
+ #declarativeControls($test)
+ #end
+
+ @Jpf.Action
+ protected Forward begin()
+ {
+ return new Forward(Report.RESULTS, Report.KEY, new
+ Report(Report.ABORT,"begin() is not a test method!"));
+ }
+
+ #defineActions()
+}
Propchange: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/MiltonJpf.vm
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/MiltonJpfAccesser.vm
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/MiltonJpfAccesser.vm?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/MiltonJpfAccesser.vm (original)
+++ beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/MiltonJpfAccesser.vm Fri Aug 12 08:12:28 2005
@@ -1,30 +1,30 @@
-#macro (defineJpfTestMethods)
- #set( $velocimacro.context.localscope = true )
- #foreach ($test in $suite.tests)
- #set( $attributes = ${test.attributes} )
-
- @Freq("$attributes.frequency")
- @Status("$attributes.status")
- @Misc("$attributes.misc")
- @Desc("$attributes.description")
- public void ${test.name}() throws Exception
- {
- assertReport("${client.jpf_action_call_prefix}/${test.name}.do");
- }
-
- #end
-#end
-###
-package $client.jpf_accesser_package;
-
-import org.apache.beehive.test.tools.milton.junit.HtmlReportTestCase;
-
-import org.apache.beehive.test.tools.mantis.annotations.tch.*;
-
-@Webapps("$suite.webapps")
-public class $client.jpf_accesser_name extends HtmlReportTestCase
-{
- public ${client.jpf_accesser_name}(String s){super(s);}
-
- #defineJpfTestMethods()
-}
+#macro (defineJpfTestMethods)
+ #set( $velocimacro.context.localscope = true )
+ #foreach ($test in $suite.tests)
+ #set( $attributes = ${test.attributes} )
+
+ @Freq("$attributes.frequency")
+ @Status("$attributes.status")
+ @Misc("$attributes.misc")
+ @Desc("$attributes.description")
+ public void ${test.name}() throws Exception
+ {
+ assertReport("${client.jpf_action_call_prefix}/${test.name}.do");
+ }
+
+ #end
+#end
+###
+package $client.jpf_accesser_package;
+
+import org.apache.beehive.test.tools.milton.junit.HtmlReportTestCase;
+
+import org.apache.beehive.test.tools.mantis.annotations.tch.*;
+
+@Webapps("$suite.webapps")
+public class $client.jpf_accesser_name extends HtmlReportTestCase
+{
+ public ${client.jpf_accesser_name}(String s){super(s);}
+
+ #defineJpfTestMethods()
+}