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 2006/05/03 02:27:31 UTC
svn commit: r399098 - in /beehive/trunk/controls/test: common/ infra/tch/
tools/mantis/src/org/apache/beehive/test/tools/mantis/
tools/mantis/src/org/apache/beehive/test/tools/mantis/annotations/tch/
tools/mantis/src/org/apache/beehive/test/tools/manti...
Author: ekoneil
Date: Tue May 2 17:27:26 2006
New Revision: 399098
URL: http://svn.apache.org/viewcvs?rev=399098&view=rev
Log:
Control test updates -- add license headers to source files and start removing files related to all of this infrastructure.
BB: self
Test: Controls pass
Removed:
beehive/trunk/controls/test/tools/tch/setenv.sh
Modified:
beehive/trunk/controls/test/common/path.properties
beehive/trunk/controls/test/infra/tch/schema.jar
beehive/trunk/controls/test/infra/tch/tchx.jar
beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/AbstractMantisProcessor.java
beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/MantisFactory.java
beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/MantisTask.java
beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/TchProcessor.java
beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/annotations/tch/Desc.java
beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/annotations/tch/Freq.java
beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/annotations/tch/Misc.java
beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/annotations/tch/Status.java
beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/annotations/tch/Webapps.java
beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/test/CheckinTest.java
beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/test/DetailedTest.java
beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/utils/FileTypes.java
beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/utils/MantisFileInfo.java
beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/utils/StreamCapture.java
beehive/trunk/controls/test/tools/tch/build.xml
beehive/trunk/controls/test/webapps/src/binding/BindingTests.java
beehive/trunk/controls/test/webapps/web/WEB-INF/web.xml
Modified: beehive/trunk/controls/test/common/path.properties
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/common/path.properties?rev=399098&r1=399097&r2=399098&view=diff
==============================================================================
--- beehive/trunk/controls/test/common/path.properties (original)
+++ beehive/trunk/controls/test/common/path.properties Tue May 2 17:27:26 2006
@@ -7,7 +7,7 @@
controls.test.root=${controls.dir}/test
controls.test.infra.dir=${controls.dir}/test/infra
-!-- Beehive test specific properties -->
+# Beehive test specific properties
controls.test.src=${controls.test.root}/src
controls.test.units=${controls.test.src}/units
controls.test.drivers=${controls.test.src}/drivers
@@ -63,7 +63,6 @@
mantis.milton.bingen.dir=${build.dir}
mantis.milton.log.dir=${build.dir}/mantis.milton.logs
mantis.milton.control.test.accessers=${mantis.milton.srcgen.dir}/testsrcgen
-# mantis.milton.control.test.accessers.relative=${build.dir.name}/${milton.accesser.src.gendir}
mantis.tch.srcgen.dir=${build.dir}/mantis.tch.cases
mantis.tch.bingen.dir=${build.dir}/mantis.tch.bingen
Modified: beehive/trunk/controls/test/infra/tch/schema.jar
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/infra/tch/schema.jar?rev=399098&r1=399097&r2=399098&view=diff
==============================================================================
Binary files - no diff available.
Modified: beehive/trunk/controls/test/infra/tch/tchx.jar
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/infra/tch/tchx.jar?rev=399098&r1=399097&r2=399098&view=diff
==============================================================================
Binary files - no diff available.
Modified: beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/AbstractMantisProcessor.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/AbstractMantisProcessor.java?rev=399098&r1=399097&r2=399098&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/AbstractMantisProcessor.java (original)
+++ beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/AbstractMantisProcessor.java Tue May 2 17:27:26 2006
@@ -1,74 +1,63 @@
+/*
+ * Copyright 2004,2006 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:$
+ */
package org.apache.beehive.test.tools.mantis;
-// mirror apis
-import com.sun.mirror.apt.AnnotationProcessor;
-import com.sun.mirror.apt.AnnotationProcessorEnvironment;
-import com.sun.mirror.apt.Filer;
-import com.sun.mirror.declaration.PackageDeclaration;
-import com.sun.mirror.declaration.AnnotationTypeDeclaration;
-import com.sun.mirror.declaration.AnnotationTypeElementDeclaration;
-import com.sun.mirror.declaration.AnnotationValue;
-import com.sun.mirror.declaration.TypeDeclaration;
-import com.sun.mirror.declaration.ClassDeclaration;
-import com.sun.mirror.declaration.MethodDeclaration;
-import com.sun.mirror.declaration.AnnotationMirror;
-
-// java utils
-import java.io.PrintWriter;
-import java.io.IOException;
-import java.io.File;
+import java.util.HashSet;
import java.util.Map;
-import java.util.Iterator;
import java.util.Set;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.ArrayList;
-
-// mantis annotations
-//import org.apache.beehive.mantis.annotations.*;
+import com.sun.mirror.apt.AnnotationProcessor;
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.declaration.AnnotationTypeDeclaration;
import org.apache.beehive.test.tools.mantis.utils.FileTypes;
import org.apache.beehive.test.tools.mantis.utils.MantisFileInfo;
-// tch schema types
-//import org.apache.xmlbeans.XmlAnySimpleType;
-//import org.apache.xmlbeans.XmlAnySimpleType.Factory;
-//import noNamespace.ProjectDocument.*;
-//import noNamespace.*;
-
-public abstract class AbstractMantisProcessor implements AnnotationProcessor
-{
- private HashSet<MantisFileInfo> _fileinfos;
- protected Set<AnnotationTypeDeclaration> _atds;
- protected AnnotationProcessorEnvironment _env;
- protected String _srctree;
- protected String _classtree;
-
- abstract public void process();
-
- public void init(Set<AnnotationTypeDeclaration> p_atds,
- AnnotationProcessorEnvironment p_env)
- {
- this._atds = p_atds;
- this._env = p_env;
- _fileinfos = new HashSet<MantisFileInfo>();
-
- // initialize the file gen dir strings
- Map<String,String> opts = _env.getOptions();
- _srctree = opts.get("-s");
- _classtree = opts.get("-d");
- }
-
- protected void registerFile(String url, String creatingClassname, FileTypes type)
- {
- MantisFileInfo finfo = new MantisFileInfo(url,
- creatingClassname,
- type);
- _fileinfos.add(finfo);
- }
-
- public HashSet<MantisFileInfo> getFileInfo()
- {
- return _fileinfos;
- }
+public abstract class AbstractMantisProcessor
+ implements AnnotationProcessor {
+
+ private HashSet<MantisFileInfo> _fileinfos;
+ protected Set<AnnotationTypeDeclaration> _atds;
+ protected AnnotationProcessorEnvironment _env;
+ protected String _srctree;
+ protected String _classtree;
+
+ public abstract void process();
+
+ public void init(Set<AnnotationTypeDeclaration> p_atds,
+ AnnotationProcessorEnvironment p_env) {
+ this._atds = p_atds;
+ this._env = p_env;
+ _fileinfos = new HashSet<MantisFileInfo>();
+
+ // initialize the file gen dir strings
+ Map<String, String> opts = _env.getOptions();
+ _srctree = opts.get("-s");
+ _classtree = opts.get("-d");
+ }
+
+ protected void registerFile(String url, String creatingClassname, FileTypes type) {
+ MantisFileInfo finfo = new MantisFileInfo(url,
+ creatingClassname,
+ type);
+ _fileinfos.add(finfo);
+ }
+
+ public HashSet<MantisFileInfo> getFileInfo() {
+ return _fileinfos;
+ }
}
Modified: beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/MantisFactory.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/MantisFactory.java?rev=399098&r1=399097&r2=399098&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/MantisFactory.java (original)
+++ beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/MantisFactory.java Tue May 2 17:27:26 2006
@@ -1,25 +1,42 @@
+/*
+ * Copyright 2004,2006 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:$
+ */
package org.apache.beehive.test.tools.mantis;
-import com.sun.mirror.apt.*;
-import com.sun.mirror.declaration.*;
-
-import java.io.FileReader;
import java.io.FileNotFoundException;
+import java.io.FileReader;
import java.io.IOException;
-import java.lang.StringBuffer;
-import java.lang.ClassNotFoundException;
-import java.lang.InstantiationException;
-import java.lang.IllegalAccessException;
-import java.util.Collection;
import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.Map;
import java.util.Set;
-import java.util.Iterator;
-import java.util.Collections;
-public class MantisFactory implements AnnotationProcessorFactory {
+import com.sun.mirror.apt.AnnotationProcessor;
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.apt.AnnotationProcessorFactory;
+import com.sun.mirror.apt.AnnotationProcessors;
+import com.sun.mirror.declaration.AnnotationTypeDeclaration;
+
+public class MantisFactory
+ implements AnnotationProcessorFactory {
// map of annotation package to processor name
private HashMap<String, String> _processorMap;
@@ -38,7 +55,6 @@
public MantisFactory() {
_supportedOptions = initSupportedOptions();
}
-
public Collection<String> supportedAnnotationTypes() {
return _supportedAnnotations;
Modified: beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/MantisTask.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/MantisTask.java?rev=399098&r1=399097&r2=399098&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/MantisTask.java (original)
+++ beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/MantisTask.java Tue May 2 17:27:26 2006
@@ -1,3 +1,20 @@
+/*
+ * Copyright 2004,2006 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:$
+ */
package org.apache.beehive.test.tools.mantis;
import java.io.File;
@@ -5,14 +22,14 @@
import java.io.IOException;
import java.util.StringTokenizer;
-import org.apache.tools.ant.taskdefs.MatchingTask;
+import org.apache.beehive.test.tools.mantis.utils.StreamCapture;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
-
-import org.apache.beehive.test.tools.mantis.utils.StreamCapture;
+import org.apache.tools.ant.taskdefs.MatchingTask;
public class MantisTask extends MatchingTask {
- private final String P = System.getProperty("file.separator");
+
+ private final String FILE_SEPARATOR = System.getProperty("file.separator");
// required attributes
private String _srcdir = null;
@@ -90,12 +107,12 @@
fSrcgen.mkdirs();
DirectoryScanner scanner = getDirectoryScanner(new File(_srcdir));
String[] files = scanner.getIncludedFiles();
- String filename = _srcgen + P + "files.txt";
+ String filename = _srcgen + FILE_SEPARATOR + "files.txt";
int returnCode = 0;
try {
FileWriter writer = new FileWriter(new File(filename));
for (int i = 0; i < files.length; i++) {
- writer.write(_srcdir + P + files[i]);
+ writer.write(_srcdir + FILE_SEPARATOR + files[i]);
if (i != files.length)
writer.write("\n");
}
@@ -170,8 +187,8 @@
}
// capture stderr and stdout to log files
- StreamCapture stderr = new StreamCapture(p_proc.getErrorStream(), "file", _logdir + P + "mantis.err");
- StreamCapture stdout = new StreamCapture(p_proc.getInputStream(), "file", _logdir + P + "mantis.out");
+ StreamCapture stderr = new StreamCapture(p_proc.getErrorStream(), "file", _logdir + FILE_SEPARATOR + "mantis.err");
+ StreamCapture stdout = new StreamCapture(p_proc.getInputStream(), "file", _logdir + FILE_SEPARATOR + "mantis.out");
stderr.start();
stdout.start();
Modified: beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/TchProcessor.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/TchProcessor.java?rev=399098&r1=399097&r2=399098&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/TchProcessor.java (original)
+++ beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/TchProcessor.java Tue May 2 17:27:26 2006
@@ -1,290 +1,275 @@
+/*
+ * Copyright 2004,2006 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:$
+ */
package org.apache.beehive.test.tools.mantis;
-// mirror apis
-import com.sun.mirror.apt.AnnotationProcessor;
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
import com.sun.mirror.apt.AnnotationProcessorEnvironment;
import com.sun.mirror.apt.Filer;
-import com.sun.mirror.declaration.PackageDeclaration;
import com.sun.mirror.declaration.AnnotationTypeDeclaration;
-import com.sun.mirror.declaration.AnnotationTypeElementDeclaration;
-import com.sun.mirror.declaration.AnnotationValue;
-import com.sun.mirror.declaration.TypeDeclaration;
import com.sun.mirror.declaration.ClassDeclaration;
import com.sun.mirror.declaration.MethodDeclaration;
-import com.sun.mirror.declaration.AnnotationMirror;
-
-// java utils
-import java.io.PrintWriter;
-import java.io.IOException;
-import java.io.File;
-import java.util.Map;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.ArrayList;
+import com.sun.mirror.declaration.PackageDeclaration;
+import com.sun.mirror.declaration.TypeDeclaration;
-// mantis annotations
-import org.apache.beehive.test.tools.mantis.annotations.tch.*;
+import org.apache.beehive.test.tools.mantis.annotations.tch.Desc;
+import org.apache.beehive.test.tools.mantis.annotations.tch.Freq;
+import org.apache.beehive.test.tools.mantis.annotations.tch.Misc;
+import org.apache.beehive.test.tools.mantis.annotations.tch.Status;
+import org.apache.beehive.test.tools.mantis.annotations.tch.Webapps;
import org.apache.beehive.test.tools.mantis.utils.FileTypes;
import org.apache.beehive.test.tools.mantis.utils.MantisFileInfo;
-
-// tch schema types
import org.apache.xmlbeans.XmlAnySimpleType;
import org.apache.xmlbeans.XmlAnySimpleType.Factory;
-import noNamespace.ProjectDocument.*;
-import noNamespace.*;
-
-public class TchProcessor extends AbstractMantisProcessor
-{
- protected HashSet<PackageDeclaration> _pkgdecls;
- private Filer _filer;
-
- public void init(Set<AnnotationTypeDeclaration> p_atds,
- AnnotationProcessorEnvironment p_env)
- {
- super.init(p_atds,p_env);
- this._pkgdecls = new HashSet();
- this._filer = _env.getFiler();
-
- // init the package list
- Collection<TypeDeclaration> tdecls =
- _env.getSpecifiedTypeDeclarations();
- for(TypeDeclaration tdecl : tdecls)
- {
- _pkgdecls.add(tdecl.getPackage());
- }
- }
-
- public void process()
- {
- // creates an xml file for each package
- for(PackageDeclaration pkg : _pkgdecls)
- {
- processPackage(pkg);
- }
- // create the root xml file
- createRootTCH();
-
- // print out some info about the files created during this process
- System.out.println("created "+getFileInfo().size()+" files:");
- for(MantisFileInfo mfi : getFileInfo())
- {
- System.out.println(mfi.getUrl());
- System.out.println(mfi.getCreatingClassname());
- if(mfi.getFileType() == FileTypes.AUX)
- System.out.println("AUX");
- else if(mfi.getFileType() == FileTypes.SRC)
- System.out.println("SRC");
- else if(mfi.getFileType() == FileTypes.BIN)
- System.out.println("BIN");
- System.out.println();
- }
-
- }
-
- // process a package
- private void processPackage(PackageDeclaration p_pkgdecl)
- {
- // get the suite name based on package name
- // the . char is illegal for a test name in tch
- String s_suiteName = p_pkgdecl.getQualifiedName().replace('.','-');
-
- // create a new project document (one per package)
- ProjectDocument pdoc = ProjectDocument.Factory.newInstance();
- Project project = pdoc.addNewProject();
- project.setName("tch");
- project.setDefault(s_suiteName);
-
- // create and init the test suite
- TargetType target = project.addNewTarget();
- target.setName(s_suiteName);
- TestSuiteType suite = target.addNewTestSuite();
-
- suite.setTestunit(s_suiteName);
-
- // add the suite-level metadata
- TestMetadataType sMeta = suite.addNewTestMetadata();
- sMeta.setDescription("mantis-generated test suite file");
-
-
- // loop through the classes in this package allowing them to
- // add test cases to the test suite
- Collection<ClassDeclaration> classdecls = p_pkgdecl.getClasses();
- for(ClassDeclaration classdecl : classdecls )
- {
- processClass(classdecl, suite);
- }
-
- // create the tch xml file for this package
- PrintWriter pw = null;
- try
- {
- String filename = p_pkgdecl.getQualifiedName().replace('.','-')+".xml";
- pw = _filer.createTextFile(Filer.Location.SOURCE_TREE,
- "",
- new File(filename),
- null);
- pw.print(pdoc.toString());
- registerFile("file://"+_srctree+"/"+filename,
- this.getClass().getName(),
- FileTypes.AUX);
- }
- catch(IOException ioe)
- {
- ioe.printStackTrace();
- }
- finally
- {
- if(null != pw)
- {
- pw.flush();
- pw.close();
- }
- }
-
- }
-
- private void processClass(ClassDeclaration p_cdecl, TestSuiteType p_suite)
- {
- // get the class-level annotation values
- Freq cfreq = (Freq) p_cdecl.getAnnotation(Freq.class);
- Status cstatus = (Status) p_cdecl.getAnnotation(Status.class);
- Desc cdesc = (Desc) p_cdecl.getAnnotation(Desc.class);
- Misc cmisc = (Misc) p_cdecl.getAnnotation(Misc.class);
- Webapps cwebapps = (Webapps) p_cdecl.getAnnotation(Webapps.class);
-
- // loop through the methods
- Collection<? extends MethodDeclaration> methods = p_cdecl.getMethods();
- Iterator mit = methods.iterator();
- while(mit.hasNext())
- {
- MethodDeclaration methDecl = (MethodDeclaration) mit.next();
- processMethod(methDecl, p_suite, cfreq, cstatus, cdesc, cmisc, cwebapps);
- }
-
- }
-
- private void processMethod(MethodDeclaration p_methdecl,
- TestSuiteType suite,
- Freq p_cfreq,
- Status p_cstatus,
- Desc p_cdesc,
- Misc p_cmisc,
- Webapps p_cwebapps)
- {
- // only process methods that start with 'test' (junit)
- // TODO: may need to add more logic for different tch runners
- if(! p_methdecl.getSimpleName().startsWith("test"))
- return;
-
- // add the test to the suite
- TestType test = suite.addNewTest();
- test.setName(p_methdecl.getDeclaringType().getSimpleName()+"-"+p_methdecl.getSimpleName());
- JavatestType junit = test.addNewJunit();
- junit.setTestclass(p_methdecl.getDeclaringType().getQualifiedName());
- junit.setMethodnames(p_methdecl.getSimpleName());
-
- // get the annotaions on the methods
- Freq mfreq = (Freq) p_methdecl.getAnnotation(Freq.class);
- Status mstatus = (Status) p_methdecl.getAnnotation(Status.class);
- Desc mdesc = (Desc) p_methdecl.getAnnotation(Desc.class);
- Misc mmisc = (Misc) p_methdecl.getAnnotation(Misc.class);
- Webapps mwebapps = (Webapps) p_methdecl.getAnnotation(Webapps.class);
-
- // if not present on the method use the class-level value
- if(null == mfreq) mfreq = p_cfreq;
- if(null == mstatus) mstatus = p_cstatus;
- if(null == mdesc) mdesc = p_cdesc;
- if(null == mmisc) mmisc = p_cmisc;
- if(null == mwebapps) mwebapps = p_cwebapps;
-
- // add metadata to the test
- // leave out if null
- TestMetadataType sMeta = test.addNewTestMetadata();
- if(null != mfreq)
- {
- sMeta.setFreq(createStringArrayList(mfreq.value()));
- }
-
- if(null != mstatus)
- {
- sMeta.setStatus(createStringArrayList(mstatus.value()));
- }
-
- if(null != mdesc)
- sMeta.setDescription(mdesc.value());
-
- if(null != mmisc)
- sMeta.setMisc(mmisc.value());
-
- if(null != mwebapps)
- {
- sMeta.setWebapps(createStringArrayList(mwebapps.value()));
- }
- }
-
- private void createRootTCH()
- {
- // create the root xmlbean
- ProjectDocument pdoc = ProjectDocument.Factory.newInstance();
- Project project = pdoc.addNewProject();
- project.setName("tch");
- project.setDefault("suite");
-
- // create and init the test suite
- TargetType target = project.addNewTarget();
- target.setName("suite");
- TestSuiteType suite = target.addNewTestSuite();
- // the . char is illegal for a test name in tch
- suite.setTestunit("root");
-
- // add a call to each package's test suite
- for(PackageDeclaration pkgdecl : _pkgdecls)
- {
- XmlAnySimpleType testfile = XmlAnySimpleType.Factory.newInstance();
- testfile.setStringValue(pkgdecl.getQualifiedName().replace('.','-')+".xml");
- TestSuiteCallType call = suite.addNewTestSuiteCall();
- call.setTestfile(testfile);
- }
-
- // create the file on disk
- PrintWriter pw = null;
- try
- {
- String filename = "root.xml";
- pw = _filer.createTextFile(Filer.Location.SOURCE_TREE,
- "",
- new File(filename),
- null);
- pw.print(pdoc.toString());
- registerFile("file://"+_srctree+"/"+filename,
- this.getClass().getName(),
- FileTypes.AUX);
- }
- catch(IOException ioe)
- {
- ioe.printStackTrace();
- }
- finally
- {
- if(null != pw)
- {
- pw.flush();
- pw.close();
- }
- }
- }
+import noNamespace.*;
+import noNamespace.ProjectDocument.*;
- private ArrayList<String> createStringArrayList(String p_input)
- {
- String[] values = p_input.split(" ");
- ArrayList<String> result = new ArrayList<String>();
- for(int i=0; i<values.length; i++)
- {
- result.add(values[i]);
+public class TchProcessor extends AbstractMantisProcessor {
+ protected HashSet<PackageDeclaration> _pkgdecls;
+ private Filer _filer;
+
+ public void init(Set<AnnotationTypeDeclaration> p_atds,
+ AnnotationProcessorEnvironment p_env) {
+ super.init(p_atds, p_env);
+ this._pkgdecls = new HashSet();
+ this._filer = _env.getFiler();
+
+ // init the package list
+ Collection<TypeDeclaration> tdecls =
+ _env.getSpecifiedTypeDeclarations();
+ for (TypeDeclaration tdecl : tdecls) {
+ _pkgdecls.add(tdecl.getPackage());
+ }
+ }
+
+ public void process() {
+ // creates an xml file for each package
+ for (PackageDeclaration pkg : _pkgdecls) {
+ processPackage(pkg);
+ }
+
+ // create the root xml file
+ createRootTCH();
+
+ // print out some info about the files created during this process
+ System.out.println("created " + getFileInfo().size() + " files:");
+ for (MantisFileInfo mfi : getFileInfo()) {
+ System.out.println(mfi.getUrl());
+ System.out.println(mfi.getCreatingClassname());
+ if (mfi.getFileType() == FileTypes.AUX)
+ System.out.println("AUX");
+ else if (mfi.getFileType() == FileTypes.SRC)
+ System.out.println("SRC");
+ else if (mfi.getFileType() == FileTypes.BIN)
+ System.out.println("BIN");
+ System.out.println();
+ }
+
+ }
+
+ // process a package
+ private void processPackage(PackageDeclaration p_pkgdecl) {
+ // get the suite name based on package name
+ // the . char is illegal for a test name in tch
+ String s_suiteName = p_pkgdecl.getQualifiedName().replace('.', '-');
+
+ // create a new project document (one per package)
+ ProjectDocument pdoc = ProjectDocument.Factory.newInstance();
+ Project project = pdoc.addNewProject();
+ project.setName("tch");
+ project.setDefault(s_suiteName);
+
+ // create and init the test suite
+ TargetType target = project.addNewTarget();
+ target.setName(s_suiteName);
+ TestSuiteType suite = target.addNewTestSuite();
+
+ suite.setTestunit(s_suiteName);
+
+ // add the suite-level metadata
+ TestMetadataType sMeta = suite.addNewTestMetadata();
+ sMeta.setDescription("mantis-generated test suite file");
+
+ // loop through the classes in this package allowing them to
+ // add test cases to the test suite
+ Collection<ClassDeclaration> classdecls = p_pkgdecl.getClasses();
+ for (ClassDeclaration classdecl : classdecls) {
+ processClass(classdecl, suite);
+ }
+
+ // create the tch xml file for this package
+ PrintWriter pw = null;
+ try {
+ String filename = p_pkgdecl.getQualifiedName().replace('.', '-') + ".xml";
+ pw = _filer.createTextFile(Filer.Location.SOURCE_TREE,
+ "",
+ new File(filename),
+ null);
+ pw.print(pdoc.toString());
+ registerFile("file://" + _srctree + "/" + filename,
+ this.getClass().getName(),
+ FileTypes.AUX);
+ }
+ catch (IOException ioe) {
+ ioe.printStackTrace();
+ }
+ finally {
+ if (null != pw) {
+ pw.flush();
+ pw.close();
+ }
+ }
+
+ }
+
+ private void processClass(ClassDeclaration p_cdecl, TestSuiteType p_suite) {
+ // get the class-level annotation values
+ Freq cfreq = (Freq) p_cdecl.getAnnotation(Freq.class);
+ Status cstatus = (Status) p_cdecl.getAnnotation(Status.class);
+ Desc cdesc = (Desc) p_cdecl.getAnnotation(Desc.class);
+ Misc cmisc = (Misc) p_cdecl.getAnnotation(Misc.class);
+ Webapps cwebapps = (Webapps) p_cdecl.getAnnotation(Webapps.class);
+
+ // loop through the methods
+ Collection<? extends MethodDeclaration> methods = p_cdecl.getMethods();
+ Iterator mit = methods.iterator();
+ while (mit.hasNext()) {
+ MethodDeclaration methDecl = (MethodDeclaration) mit.next();
+ processMethod(methDecl, p_suite, cfreq, cstatus, cdesc, cmisc, cwebapps);
+ }
+
+ }
+
+ private void processMethod(MethodDeclaration p_methdecl,
+ TestSuiteType suite,
+ Freq p_cfreq,
+ Status p_cstatus,
+ Desc p_cdesc,
+ Misc p_cmisc,
+ Webapps p_cwebapps) {
+ // only process methods that start with 'test' (junit)
+ // TODO: may need to add more logic for different tch runners
+ if (!p_methdecl.getSimpleName().startsWith("test"))
+ return;
+
+ // add the test to the suite
+ TestType test = suite.addNewTest();
+ test.setName(p_methdecl.getDeclaringType().getSimpleName() + "-" + p_methdecl.getSimpleName());
+ JavatestType junit = test.addNewJunit();
+ junit.setTestclass(p_methdecl.getDeclaringType().getQualifiedName());
+ junit.setMethodnames(p_methdecl.getSimpleName());
+
+ // get the annotaions on the methods
+ Freq mfreq = (Freq) p_methdecl.getAnnotation(Freq.class);
+ Status mstatus = (Status) p_methdecl.getAnnotation(Status.class);
+ Desc mdesc = (Desc) p_methdecl.getAnnotation(Desc.class);
+ Misc mmisc = (Misc) p_methdecl.getAnnotation(Misc.class);
+ Webapps mwebapps = (Webapps) p_methdecl.getAnnotation(Webapps.class);
+
+ // if not present on the method use the class-level value
+ if (null == mfreq) mfreq = p_cfreq;
+ if (null == mstatus) mstatus = p_cstatus;
+ if (null == mdesc) mdesc = p_cdesc;
+ if (null == mmisc) mmisc = p_cmisc;
+ if (null == mwebapps) mwebapps = p_cwebapps;
+
+ // add metadata to the test
+ // leave out if null
+ TestMetadataType sMeta = test.addNewTestMetadata();
+ if (null != mfreq) {
+ sMeta.setFreq(createStringArrayList(mfreq.value()));
+ }
+
+ if (null != mstatus) {
+ sMeta.setStatus(createStringArrayList(mstatus.value()));
+ }
+
+ if (null != mdesc)
+ sMeta.setDescription(mdesc.value());
+
+ if (null != mmisc)
+ sMeta.setMisc(mmisc.value());
+
+ if (null != mwebapps) {
+ sMeta.setWebapps(createStringArrayList(mwebapps.value()));
+ }
+ }
+
+ private void createRootTCH() {
+ // create the root xmlbean
+ ProjectDocument pdoc = ProjectDocument.Factory.newInstance();
+ Project project = pdoc.addNewProject();
+ project.setName("tch");
+ project.setDefault("suite");
+
+ // create and init the test suite
+ TargetType target = project.addNewTarget();
+ target.setName("suite");
+ TestSuiteType suite = target.addNewTestSuite();
+ // the . char is illegal for a test name in tch
+ suite.setTestunit("root");
+
+ // add a call to each package's test suite
+ for (PackageDeclaration pkgdecl : _pkgdecls) {
+ XmlAnySimpleType testfile = XmlAnySimpleType.Factory.newInstance();
+ testfile.setStringValue(pkgdecl.getQualifiedName().replace('.', '-') + ".xml");
+ TestSuiteCallType call = suite.addNewTestSuiteCall();
+ call.setTestfile(testfile);
+ }
+
+ // create the file on disk
+ PrintWriter pw = null;
+ try {
+ String filename = "root.xml";
+ pw = _filer.createTextFile(Filer.Location.SOURCE_TREE,
+ "",
+ new File(filename),
+ null);
+ pw.print(pdoc.toString());
+ registerFile("file://" + _srctree + "/" + filename,
+ this.getClass().getName(),
+ FileTypes.AUX);
+ }
+ catch (IOException ioe) {
+ ioe.printStackTrace();
+ }
+ finally {
+ if (null != pw) {
+ pw.flush();
+ pw.close();
+ }
+ }
+ }
+
+ private ArrayList<String> createStringArrayList(String p_input) {
+ String[] values = p_input.split(" ");
+ ArrayList<String> result = new ArrayList<String>();
+ for (int i = 0; i < values.length; i++) {
+ result.add(values[i]);
+ }
+ return result;
}
- return result;
- }
}
Modified: beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/annotations/tch/Desc.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/annotations/tch/Desc.java?rev=399098&r1=399097&r2=399098&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/annotations/tch/Desc.java (original)
+++ beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/annotations/tch/Desc.java Tue May 2 17:27:26 2006
@@ -1,6 +1,22 @@
+/*
+ * Copyright 2004,2006 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:$
+ */
package org.apache.beehive.test.tools.mantis.annotations.tch;
-public @interface Desc
-{
- String value();
+public @interface Desc {
+ String value();
}
Modified: beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/annotations/tch/Freq.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/annotations/tch/Freq.java?rev=399098&r1=399097&r2=399098&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/annotations/tch/Freq.java (original)
+++ beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/annotations/tch/Freq.java Tue May 2 17:27:26 2006
@@ -1,6 +1,22 @@
+/*
+ * Copyright 2004,2006 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:$
+ */
package org.apache.beehive.test.tools.mantis.annotations.tch;
-public @interface Freq
-{
- String value() default "detailed";
+public @interface Freq {
+ String value() default "detailed";
}
Modified: beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/annotations/tch/Misc.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/annotations/tch/Misc.java?rev=399098&r1=399097&r2=399098&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/annotations/tch/Misc.java (original)
+++ beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/annotations/tch/Misc.java Tue May 2 17:27:26 2006
@@ -1,6 +1,22 @@
+/*
+ * Copyright 2004,2006 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:$
+ */
package org.apache.beehive.test.tools.mantis.annotations.tch;
-public @interface Misc
-{
- String value();
+public @interface Misc {
+ String value();
}
Modified: beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/annotations/tch/Status.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/annotations/tch/Status.java?rev=399098&r1=399097&r2=399098&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/annotations/tch/Status.java (original)
+++ beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/annotations/tch/Status.java Tue May 2 17:27:26 2006
@@ -1,6 +1,22 @@
+/*
+ * Copyright 2004,2006 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:$
+ */
package org.apache.beehive.test.tools.mantis.annotations.tch;
-public @interface Status
-{
- String value() default "active";
+public @interface Status {
+ String value() default "active";
}
Modified: beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/annotations/tch/Webapps.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/annotations/tch/Webapps.java?rev=399098&r1=399097&r2=399098&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/annotations/tch/Webapps.java (original)
+++ beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/annotations/tch/Webapps.java Tue May 2 17:27:26 2006
@@ -1,6 +1,22 @@
+/*
+ * Copyright 2004,2006 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:$
+ */
package org.apache.beehive.test.tools.mantis.annotations.tch;
-public @interface Webapps
-{
- String value();
+public @interface Webapps {
+ String value();
}
Modified: beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/test/CheckinTest.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/test/CheckinTest.java?rev=399098&r1=399097&r2=399098&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/test/CheckinTest.java (original)
+++ beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/test/CheckinTest.java Tue May 2 17:27:26 2006
@@ -1,35 +1,49 @@
+/*
+ * Copyright 2004,2006 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:$
+ */
package org.apache.beehive.test.tools.mantis.test;
import junit.framework.TestCase;
-import org.apache.beehive.test.tools.mantis.annotations.tch.*;
-
+import org.apache.beehive.test.tools.mantis.annotations.tch.Desc;
+import org.apache.beehive.test.tools.mantis.annotations.tch.Freq;
+import org.apache.beehive.test.tools.mantis.annotations.tch.Misc;
+import org.apache.beehive.test.tools.mantis.annotations.tch.Status;
@Freq("checkin")
@Status("active")
@Desc("a class desc")
@Misc("a class misc")
-public class CheckinTest extends TestCase
-{
- public CheckinTest(String name) throws Exception
- {
- super(name);
- }
-
- @Freq("detailed")
- @Status("inactive")
- @Desc("a method desc")
- @Misc("a method misc")
- public void testPass() throws Exception
- {
- }
-
- public void testFail() throws Exception
- {
- assertTrue(false);
- }
+public class CheckinTest extends TestCase {
+ public CheckinTest(String name) throws Exception {
+ super(name);
+ }
+
+ @Freq("detailed")
+ @Status("inactive")
+ @Desc("a method desc")
+ @Misc("a method misc")
+ public void testPass() throws Exception {
+ }
+
+ public void testFail() throws Exception {
+ assertTrue(false);
+ }
- public void notATest() throws Exception
- {
- }
+ public void notATest() throws Exception {
+ }
}
Modified: beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/test/DetailedTest.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/test/DetailedTest.java?rev=399098&r1=399097&r2=399098&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/test/DetailedTest.java (original)
+++ beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/test/DetailedTest.java Tue May 2 17:27:26 2006
@@ -1,31 +1,45 @@
+/*
+ * Copyright 2004,2006 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:$
+ */
package org.apache.beehive.test.tools.mantis.test;
import junit.framework.TestCase;
-import org.apache.beehive.test.tools.mantis.annotations.tch.*;
+import org.apache.beehive.test.tools.mantis.annotations.tch.Desc;
+import org.apache.beehive.test.tools.mantis.annotations.tch.Freq;
+import org.apache.beehive.test.tools.mantis.annotations.tch.Misc;
+import org.apache.beehive.test.tools.mantis.annotations.tch.Status;
+
+public class DetailedTest extends TestCase {
+ public DetailedTest(String name) throws Exception {
+ super(name);
+ }
+
+ @Freq("detailed")
+ @Status("active")
+ @Desc("a method desc")
+ @Misc("a method misc")
+ public void testPass() throws Exception {
+ }
+
+ public void testFail() throws Exception {
+ assertTrue(false);
+ }
-
-public class DetailedTest extends TestCase
-{
- public DetailedTest(String name) throws Exception
- {
- super(name);
- }
-
- @Freq("detailed")
- @Status("active")
- @Desc("a method desc")
- @Misc("a method misc")
- public void testPass() throws Exception
- {
- }
-
- public void testFail() throws Exception
- {
- assertTrue(false);
- }
-
- public void notATest() throws Exception
- {
- }
+ public void notATest() throws Exception {
+ }
}
Modified: beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/utils/FileTypes.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/utils/FileTypes.java?rev=399098&r1=399097&r2=399098&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/utils/FileTypes.java (original)
+++ beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/utils/FileTypes.java Tue May 2 17:27:26 2006
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2004,2006 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:$
+ */
package org.apache.beehive.test.tools.mantis.utils;
-public enum FileTypes {SRC,BIN,AUX};
+public enum FileTypes {
+ SRC,BIN,AUX
+}
Modified: beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/utils/MantisFileInfo.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/utils/MantisFileInfo.java?rev=399098&r1=399097&r2=399098&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/utils/MantisFileInfo.java (original)
+++ beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/utils/MantisFileInfo.java Tue May 2 17:27:26 2006
@@ -1,22 +1,43 @@
+/*
+ * Copyright 2004,2006 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:$
+ */
package org.apache.beehive.test.tools.mantis.utils;
-public class MantisFileInfo
-{
- private final String _url;
- private final String _creatingClassname;
- private final FileTypes _type;
-
- public MantisFileInfo(String url,
- String classname,
- FileTypes type)
- {
- this._url = url;
- this._creatingClassname = classname;
- this._type = type;
- }
-
- public String getUrl(){return _url;}
- public String getCreatingClassname(){return _creatingClassname;}
- public FileTypes getFileType(){return _type;}
+public class MantisFileInfo {
+ private final String _url;
+ private final String _creatingClassname;
+ private final FileTypes _type;
+
+ public MantisFileInfo(String url, String classname, FileTypes type) {
+ _url = url;
+ _creatingClassname = classname;
+ _type = type;
+ }
+
+ public String getUrl() {
+ return _url;
+ }
+
+ public String getCreatingClassname() {
+ return _creatingClassname;
+ }
+
+ public FileTypes getFileType() {
+ return _type;
+ }
}
Modified: beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/utils/StreamCapture.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/utils/StreamCapture.java?rev=399098&r1=399097&r2=399098&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/utils/StreamCapture.java (original)
+++ beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/utils/StreamCapture.java Tue May 2 17:27:26 2006
@@ -1,36 +1,55 @@
+/*
+ * Copyright 2004,2006 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:$
+ */
package org.apache.beehive.test.tools.mantis.utils;
-import java.io.*;
-import java.lang.StringBuffer;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
/**
* A utility for reading from an InputStream
*/
-public class StreamCapture extends Thread {
+public class StreamCapture
+ extends Thread {
+
private InputStream is;
private String type;
private String filename;
- private String bufferContents = "";
+ private String bufferContents = "";
/**
- *
- * @param is InputStream to read from
+ * @param is InputStream to read from
* @param type An identifier for this stream capture (valid values: stderr, stdout)
*/
- public StreamCapture(InputStream is, String type)
- {
+ public StreamCapture(InputStream is, String type) {
this.is = is;
this.type = type;
}
/**
- *
- * @param is InputStream to read from
+ * @param is InputStream to read from
* @param type An identifier for this stream capture (valid values: stderr, stdout, file)
* @param file If given, the data is saved to this file vs. an in-memory string.
*/
- public StreamCapture(InputStream is, String type, String file)
- {
+ public StreamCapture(InputStream is, String type, String file) {
this.is = is;
this.type = type;
this.filename = file;
@@ -40,61 +59,50 @@
/**
* @return The buffer contents as a string
*/
- public String getString()
- {
+ public String getString() {
return bufferContents;
}
/**
- * Read the InputStream supplied and put into
- * a string which is accessed via getString() or
+ * Read the InputStream supplied and put into
+ * a string which is accessed via getString() or
* a file is type==file and a filename is given.
*/
- public void run()
- {
+ public void run() {
// if type == "file" save the contents to a file
- if(type.equalsIgnoreCase("file"))
- {
- try
- {
- InputStreamReader isr = new InputStreamReader(is);
- BufferedReader br = new BufferedReader(isr);
- String line = null;
- FileWriter fw = new FileWriter(filename);
- BufferedWriter bw = new BufferedWriter(fw);
- while( (line = br.readLine()) != null )
- {
- bw.write(line);
- bw.newLine();
- bw.flush();
+ if (type.equalsIgnoreCase("file")) {
+ try {
+ InputStreamReader isr = new InputStreamReader(is);
+ BufferedReader br = new BufferedReader(isr);
+ String line = null;
+ FileWriter fw = new FileWriter(filename);
+ BufferedWriter bw = new BufferedWriter(fw);
+ while ((line = br.readLine()) != null) {
+ bw.write(line);
+ bw.newLine();
+ bw.flush();
+ }
+ bw.flush();
+ bw.close();
+ }
+ catch (IOException ioe) {
+ ioe.printStackTrace();
+ }
+ } else {
+ try {
+ InputStreamReader isr = new InputStreamReader(is);
+ BufferedReader br = new BufferedReader(isr);
+ StringBuffer sb = new StringBuffer();
+ String line = null;
+ while ((line = br.readLine()) != null) {
+ sb.append(line);
+ }
+ bufferContents = sb.toString();
+ }
+ catch (IOException ioe) {
+ ioe.printStackTrace();
}
- bw.flush();
- bw.close();
- }
- catch (IOException ioe)
- {
- ioe.printStackTrace();
- }
}
- else
- {
- try
- {
- InputStreamReader isr = new InputStreamReader(is);
- BufferedReader br = new BufferedReader(isr);
- StringBuffer sb = new StringBuffer();
- String line = null;
- while ((line = br.readLine()) != null)
- {
- sb.append(line);
- }
- bufferContents = sb.toString();
- }
- catch (IOException ioe)
- {
- ioe.printStackTrace();
- }
- }
}
}
Modified: beehive/trunk/controls/test/tools/tch/build.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/build.xml?rev=399098&r1=399097&r2=399098&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/build.xml (original)
+++ beehive/trunk/controls/test/tools/tch/build.xml Tue May 2 17:27:26 2006
@@ -19,18 +19,13 @@
<project name="tch" default="all" basedir=".">
- <property name="buildenv-props" value="common.props"/>
- <property file="${buildenv-props}"/>
+ <property file="common.props"/>
<import file="../../../../beehive-imports.xml"/>
<property file="common.props"/>
- <property name="java-src" value="${branch-home}/src/java"/>
- <property name="classes" value="${builddir}/classes"/>
- <property name="nativedir" value="${branch-home}/native"/>
- <property name="nativegendir" value="${nativedir}/gen"/>
-
- <!-- Stuff for schema compilation -->
+ <property name="java-src" location="${branch-home}/src/java"/>
+ <property name="classes" location="${builddir}/classes"/>
<property name="schema.compiler" value="org.apache.xmlbeans.impl.tool.SchemaCompiler"/>
<property name="schema.jar.file" location="deploy/schema.jar"/>
@@ -49,10 +44,6 @@
</target>
<target name="build">
- <!-- check buildenv.properties has been generated -->
- <available file="${buildenv-props}" property="${propfile-found}"/>
- <fail unless="${propfile-found}" message="Cannot load ${buildenv-props}"/>
-
<antcall target="compile.schema"/>
<mkdir dir="${classes}"/>
@@ -131,16 +122,6 @@
<filter token="PRODUCTION-EXEC-TASKDEFS" value=""/>
</filterset>
</copy>
- </target>
-
- <!-- javah -->
- <target name="native">
- <mkdir dir="${nativegendir}"/>
- <javah destdir="${nativegendir}" class="org.apache.beehive.test.tools.tch.test.NativeTest"/>
- </target>
-
- <target name="native.clean">
- <delete quiet="true" dir="${nativegendir}"/>
</target>
<target name="jar" depends="manifest-file.write">
Modified: beehive/trunk/controls/test/webapps/src/binding/BindingTests.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/webapps/src/binding/BindingTests.java?rev=399098&r1=399097&r2=399098&view=diff
==============================================================================
--- beehive/trunk/controls/test/webapps/src/binding/BindingTests.java (original)
+++ beehive/trunk/controls/test/webapps/src/binding/BindingTests.java Tue May 2 17:27:26 2006
@@ -50,19 +50,16 @@
@Jpf.Action
protected Forward testBindingOverride() {
- return new Forward(Report.RESULTS, Report.KEY, new
- Report(btc.getStatus()));
+ return new Forward(Report.RESULTS, Report.KEY, new Report(btc.getStatus()));
}
@Jpf.Action
protected Forward testDefaultBinding() {
- return new Forward(Report.RESULTS, Report.KEY, new
- Report(dbtc.getStatus()));
+ return new Forward(Report.RESULTS, Report.KEY, new Report(dbtc.getStatus()));
}
@Jpf.Action
protected Forward testExternalBinding() {
- return new Forward(Report.RESULTS, Report.KEY, new
- Report(ebtc.getStatus()));
+ return new Forward(Report.RESULTS, Report.KEY, new Report(ebtc.getStatus()));
}
}
Modified: beehive/trunk/controls/test/webapps/web/WEB-INF/web.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/webapps/web/WEB-INF/web.xml?rev=399098&r1=399097&r2=399098&view=diff
==============================================================================
--- beehive/trunk/controls/test/webapps/web/WEB-INF/web.xml (original)
+++ beehive/trunk/controls/test/webapps/web/WEB-INF/web.xml Tue May 2 17:27:26 2006
@@ -35,25 +35,11 @@
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
- <filter>
- <filter-name>ControlFilter</filter-name>
- <filter-class>org.apache.beehive.controls.runtime.servlet.ControlFilter</filter-class>
- </filter>
-
- <filter-mapping>
- <filter-name>ControlFilter</filter-name>
- <url-pattern>*.jws</url-pattern>
- </filter-mapping>
-
- <!-- Action Servlet Configuration (with debugging) -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.beehive.netui.pageflow.PageFlowActionServlet</servlet-class>
</servlet>
- <!-- Struts Action Servlet Mappings -->
- <!-- Note that because Struts takes the *last* mapping here as the extension to add to
- actions posted from forms, we must have *.do come after *.jpf. -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.jpf</url-pattern>