JBoss Portal SVN: r8537 - in modules/test/trunk/unit/src/main/org/jboss: unit/api/pojo/junit and 3 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-10-04 18:41:52 -0400 (Thu, 04 Oct 2007)
New Revision: 8537
Added:
modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestProvider.java
modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestProviderSupport.java
Removed:
modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestHandler.java
modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestHandlerSupport.java
Modified:
modules/test/trunk/unit/src/main/org/jboss/test/unit/pojo/TestHandlerSupportPOJOTest.java
modules/test/trunk/unit/src/main/org/jboss/test/unit/pojo/TestHandlerSupportPOJOTests.java
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitProvider.java
modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestCaseDef.java
modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/annotations/Provider.java
modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestSuiteDriver.java
Log:
renamed TestHandler -> TestProvider
Modified: modules/test/trunk/unit/src/main/org/jboss/test/unit/pojo/TestHandlerSupportPOJOTest.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/pojo/TestHandlerSupportPOJOTest.java 2007-10-04 22:40:54 UTC (rev 8536)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/pojo/TestHandlerSupportPOJOTest.java 2007-10-04 22:41:52 UTC (rev 8537)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.test.unit.pojo;
-import org.jboss.unit.spi.pojo.TestHandler;
+import org.jboss.unit.spi.pojo.TestProvider;
import org.jboss.unit.spi.pojo.TestCaseLifeCycleException;
import org.jboss.unit.spi.pojo.TestCaseDescriptor;
import org.jboss.unit.spi.pojo.TestCase;
@@ -40,38 +40,38 @@
{
/** . */
- private TestHandler handler;
+ private TestProvider provider;
- public TestHandlerSupportPOJOTest(TestHandler handler)
+ public TestHandlerSupportPOJOTest(TestProvider provider)
{
- this.handler = handler;
+ this.provider = provider;
}
public Set<String> getParameterNames()
{
- return handler.getDescriptor().getParameters().keySet();
+ return provider.getDescriptor().getParameters().keySet();
}
public Set<String> getTestCaseNames()
{
- return handler.getDescriptor().getTestCases().keySet();
+ return provider.getDescriptor().getTestCases().keySet();
}
public Set<String> getKeywords()
{
- return handler.getDescriptor().getKeywords();
+ return provider.getDescriptor().getKeywords();
}
public Set<String> getTestCaseKeywords(String testCaseName)
{
- TestCaseDescriptor descriptor = handler.getDescriptor().getTestCases().get(testCaseName);
+ TestCaseDescriptor descriptor = provider.getDescriptor().getTestCases().get(testCaseName);
assertNotNull(descriptor);
return descriptor.getKeywords();
}
public Set<String> getTestCaseParameterNames(String testCaseName)
{
- TestCaseDescriptor descriptor = handler.getDescriptor().getTestCases().get(testCaseName);
+ TestCaseDescriptor descriptor = provider.getDescriptor().getTestCases().get(testCaseName);
assertNotNull(descriptor);
return descriptor.getParameters().keySet();
}
@@ -82,11 +82,11 @@
boolean invokeDestroy = false;
try
{
- testCase = handler.getLifeCycle().newTestCase(testName);
- handler.getLifeCycle().testCaseParametrize(testCase, parametrization);
+ testCase = provider.getLifeCycle().newTestCase(testName);
+ provider.getLifeCycle().testCaseParametrize(testCase, parametrization);
invokeDestroy = true;
- handler.getLifeCycle().testCaseCreate(testCase);
- handler.getLifeCycle().testCaseInvoke(testCase);
+ provider.getLifeCycle().testCaseCreate(testCase);
+ provider.getLifeCycle().testCaseInvoke(testCase);
return InvokeResult.PASS;
}
catch (TestCaseLifeCycleException e)
@@ -105,7 +105,7 @@
{
if (invokeDestroy)
{
- handler.getLifeCycle().testCaseDestroy(testCase);
+ provider.getLifeCycle().testCaseDestroy(testCase);
}
}
}
Modified: modules/test/trunk/unit/src/main/org/jboss/test/unit/pojo/TestHandlerSupportPOJOTests.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/pojo/TestHandlerSupportPOJOTests.java 2007-10-04 22:40:54 UTC (rev 8536)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/pojo/TestHandlerSupportPOJOTests.java 2007-10-04 22:41:52 UTC (rev 8537)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.test.unit.pojo;
-import org.jboss.unit.spi.pojo.TestHandlerSupport;
+import org.jboss.unit.spi.pojo.TestProviderSupport;
import org.jboss.unit.api.Assert;
/**
@@ -37,7 +37,7 @@
{
try
{
- new TestHandlerSupport(clazz);
+ new TestProviderSupport(clazz);
Assert.fail();
}
catch (IllegalArgumentException expected)
@@ -47,6 +47,6 @@
protected AbstractPOJOTest assertCanBuildSuite(Class clazz)
{
- return new TestHandlerSupportPOJOTest(new TestHandlerSupport(clazz));
+ return new TestHandlerSupportPOJOTest(new TestProviderSupport(clazz));
}
}
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitProvider.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitProvider.java 2007-10-04 22:40:54 UTC (rev 8536)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitProvider.java 2007-10-04 22:41:52 UTC (rev 8537)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.unit.api.pojo.junit;
-import org.jboss.unit.spi.pojo.TestHandler;
+import org.jboss.unit.spi.pojo.TestProvider;
import org.jboss.unit.spi.pojo.TestSuiteDescriptor;
import org.jboss.unit.spi.pojo.TestLifeCycle;
@@ -32,7 +32,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class JUnitProvider implements TestHandler
+public class JUnitProvider implements TestProvider
{
/** . */
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestCaseDef.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestCaseDef.java 2007-10-04 22:40:54 UTC (rev 8536)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestCaseDef.java 2007-10-04 22:41:52 UTC (rev 8537)
@@ -36,7 +36,7 @@
{
/** . */
- TestHandlerSupport driver;
+ TestProviderSupport driver;
/** . */
final Method method;
Deleted: modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestHandler.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestHandler.java 2007-10-04 22:40:54 UTC (rev 8536)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestHandler.java 2007-10-04 22:41:52 UTC (rev 8537)
@@ -1,38 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.unit.spi.pojo;
-
-/**
- * Allow a pojo class to take care of providing its description and perform test case life cycle management.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public interface TestHandler
-{
-
- TestSuiteDescriptor getDescriptor();
-
- TestLifeCycle getLifeCycle();
-
-}
Deleted: modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestHandlerSupport.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestHandlerSupport.java 2007-10-04 22:40:54 UTC (rev 8536)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestHandlerSupport.java 2007-10-04 22:41:52 UTC (rev 8537)
@@ -1,597 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.unit.spi.pojo;
-
-import org.jboss.unit.api.pojo.annotations.Test;
-import org.jboss.unit.api.pojo.annotations.Parameter;
-import org.jboss.unit.api.pojo.annotations.Create;
-import org.jboss.unit.api.pojo.annotations.Destroy;
-import org.jboss.unit.api.pojo.annotations.Description;
-import org.jboss.unit.api.pojo.annotations.Tag;
-import org.jboss.unit.util.CollectionTools;
-
-import java.util.SortedMap;
-import java.util.TreeMap;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.Collections;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.AnnotatedElement;
-import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.annotation.Annotation;
-import java.beans.Introspector;
-
-/**
- * Provide a default implementation that relies on the annotation defined in the <code>annotations</code> package.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class TestHandlerSupport implements TestHandler, TestLifeCycle, TestSuiteDescriptor
-{
-
- /** . */
- private final String suiteName;
-
- /** . */
- private final String suiteDescription;
-
- /** . */
- private final Map<String, TestCaseDef> testCases;
-
- /** . */
- private final Method create;
-
- /** . */
- private final Method destroy;
-
- /** . */
- final Map<String, PropertyTestParameter> suiteParameters;
-
- /** . */
- private final Constructor ctor;
-
- /** . */
- private final Set<String> suiteKeywords;
-
- public TestHandlerSupport(Class testClass)
- {
- if (testClass == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- if (Modifier.isAbstract(testClass.getModifiers()))
- {
- throw new IllegalArgumentException("Test class is abstract");
- }
-
- // Check constructor
- Constructor ctor;
- try
- {
- ctor = testClass.getConstructor();
- }
- catch (NoSuchMethodException e)
- {
- throw new IllegalArgumentException(e);
- }
-
- //
- Test testAnnotation = ((AnnotatedElement)testClass).getAnnotation(Test.class);
- String suiteName = testAnnotation != null ? testAnnotation.name() : "";
- if (suiteName.length() == 0)
- {
- suiteName = testClass.getName();
- }
-
- //
- Description descriptionAnnotation = ((AnnotatedElement)testClass).getAnnotation(Description.class);
- String suiteDescription = descriptionAnnotation != null ? descriptionAnnotation.description() : "";
- if (suiteDescription.length() == 0)
- {
- suiteDescription = "Test of class " + testClass.getName();
- }
-
- Tag tag = ((AnnotatedElement)testClass).getAnnotation(Tag.class);
- Set<String> suiteKeywords = new HashSet<String>();
- if (tag != null)
- {
- suiteKeywords.addAll(CollectionTools.set(tag.value()));
- }
-
- //
- SortedMap<MethodKey, Method> methods = new TreeMap<MethodKey, Method>();
- for (Method method : testClass.getMethods())
- {
- MethodKey key = new MethodKey(method);
- methods.put(key, method);
- }
-
- //
- Map<String, PropertyTestParameter> suiteParameters = new HashMap<String, PropertyTestParameter>();
- Map<String, TestCaseDef> testCases = new HashMap<String, TestCaseDef>();
- Method create = null;
- Method destroy = null;
-
- // First pass for parameters and life cycle annotations
- for (Method method : methods.values())
- {
- String methodName = method.getName();
- int modifiers = method.getModifiers();
- Parameter parameterMethodAnnotation = method.getAnnotation(Parameter.class);
- Test testMethodAnnotation = method.getAnnotation(Test.class);
- Create createMethodAnnotation = method.getAnnotation(Create.class);
- Destroy destroyMethodAnnotation = method.getAnnotation(Destroy.class);
-
- //
- if (testMethodAnnotation != null && parameterMethodAnnotation != null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- if (createMethodAnnotation != null && parameterMethodAnnotation != null)
- {
- throw new IllegalArgumentException();
- }
- if (createMethodAnnotation != null && testMethodAnnotation != null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- if (destroyMethodAnnotation != null && parameterMethodAnnotation != null)
- {
- throw new IllegalArgumentException();
- }
- if (destroyMethodAnnotation != null && testMethodAnnotation != null)
- {
- throw new IllegalArgumentException();
- }
- if (destroyMethodAnnotation != null && createMethodAnnotation != null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- if (parameterMethodAnnotation != null)
- {
- if (!methodName.startsWith("set"))
- {
- throw new IllegalArgumentException();
- }
- if (methodName.length() < 4)
- {
- throw new IllegalArgumentException();
- }
- if (method.getParameterTypes().length != 1)
- {
- throw new IllegalArgumentException();
- }
- if (method.getReturnType() != void.class)
- {
- throw new IllegalArgumentException();
- }
- if (Modifier.isAbstract(modifiers))
- {
- throw new IllegalArgumentException();
- }
- if (!Modifier.isPublic(modifiers))
- {
- throw new IllegalArgumentException();
- }
- if (Modifier.isStatic(modifiers))
- {
- throw new IllegalArgumentException();
- }
-
- //
- String name = parameterMethodAnnotation.name();
- if (name.length() == 0)
- {
- name = Introspector.decapitalize(method.getName().substring(3));
- }
-
- //
- Description descriptionMethodAnnotation = method.getAnnotation(Description.class);
- String description = descriptionMethodAnnotation != null ? descriptionMethodAnnotation.description() : "";
- if (description.length() == 0)
- {
- description = "Parameter " + name;
- }
-
- //
- PropertyTestParameter parameter = suiteParameters.get(name);
- if (parameter == null)
- {
- parameter = new PropertyTestParameter(name, description);
- suiteParameters.put(name, parameter);
- }
-
- //
- parameter.addSetter(method);
- }
- else if (createMethodAnnotation != null)
- {
- if (create != null)
- {
- throw new IllegalArgumentException();
- }
- if (method.getReturnType() != void.class)
- {
- throw new IllegalArgumentException();
- }
- if (Modifier.isAbstract(modifiers))
- {
- throw new IllegalArgumentException();
- }
- if (!Modifier.isPublic(modifiers))
- {
- throw new IllegalArgumentException();
- }
- if (Modifier.isStatic(modifiers))
- {
- throw new IllegalArgumentException();
- }
- if (method.getParameterTypes().length > 0)
- {
- throw new IllegalArgumentException();
- }
-
- //
- create = method;
- }
- else if (destroyMethodAnnotation != null)
- {
- if (destroy != null)
- {
- throw new IllegalArgumentException();
- }
- if (method.getReturnType() != void.class)
- {
- throw new IllegalArgumentException();
- }
- if (Modifier.isAbstract(modifiers))
- {
- throw new IllegalArgumentException();
- }
- if (!Modifier.isPublic(modifiers))
- {
- throw new IllegalArgumentException();
- }
- if (Modifier.isStatic(modifiers))
- {
- throw new IllegalArgumentException();
- }
- if (method.getParameterTypes().length > 0)
- {
- throw new IllegalArgumentException();
- }
-
- //
- destroy = method;
- }
- }
-
- // Second pass for test annotations
- for (Method method : methods.values())
- {
- int modifiers = method.getModifiers();
- Test testMethodAnnotation = method.getAnnotation(Test.class);
-
- //
- if (testMethodAnnotation != null)
- {
- if (method.getReturnType() != void.class)
- {
- throw new IllegalArgumentException();
- }
- if (Modifier.isAbstract(modifiers))
- {
- throw new IllegalArgumentException();
- }
- if (!Modifier.isPublic(modifiers))
- {
- throw new IllegalArgumentException();
- }
- if (Modifier.isStatic(modifiers))
- {
- throw new IllegalArgumentException();
- }
-
- //
- LinkedHashMap<String, ArgumentTestParameter> methodParameters = new LinkedHashMap<String, ArgumentTestParameter>();
- for (Annotation[] parameterAnnotations : method.getParameterAnnotations())
- {
- Map<Class<? extends Annotation>,Annotation> parameterAnnotationMap = new HashMap<Class<? extends Annotation>, Annotation>();
- for (Annotation parameterAnnotation : parameterAnnotations)
- {
- Class<? extends Annotation> blah = parameterAnnotation.annotationType();
- parameterAnnotationMap.put(blah, parameterAnnotation);
- }
-
- //
- Parameter argumentParameterAnnotation = (Parameter)parameterAnnotationMap.get(Parameter.class);
-
- //
- if (argumentParameterAnnotation != null)
- {
- //
- String name = argumentParameterAnnotation.name();
- if (name.length() == 0)
- {
- throw new IllegalArgumentException();
- }
- if (methodParameters.containsKey(name))
- {
- throw new IllegalArgumentException();
- }
-
- //
- Description descriptionArgumentParameterAnnotation = (Description)parameterAnnotationMap.get(Description.class);
- String description = descriptionArgumentParameterAnnotation != null ? descriptionArgumentParameterAnnotation.description() : "";
- if (description.length() == 0)
- {
- description = "Method parameter " + name;
- }
-
- //
- methodParameters.put(name, new ArgumentTestParameter(name, description));
- }
- else
- {
- throw new IllegalArgumentException();
- }
- }
-
- //
- String name = testMethodAnnotation.name();
- if (testMethodAnnotation.name().length() == 0)
- {
- name = method.getName();
- }
-
- //
- Description descriptionMethodAnnotation = method.getAnnotation(Description.class);
- String description = descriptionMethodAnnotation != null ? descriptionMethodAnnotation.description() : "";
- if (description.length() == 0)
- {
- description = "Test of method " + method.getName();
- }
-
- //
- Set<String> keywords = new HashSet<String>();
- Tag tagMethodAnnotation = method.getAnnotation(Tag.class);
- if (tagMethodAnnotation != null)
- {
- keywords.addAll(CollectionTools.set(tagMethodAnnotation.value()));
- }
-
- Map<String,TestParameter> parameters = new HashMap<String, TestParameter>(suiteParameters);
- parameters.putAll(methodParameters);
-
- //
- TestCaseDef testCaseDef = new TestCaseDef(method, name, description, parameters, methodParameters, keywords);
-
- //
- if (testCases.put(testCaseDef.getName(), testCaseDef) != null)
- {
- throw new IllegalArgumentException();
- }
- }
- }
-
- //
- this.suiteName = suiteName;
- this.suiteDescription = suiteDescription;
- this.suiteKeywords = suiteKeywords;
- this.suiteParameters = suiteParameters;
- this.testCases = testCases;
- this.ctor = ctor;
- this.create = create;
- this.destroy = destroy;
- }
-
- public TestSuiteDescriptor getDescriptor()
- {
- return this;
- }
-
- public TestLifeCycle getLifeCycle()
- {
- return this;
- }
-
- public String getName()
- {
- return suiteName;
- }
-
- public String getDescription()
- {
- return suiteDescription;
- }
-
- public Set<String> getKeywords()
- {
- return suiteKeywords;
- }
-
- public Map<String, ? extends ParameterDescriptor> getParameters()
- {
- return Collections.unmodifiableMap(suiteParameters);
- }
-
- public Map<String, ? extends TestCaseDescriptor> getTestCases()
- {
- return Collections.unmodifiableMap(testCases);
- }
-
- public TestCase newTestCase(String name) throws TestCaseLifeCycleException
- {
- TestCaseDef testCaseDef = testCases.get(name);
-
- //
- if (testCaseDef == null)
- {
- throw new TestCaseLifeCycleException("No such test case <" + name + ">");
- }
-
- //
- Object instance;
- try
- {
- instance = ctor.newInstance();
- }
- catch (InvocationTargetException e)
- {
- throw new TestCaseLifeCycleException("Cannot create test case " + name, e.getCause());
- }
- catch (Exception e)
- {
- throw new TestCaseLifeCycleException("Cannot configure parameter " + name, e);
- }
-
- //
- return new TestCaseImpl(testCaseDef, instance);
- }
-
- public void testCaseParametrize(TestCase _testCase, Map<String,String> parametrization) throws TestCaseLifeCycleException
- {
- TestCaseImpl testCase = (TestCaseImpl)_testCase;
-
- // Save parametrization
- testCase.parametrization = parametrization;
-
- //
- for (PropertyTestParameter parameter : suiteParameters.values())
- {
- if (!parametrization.containsKey(parameter.getName()))
- {
- throw new TestCaseLifeCycleException("Missing parameter " + parameter.getName());
- }
- String parameterValue = parametrization.get(parameter.getName());
- for (Method setter : parameter.setters)
- {
- try
- {
- setter.invoke(testCase.pojo, parameterValue);
- }
- catch (InvocationTargetException e)
- {
- throw new TestCaseLifeCycleException("Cannot configure parameter " + parameter.getName(), e.getCause());
- }
- catch (Exception e)
- {
- throw new TestCaseLifeCycleException("Cannot configure parameter " + parameter.getName(), e);
- }
- }
- }
- }
-
- public void testCaseCreate(TestCase _testCase) throws TestCaseLifeCycleException
- {
- TestCaseImpl testCase = (TestCaseImpl)_testCase;
-
- //
- if (create != null)
- {
- try
- {
- create.invoke(testCase.getPOJO());
- }
- catch (InvocationTargetException e)
- {
- throw new TestCaseLifeCycleException("Cannot create test case", e.getCause());
- }
- catch (Exception e)
- {
- throw new TestCaseLifeCycleException("Cannot create test case", e);
- }
- }
- }
-
- public void testCaseInvoke(TestCase _testCase) throws TestCaseLifeCycleException
- {
- TestCaseImpl testCase = (TestCaseImpl)_testCase;
-
- List<Object> argList = new ArrayList<Object>();
- for (String parameterName : testCase.def.arguments.keySet())
- {
- if (!testCase.parametrization.containsKey(parameterName))
- {
- throw new TestCaseLifeCycleException("Missing parameter " + parameterName);
- }
- String parameterValue = testCase.parametrization.get(parameterName);
- if (parameterValue == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- argList.add(parameterValue);
- }
- Object[] args = argList.toArray();
-
- try
- {
- testCase.def.method.invoke(testCase.pojo, args);
- }
- catch (InvocationTargetException e)
- {
- throw new TestCaseLifeCycleException("Cannot invoke test case", e.getCause());
- }
- catch (Exception e)
- {
- throw new TestCaseLifeCycleException("Cannot invoke test case", e);
- }
- }
-
- public void testCaseDestroy(TestCase _testCase)
- {
- TestCaseImpl testCase = (TestCaseImpl)_testCase;
-
- //
- if (destroy != null)
- {
- try
- {
- destroy.invoke(testCase.getPOJO());
- }
- catch (Throwable t)
- {
- // Log this as a warn
- // t.printStackTrace();
- }
- }
- }
-}
Copied: modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestProvider.java (from rev 8536, modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestHandler.java)
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestProvider.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestProvider.java 2007-10-04 22:41:52 UTC (rev 8537)
@@ -0,0 +1,38 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.unit.spi.pojo;
+
+/**
+ * Allow a pojo class to take care of providing its description and perform test case life cycle management.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface TestProvider
+{
+
+ TestSuiteDescriptor getDescriptor();
+
+ TestLifeCycle getLifeCycle();
+
+}
Copied: modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestProviderSupport.java (from rev 8536, modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestHandlerSupport.java)
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestProviderSupport.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestProviderSupport.java 2007-10-04 22:41:52 UTC (rev 8537)
@@ -0,0 +1,597 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.unit.spi.pojo;
+
+import org.jboss.unit.api.pojo.annotations.Test;
+import org.jboss.unit.api.pojo.annotations.Parameter;
+import org.jboss.unit.api.pojo.annotations.Create;
+import org.jboss.unit.api.pojo.annotations.Destroy;
+import org.jboss.unit.api.pojo.annotations.Description;
+import org.jboss.unit.api.pojo.annotations.Tag;
+import org.jboss.unit.util.CollectionTools;
+
+import java.util.SortedMap;
+import java.util.TreeMap;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Collections;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.annotation.Annotation;
+import java.beans.Introspector;
+
+/**
+ * Provide a default implementation that relies on the annotation defined in the <code>annotations</code> package.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestProviderSupport implements TestProvider, TestLifeCycle, TestSuiteDescriptor
+{
+
+ /** . */
+ private final String suiteName;
+
+ /** . */
+ private final String suiteDescription;
+
+ /** . */
+ private final Map<String, TestCaseDef> testCases;
+
+ /** . */
+ private final Method create;
+
+ /** . */
+ private final Method destroy;
+
+ /** . */
+ final Map<String, PropertyTestParameter> suiteParameters;
+
+ /** . */
+ private final Constructor ctor;
+
+ /** . */
+ private final Set<String> suiteKeywords;
+
+ public TestProviderSupport(Class testClass)
+ {
+ if (testClass == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ if (Modifier.isAbstract(testClass.getModifiers()))
+ {
+ throw new IllegalArgumentException("Test class is abstract");
+ }
+
+ // Check constructor
+ Constructor ctor;
+ try
+ {
+ ctor = testClass.getConstructor();
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new IllegalArgumentException(e);
+ }
+
+ //
+ Test testAnnotation = ((AnnotatedElement)testClass).getAnnotation(Test.class);
+ String suiteName = testAnnotation != null ? testAnnotation.name() : "";
+ if (suiteName.length() == 0)
+ {
+ suiteName = testClass.getName();
+ }
+
+ //
+ Description descriptionAnnotation = ((AnnotatedElement)testClass).getAnnotation(Description.class);
+ String suiteDescription = descriptionAnnotation != null ? descriptionAnnotation.description() : "";
+ if (suiteDescription.length() == 0)
+ {
+ suiteDescription = "Test of class " + testClass.getName();
+ }
+
+ Tag tag = ((AnnotatedElement)testClass).getAnnotation(Tag.class);
+ Set<String> suiteKeywords = new HashSet<String>();
+ if (tag != null)
+ {
+ suiteKeywords.addAll(CollectionTools.set(tag.value()));
+ }
+
+ //
+ SortedMap<MethodKey, Method> methods = new TreeMap<MethodKey, Method>();
+ for (Method method : testClass.getMethods())
+ {
+ MethodKey key = new MethodKey(method);
+ methods.put(key, method);
+ }
+
+ //
+ Map<String, PropertyTestParameter> suiteParameters = new HashMap<String, PropertyTestParameter>();
+ Map<String, TestCaseDef> testCases = new HashMap<String, TestCaseDef>();
+ Method create = null;
+ Method destroy = null;
+
+ // First pass for parameters and life cycle annotations
+ for (Method method : methods.values())
+ {
+ String methodName = method.getName();
+ int modifiers = method.getModifiers();
+ Parameter parameterMethodAnnotation = method.getAnnotation(Parameter.class);
+ Test testMethodAnnotation = method.getAnnotation(Test.class);
+ Create createMethodAnnotation = method.getAnnotation(Create.class);
+ Destroy destroyMethodAnnotation = method.getAnnotation(Destroy.class);
+
+ //
+ if (testMethodAnnotation != null && parameterMethodAnnotation != null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ if (createMethodAnnotation != null && parameterMethodAnnotation != null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (createMethodAnnotation != null && testMethodAnnotation != null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ if (destroyMethodAnnotation != null && parameterMethodAnnotation != null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (destroyMethodAnnotation != null && testMethodAnnotation != null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (destroyMethodAnnotation != null && createMethodAnnotation != null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ if (parameterMethodAnnotation != null)
+ {
+ if (!methodName.startsWith("set"))
+ {
+ throw new IllegalArgumentException();
+ }
+ if (methodName.length() < 4)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (method.getParameterTypes().length != 1)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (method.getReturnType() != void.class)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (Modifier.isAbstract(modifiers))
+ {
+ throw new IllegalArgumentException();
+ }
+ if (!Modifier.isPublic(modifiers))
+ {
+ throw new IllegalArgumentException();
+ }
+ if (Modifier.isStatic(modifiers))
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ String name = parameterMethodAnnotation.name();
+ if (name.length() == 0)
+ {
+ name = Introspector.decapitalize(method.getName().substring(3));
+ }
+
+ //
+ Description descriptionMethodAnnotation = method.getAnnotation(Description.class);
+ String description = descriptionMethodAnnotation != null ? descriptionMethodAnnotation.description() : "";
+ if (description.length() == 0)
+ {
+ description = "Parameter " + name;
+ }
+
+ //
+ PropertyTestParameter parameter = suiteParameters.get(name);
+ if (parameter == null)
+ {
+ parameter = new PropertyTestParameter(name, description);
+ suiteParameters.put(name, parameter);
+ }
+
+ //
+ parameter.addSetter(method);
+ }
+ else if (createMethodAnnotation != null)
+ {
+ if (create != null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (method.getReturnType() != void.class)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (Modifier.isAbstract(modifiers))
+ {
+ throw new IllegalArgumentException();
+ }
+ if (!Modifier.isPublic(modifiers))
+ {
+ throw new IllegalArgumentException();
+ }
+ if (Modifier.isStatic(modifiers))
+ {
+ throw new IllegalArgumentException();
+ }
+ if (method.getParameterTypes().length > 0)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ create = method;
+ }
+ else if (destroyMethodAnnotation != null)
+ {
+ if (destroy != null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (method.getReturnType() != void.class)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (Modifier.isAbstract(modifiers))
+ {
+ throw new IllegalArgumentException();
+ }
+ if (!Modifier.isPublic(modifiers))
+ {
+ throw new IllegalArgumentException();
+ }
+ if (Modifier.isStatic(modifiers))
+ {
+ throw new IllegalArgumentException();
+ }
+ if (method.getParameterTypes().length > 0)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ destroy = method;
+ }
+ }
+
+ // Second pass for test annotations
+ for (Method method : methods.values())
+ {
+ int modifiers = method.getModifiers();
+ Test testMethodAnnotation = method.getAnnotation(Test.class);
+
+ //
+ if (testMethodAnnotation != null)
+ {
+ if (method.getReturnType() != void.class)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (Modifier.isAbstract(modifiers))
+ {
+ throw new IllegalArgumentException();
+ }
+ if (!Modifier.isPublic(modifiers))
+ {
+ throw new IllegalArgumentException();
+ }
+ if (Modifier.isStatic(modifiers))
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ LinkedHashMap<String, ArgumentTestParameter> methodParameters = new LinkedHashMap<String, ArgumentTestParameter>();
+ for (Annotation[] parameterAnnotations : method.getParameterAnnotations())
+ {
+ Map<Class<? extends Annotation>,Annotation> parameterAnnotationMap = new HashMap<Class<? extends Annotation>, Annotation>();
+ for (Annotation parameterAnnotation : parameterAnnotations)
+ {
+ Class<? extends Annotation> blah = parameterAnnotation.annotationType();
+ parameterAnnotationMap.put(blah, parameterAnnotation);
+ }
+
+ //
+ Parameter argumentParameterAnnotation = (Parameter)parameterAnnotationMap.get(Parameter.class);
+
+ //
+ if (argumentParameterAnnotation != null)
+ {
+ //
+ String name = argumentParameterAnnotation.name();
+ if (name.length() == 0)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (methodParameters.containsKey(name))
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ Description descriptionArgumentParameterAnnotation = (Description)parameterAnnotationMap.get(Description.class);
+ String description = descriptionArgumentParameterAnnotation != null ? descriptionArgumentParameterAnnotation.description() : "";
+ if (description.length() == 0)
+ {
+ description = "Method parameter " + name;
+ }
+
+ //
+ methodParameters.put(name, new ArgumentTestParameter(name, description));
+ }
+ else
+ {
+ throw new IllegalArgumentException();
+ }
+ }
+
+ //
+ String name = testMethodAnnotation.name();
+ if (testMethodAnnotation.name().length() == 0)
+ {
+ name = method.getName();
+ }
+
+ //
+ Description descriptionMethodAnnotation = method.getAnnotation(Description.class);
+ String description = descriptionMethodAnnotation != null ? descriptionMethodAnnotation.description() : "";
+ if (description.length() == 0)
+ {
+ description = "Test of method " + method.getName();
+ }
+
+ //
+ Set<String> keywords = new HashSet<String>();
+ Tag tagMethodAnnotation = method.getAnnotation(Tag.class);
+ if (tagMethodAnnotation != null)
+ {
+ keywords.addAll(CollectionTools.set(tagMethodAnnotation.value()));
+ }
+
+ Map<String,TestParameter> parameters = new HashMap<String, TestParameter>(suiteParameters);
+ parameters.putAll(methodParameters);
+
+ //
+ TestCaseDef testCaseDef = new TestCaseDef(method, name, description, parameters, methodParameters, keywords);
+
+ //
+ if (testCases.put(testCaseDef.getName(), testCaseDef) != null)
+ {
+ throw new IllegalArgumentException();
+ }
+ }
+ }
+
+ //
+ this.suiteName = suiteName;
+ this.suiteDescription = suiteDescription;
+ this.suiteKeywords = suiteKeywords;
+ this.suiteParameters = suiteParameters;
+ this.testCases = testCases;
+ this.ctor = ctor;
+ this.create = create;
+ this.destroy = destroy;
+ }
+
+ public TestSuiteDescriptor getDescriptor()
+ {
+ return this;
+ }
+
+ public TestLifeCycle getLifeCycle()
+ {
+ return this;
+ }
+
+ public String getName()
+ {
+ return suiteName;
+ }
+
+ public String getDescription()
+ {
+ return suiteDescription;
+ }
+
+ public Set<String> getKeywords()
+ {
+ return suiteKeywords;
+ }
+
+ public Map<String, ? extends ParameterDescriptor> getParameters()
+ {
+ return Collections.unmodifiableMap(suiteParameters);
+ }
+
+ public Map<String, ? extends TestCaseDescriptor> getTestCases()
+ {
+ return Collections.unmodifiableMap(testCases);
+ }
+
+ public TestCase newTestCase(String name) throws TestCaseLifeCycleException
+ {
+ TestCaseDef testCaseDef = testCases.get(name);
+
+ //
+ if (testCaseDef == null)
+ {
+ throw new TestCaseLifeCycleException("No such test case <" + name + ">");
+ }
+
+ //
+ Object instance;
+ try
+ {
+ instance = ctor.newInstance();
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new TestCaseLifeCycleException("Cannot create test case " + name, e.getCause());
+ }
+ catch (Exception e)
+ {
+ throw new TestCaseLifeCycleException("Cannot configure parameter " + name, e);
+ }
+
+ //
+ return new TestCaseImpl(testCaseDef, instance);
+ }
+
+ public void testCaseParametrize(TestCase _testCase, Map<String,String> parametrization) throws TestCaseLifeCycleException
+ {
+ TestCaseImpl testCase = (TestCaseImpl)_testCase;
+
+ // Save parametrization
+ testCase.parametrization = parametrization;
+
+ //
+ for (PropertyTestParameter parameter : suiteParameters.values())
+ {
+ if (!parametrization.containsKey(parameter.getName()))
+ {
+ throw new TestCaseLifeCycleException("Missing parameter " + parameter.getName());
+ }
+ String parameterValue = parametrization.get(parameter.getName());
+ for (Method setter : parameter.setters)
+ {
+ try
+ {
+ setter.invoke(testCase.pojo, parameterValue);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new TestCaseLifeCycleException("Cannot configure parameter " + parameter.getName(), e.getCause());
+ }
+ catch (Exception e)
+ {
+ throw new TestCaseLifeCycleException("Cannot configure parameter " + parameter.getName(), e);
+ }
+ }
+ }
+ }
+
+ public void testCaseCreate(TestCase _testCase) throws TestCaseLifeCycleException
+ {
+ TestCaseImpl testCase = (TestCaseImpl)_testCase;
+
+ //
+ if (create != null)
+ {
+ try
+ {
+ create.invoke(testCase.getPOJO());
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new TestCaseLifeCycleException("Cannot create test case", e.getCause());
+ }
+ catch (Exception e)
+ {
+ throw new TestCaseLifeCycleException("Cannot create test case", e);
+ }
+ }
+ }
+
+ public void testCaseInvoke(TestCase _testCase) throws TestCaseLifeCycleException
+ {
+ TestCaseImpl testCase = (TestCaseImpl)_testCase;
+
+ List<Object> argList = new ArrayList<Object>();
+ for (String parameterName : testCase.def.arguments.keySet())
+ {
+ if (!testCase.parametrization.containsKey(parameterName))
+ {
+ throw new TestCaseLifeCycleException("Missing parameter " + parameterName);
+ }
+ String parameterValue = testCase.parametrization.get(parameterName);
+ if (parameterValue == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ argList.add(parameterValue);
+ }
+ Object[] args = argList.toArray();
+
+ try
+ {
+ testCase.def.method.invoke(testCase.pojo, args);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new TestCaseLifeCycleException("Cannot invoke test case", e.getCause());
+ }
+ catch (Exception e)
+ {
+ throw new TestCaseLifeCycleException("Cannot invoke test case", e);
+ }
+ }
+
+ public void testCaseDestroy(TestCase _testCase)
+ {
+ TestCaseImpl testCase = (TestCaseImpl)_testCase;
+
+ //
+ if (destroy != null)
+ {
+ try
+ {
+ destroy.invoke(testCase.getPOJO());
+ }
+ catch (Throwable t)
+ {
+ // Log this as a warn
+ // t.printStackTrace();
+ }
+ }
+ }
+}
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/annotations/Provider.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/annotations/Provider.java 2007-10-04 22:40:54 UTC (rev 8536)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/annotations/Provider.java 2007-10-04 22:41:52 UTC (rev 8537)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.unit.spi.pojo.annotations;
-import org.jboss.unit.spi.pojo.TestHandler;
+import org.jboss.unit.spi.pojo.TestProvider;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
@@ -39,5 +39,5 @@
@Target({ElementType.ANNOTATION_TYPE,ElementType.TYPE})
public @interface Provider
{
- Class<? extends TestHandler> value();
+ Class<? extends TestProvider> value();
}
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestSuiteDriver.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestSuiteDriver.java 2007-10-04 22:40:54 UTC (rev 8536)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestSuiteDriver.java 2007-10-04 22:41:52 UTC (rev 8537)
@@ -22,8 +22,8 @@
******************************************************************************/
package org.jboss.unit.unit.pojo;
-import org.jboss.unit.spi.pojo.TestHandler;
-import org.jboss.unit.spi.pojo.TestHandlerSupport;
+import org.jboss.unit.spi.pojo.TestProvider;
+import org.jboss.unit.spi.pojo.TestProviderSupport;
import org.jboss.unit.spi.pojo.TestCaseLifeCycleException;
import org.jboss.unit.spi.pojo.TestLifeCycle;
import org.jboss.unit.spi.pojo.TestCase;
@@ -53,7 +53,7 @@
{
/** . */
- private TestHandler handler;
+ private TestProvider provider;
/** . */
private TestSuiteInfo info;
@@ -81,9 +81,9 @@
{
try
{
- Class<? extends TestHandler> providerClass = provider.value();
- Constructor<? extends TestHandler> providerCtor = providerClass.getConstructor(Class.class);
- handler = providerCtor.newInstance(testClass);
+ Class<? extends TestProvider> providerClass = provider.value();
+ Constructor<? extends TestProvider> providerCtor = providerClass.getConstructor(Class.class);
+ this.provider = providerCtor.newInstance(testClass);
}
catch (NoSuchMethodException e)
{
@@ -100,11 +100,11 @@
// }
else
{
- handler = new TestHandlerSupport(testClass);
+ this.provider = new TestProviderSupport(testClass);
}
//
- info = new POJOTestSuiteInfo(handler.getDescriptor());
+ info = new POJOTestSuiteInfo(this.provider.getDescriptor());
}
public TestInfo getInfo()
@@ -125,7 +125,7 @@
}
//
- TestLifeCycle lifeCycle = handler.getLifeCycle();
+ TestLifeCycle lifeCycle = provider.getLifeCycle();
//
String name = id.getName(0);
16 years, 8 months
JBoss Portal SVN: r8536 - in modules/test/trunk/unit/src/main/org/jboss: unit and 7 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-10-04 18:40:54 -0400 (Thu, 04 Oct 2007)
New Revision: 8536
Added:
modules/test/trunk/unit/src/main/org/jboss/unit/spi/
modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/
modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/ArgumentTestParameter.java
modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/MethodKey.java
modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/ParameterDescriptor.java
modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/PropertyTestParameter.java
modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestCase.java
modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestCaseDef.java
modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestCaseDescriptor.java
modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestCaseImpl.java
modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestCaseLifeCycleException.java
modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestHandler.java
modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestHandlerSupport.java
modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestLifeCycle.java
modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestParameter.java
modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestSuiteDescriptor.java
modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/annotations/
modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/annotations/Provider.java
Removed:
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/ArgumentTestParameter.java
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/MethodKey.java
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/ParameterDescriptor.java
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/PropertyTestParameter.java
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCase.java
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCaseDef.java
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCaseDescriptor.java
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCaseImpl.java
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCaseLifeCycleException.java
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestHandler.java
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestHandlerSupport.java
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestLifeCycle.java
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestParameter.java
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestSuiteDescriptor.java
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/annotations/Provider.java
Modified:
modules/test/trunk/unit/src/main/org/jboss/test/unit/pojo/TestHandlerSupportPOJOTest.java
modules/test/trunk/unit/src/main/org/jboss/test/unit/pojo/TestHandlerSupportPOJOTests.java
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitDescriptor.java
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitLifeCycle.java
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitProvider.java
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitTestMethod.java
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitTestMethodLifeCycle.java
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/TestCase.java
modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOParameterInfo.java
modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestCaseInfo.java
modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestInfo.java
modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestSuiteDriver.java
modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestSuiteInfo.java
Log:
moved integration code from api package to new spi package
Modified: modules/test/trunk/unit/src/main/org/jboss/test/unit/pojo/TestHandlerSupportPOJOTest.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/pojo/TestHandlerSupportPOJOTest.java 2007-10-04 22:24:45 UTC (rev 8535)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/pojo/TestHandlerSupportPOJOTest.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -22,10 +22,10 @@
******************************************************************************/
package org.jboss.test.unit.pojo;
-import org.jboss.unit.api.pojo.TestHandler;
-import org.jboss.unit.api.pojo.TestCaseLifeCycleException;
-import org.jboss.unit.api.pojo.TestCaseDescriptor;
-import org.jboss.unit.api.pojo.TestCase;
+import org.jboss.unit.spi.pojo.TestHandler;
+import org.jboss.unit.spi.pojo.TestCaseLifeCycleException;
+import org.jboss.unit.spi.pojo.TestCaseDescriptor;
+import org.jboss.unit.spi.pojo.TestCase;
import static org.jboss.unit.api.Assert.*;
Modified: modules/test/trunk/unit/src/main/org/jboss/test/unit/pojo/TestHandlerSupportPOJOTests.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/pojo/TestHandlerSupportPOJOTests.java 2007-10-04 22:24:45 UTC (rev 8535)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/pojo/TestHandlerSupportPOJOTests.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.test.unit.pojo;
-import org.jboss.unit.api.pojo.TestHandlerSupport;
+import org.jboss.unit.spi.pojo.TestHandlerSupport;
import org.jboss.unit.api.Assert;
/**
Deleted: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/ArgumentTestParameter.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/ArgumentTestParameter.java 2007-10-04 22:24:45 UTC (rev 8535)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/ArgumentTestParameter.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -1,35 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.unit.api.pojo;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-class ArgumentTestParameter extends TestParameter
-{
- public ArgumentTestParameter(String name, String description)
- {
- super(name, description);
- }
-}
Deleted: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/MethodKey.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/MethodKey.java 2007-10-04 22:24:45 UTC (rev 8535)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/MethodKey.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -1,101 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.unit.api.pojo;
-
-import java.util.List;
-import java.util.ArrayList;
-import java.lang.reflect.Method;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-class MethodKey implements Comparable
-{
-
- /** . */
- private String name;
-
- /** . */
- private List<String> types;
-
- MethodKey(Method method)
- {
- List<String> types = new ArrayList<String>();
- for (Class type : method.getParameterTypes())
- {
- types.add(type.getName());
- }
-
- this.name = method.getName();
- this.types = types;
- }
-
- public int hashCode()
- {
- return name.hashCode() + types.hashCode();
- }
-
- public boolean equals(Object object)
- {
- if (object == this)
- {
- return true;
- }
- if (object instanceof MethodKey)
- {
- MethodKey that = (MethodKey)object;
- return that.name.equals(this.name) && that.types.equals(this.types);
- }
- return false;
- }
-
- public int compareTo(Object o)
- {
- MethodKey that = (MethodKey)o;
-
- //
- int sign = name.compareTo(that.name);
- if (sign != 0)
- {
- return sign;
- }
-
- //
- for (int index = 0;index < this.types.size() && index < that.types.size();index++)
- {
- String thisName = this.types.get(index);
- String thatName = that.types.get(index);
-
- //
- int order = thisName.compareTo(thatName);
- if (order != 0)
- {
- return order;
- }
- }
-
- //
- return that.types.size() - this.types.size();
- }
-}
Deleted: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/ParameterDescriptor.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/ParameterDescriptor.java 2007-10-04 22:24:45 UTC (rev 8535)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/ParameterDescriptor.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -1,41 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.unit.api.pojo;
-
-import java.util.List;
-
-/**
- * An object describing a parameter.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public interface ParameterDescriptor
-{
-
- String getName();
-
- String getDescription();
-
- List<String> getDefaultValues();
-}
Deleted: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/PropertyTestParameter.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/PropertyTestParameter.java 2007-10-04 22:24:45 UTC (rev 8535)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/PropertyTestParameter.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -1,48 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.unit.api.pojo;
-
-import java.lang.reflect.Method;
-import java.util.List;
-import java.util.ArrayList;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-class PropertyTestParameter extends TestParameter
-{
-
- /** . */
- final List<Method> setters = new ArrayList<Method>();
-
- public PropertyTestParameter(String name, String description)
- {
- super(name, description);
- }
-
- void addSetter(Method setter)
- {
- setters.add(setter);
- }
-}
Deleted: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCase.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCase.java 2007-10-04 22:24:45 UTC (rev 8535)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCase.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -1,32 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.unit.api.pojo;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public interface TestCase
-{
- Object getPOJO();
-}
Deleted: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCaseDef.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCaseDef.java 2007-10-04 22:24:45 UTC (rev 8535)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCaseDef.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -1,95 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.unit.api.pojo;
-
-import java.lang.reflect.Method;
-import java.util.LinkedHashMap;
-import java.util.Set;
-import java.util.Map;
-import java.util.Collections;
-import java.util.HashMap;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-class TestCaseDef implements TestCaseDescriptor
-{
-
- /** . */
- TestHandlerSupport driver;
-
- /** . */
- final Method method;
-
- /** . */
- final String name;
-
- /** . */
- final String description;
-
- /** . */
- final LinkedHashMap<String,ArgumentTestParameter> arguments;
-
- /** . */
- final Map<String,TestParameter> parameters;
-
- /** . */
- final Set<String> keywords;
-
- TestCaseDef(
- Method method,
- String name,
- String description,
- Map<String, TestParameter> parameters,
- LinkedHashMap<String, ArgumentTestParameter> arguments,
- Set<String> keywords)
- {
- this.method = method;
- this.name = name;
- this.description = description;
- this.arguments = arguments;
- this.parameters = parameters;
- this.keywords = keywords;
- }
-
- public String getName()
- {
- return name;
- }
-
- public String getDescription()
- {
- return description;
- }
-
- public Map<String, ? extends ParameterDescriptor> getParameters()
- {
- return Collections.unmodifiableMap(parameters);
- }
-
- public Set<String> getKeywords()
- {
- return Collections.unmodifiableSet(keywords);
- }
-}
Deleted: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCaseDescriptor.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCaseDescriptor.java 2007-10-04 22:24:45 UTC (rev 8535)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCaseDescriptor.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -1,42 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.unit.api.pojo;
-
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public interface TestCaseDescriptor
-{
-
- String getName();
-
- String getDescription();
-
- Map<String, ? extends ParameterDescriptor> getParameters();
-
- Set<String> getKeywords();
-}
Deleted: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCaseImpl.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCaseImpl.java 2007-10-04 22:24:45 UTC (rev 8535)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCaseImpl.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -1,52 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.unit.api.pojo;
-
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-class TestCaseImpl implements TestCase
-{
-
- final TestCaseDef def;
-
- /** . */
- final Object pojo;
-
- /** . */
- Map<String,String> parametrization;
-
- public TestCaseImpl(TestCaseDef def, Object pojo)
- {
- this.def = def;
- this.pojo = pojo;
- }
-
- public Object getPOJO()
- {
- return pojo;
- }
-}
Deleted: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCaseLifeCycleException.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCaseLifeCycleException.java 2007-10-04 22:24:45 UTC (rev 8535)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCaseLifeCycleException.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -1,49 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.unit.api.pojo;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class TestCaseLifeCycleException extends Exception
-{
- public TestCaseLifeCycleException()
- {
- }
-
- public TestCaseLifeCycleException(String string)
- {
- super(string);
- }
-
- public TestCaseLifeCycleException(String string, Throwable throwable)
- {
- super(string, throwable);
- }
-
- public TestCaseLifeCycleException(Throwable throwable)
- {
- super(throwable);
- }
-}
Deleted: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestHandler.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestHandler.java 2007-10-04 22:24:45 UTC (rev 8535)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestHandler.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -1,38 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.unit.api.pojo;
-
-/**
- * Allow a pojo class to take care of providing its description and perform test case life cycle management.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public interface TestHandler
-{
-
- TestSuiteDescriptor getDescriptor();
-
- TestLifeCycle getLifeCycle();
-
-}
Deleted: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestHandlerSupport.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestHandlerSupport.java 2007-10-04 22:24:45 UTC (rev 8535)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestHandlerSupport.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -1,597 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.unit.api.pojo;
-
-import org.jboss.unit.api.pojo.annotations.Test;
-import org.jboss.unit.api.pojo.annotations.Parameter;
-import org.jboss.unit.api.pojo.annotations.Create;
-import org.jboss.unit.api.pojo.annotations.Destroy;
-import org.jboss.unit.api.pojo.annotations.Description;
-import org.jboss.unit.api.pojo.annotations.Tag;
-import org.jboss.unit.util.CollectionTools;
-
-import java.util.SortedMap;
-import java.util.TreeMap;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.Collections;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.AnnotatedElement;
-import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.annotation.Annotation;
-import java.beans.Introspector;
-
-/**
- * Provide a default implementation that relies on the annotation defined in the <code>annotations</code> package.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class TestHandlerSupport implements TestHandler, TestLifeCycle, TestSuiteDescriptor
-{
-
- /** . */
- private final String suiteName;
-
- /** . */
- private final String suiteDescription;
-
- /** . */
- private final Map<String, TestCaseDef> testCases;
-
- /** . */
- private final Method create;
-
- /** . */
- private final Method destroy;
-
- /** . */
- final Map<String, PropertyTestParameter> suiteParameters;
-
- /** . */
- private final Constructor ctor;
-
- /** . */
- private final Set<String> suiteKeywords;
-
- public TestHandlerSupport(Class testClass)
- {
- if (testClass == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- if (Modifier.isAbstract(testClass.getModifiers()))
- {
- throw new IllegalArgumentException("Test class is abstract");
- }
-
- // Check constructor
- Constructor ctor;
- try
- {
- ctor = testClass.getConstructor();
- }
- catch (NoSuchMethodException e)
- {
- throw new IllegalArgumentException(e);
- }
-
- //
- Test testAnnotation = ((AnnotatedElement)testClass).getAnnotation(Test.class);
- String suiteName = testAnnotation != null ? testAnnotation.name() : "";
- if (suiteName.length() == 0)
- {
- suiteName = testClass.getName();
- }
-
- //
- Description descriptionAnnotation = ((AnnotatedElement)testClass).getAnnotation(Description.class);
- String suiteDescription = descriptionAnnotation != null ? descriptionAnnotation.description() : "";
- if (suiteDescription.length() == 0)
- {
- suiteDescription = "Test of class " + testClass.getName();
- }
-
- Tag tag = ((AnnotatedElement)testClass).getAnnotation(Tag.class);
- Set<String> suiteKeywords = new HashSet<String>();
- if (tag != null)
- {
- suiteKeywords.addAll(CollectionTools.set(tag.value()));
- }
-
- //
- SortedMap<MethodKey, Method> methods = new TreeMap<MethodKey, Method>();
- for (Method method : testClass.getMethods())
- {
- MethodKey key = new MethodKey(method);
- methods.put(key, method);
- }
-
- //
- Map<String, PropertyTestParameter> suiteParameters = new HashMap<String, PropertyTestParameter>();
- Map<String, TestCaseDef> testCases = new HashMap<String, TestCaseDef>();
- Method create = null;
- Method destroy = null;
-
- // First pass for parameters and life cycle annotations
- for (Method method : methods.values())
- {
- String methodName = method.getName();
- int modifiers = method.getModifiers();
- Parameter parameterMethodAnnotation = method.getAnnotation(Parameter.class);
- Test testMethodAnnotation = method.getAnnotation(Test.class);
- Create createMethodAnnotation = method.getAnnotation(Create.class);
- Destroy destroyMethodAnnotation = method.getAnnotation(Destroy.class);
-
- //
- if (testMethodAnnotation != null && parameterMethodAnnotation != null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- if (createMethodAnnotation != null && parameterMethodAnnotation != null)
- {
- throw new IllegalArgumentException();
- }
- if (createMethodAnnotation != null && testMethodAnnotation != null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- if (destroyMethodAnnotation != null && parameterMethodAnnotation != null)
- {
- throw new IllegalArgumentException();
- }
- if (destroyMethodAnnotation != null && testMethodAnnotation != null)
- {
- throw new IllegalArgumentException();
- }
- if (destroyMethodAnnotation != null && createMethodAnnotation != null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- if (parameterMethodAnnotation != null)
- {
- if (!methodName.startsWith("set"))
- {
- throw new IllegalArgumentException();
- }
- if (methodName.length() < 4)
- {
- throw new IllegalArgumentException();
- }
- if (method.getParameterTypes().length != 1)
- {
- throw new IllegalArgumentException();
- }
- if (method.getReturnType() != void.class)
- {
- throw new IllegalArgumentException();
- }
- if (Modifier.isAbstract(modifiers))
- {
- throw new IllegalArgumentException();
- }
- if (!Modifier.isPublic(modifiers))
- {
- throw new IllegalArgumentException();
- }
- if (Modifier.isStatic(modifiers))
- {
- throw new IllegalArgumentException();
- }
-
- //
- String name = parameterMethodAnnotation.name();
- if (name.length() == 0)
- {
- name = Introspector.decapitalize(method.getName().substring(3));
- }
-
- //
- Description descriptionMethodAnnotation = method.getAnnotation(Description.class);
- String description = descriptionMethodAnnotation != null ? descriptionMethodAnnotation.description() : "";
- if (description.length() == 0)
- {
- description = "Parameter " + name;
- }
-
- //
- PropertyTestParameter parameter = suiteParameters.get(name);
- if (parameter == null)
- {
- parameter = new PropertyTestParameter(name, description);
- suiteParameters.put(name, parameter);
- }
-
- //
- parameter.addSetter(method);
- }
- else if (createMethodAnnotation != null)
- {
- if (create != null)
- {
- throw new IllegalArgumentException();
- }
- if (method.getReturnType() != void.class)
- {
- throw new IllegalArgumentException();
- }
- if (Modifier.isAbstract(modifiers))
- {
- throw new IllegalArgumentException();
- }
- if (!Modifier.isPublic(modifiers))
- {
- throw new IllegalArgumentException();
- }
- if (Modifier.isStatic(modifiers))
- {
- throw new IllegalArgumentException();
- }
- if (method.getParameterTypes().length > 0)
- {
- throw new IllegalArgumentException();
- }
-
- //
- create = method;
- }
- else if (destroyMethodAnnotation != null)
- {
- if (destroy != null)
- {
- throw new IllegalArgumentException();
- }
- if (method.getReturnType() != void.class)
- {
- throw new IllegalArgumentException();
- }
- if (Modifier.isAbstract(modifiers))
- {
- throw new IllegalArgumentException();
- }
- if (!Modifier.isPublic(modifiers))
- {
- throw new IllegalArgumentException();
- }
- if (Modifier.isStatic(modifiers))
- {
- throw new IllegalArgumentException();
- }
- if (method.getParameterTypes().length > 0)
- {
- throw new IllegalArgumentException();
- }
-
- //
- destroy = method;
- }
- }
-
- // Second pass for test annotations
- for (Method method : methods.values())
- {
- int modifiers = method.getModifiers();
- Test testMethodAnnotation = method.getAnnotation(Test.class);
-
- //
- if (testMethodAnnotation != null)
- {
- if (method.getReturnType() != void.class)
- {
- throw new IllegalArgumentException();
- }
- if (Modifier.isAbstract(modifiers))
- {
- throw new IllegalArgumentException();
- }
- if (!Modifier.isPublic(modifiers))
- {
- throw new IllegalArgumentException();
- }
- if (Modifier.isStatic(modifiers))
- {
- throw new IllegalArgumentException();
- }
-
- //
- LinkedHashMap<String, ArgumentTestParameter> methodParameters = new LinkedHashMap<String, ArgumentTestParameter>();
- for (Annotation[] parameterAnnotations : method.getParameterAnnotations())
- {
- Map<Class<? extends Annotation>,Annotation> parameterAnnotationMap = new HashMap<Class<? extends Annotation>, Annotation>();
- for (Annotation parameterAnnotation : parameterAnnotations)
- {
- Class<? extends Annotation> blah = parameterAnnotation.annotationType();
- parameterAnnotationMap.put(blah, parameterAnnotation);
- }
-
- //
- Parameter argumentParameterAnnotation = (Parameter)parameterAnnotationMap.get(Parameter.class);
-
- //
- if (argumentParameterAnnotation != null)
- {
- //
- String name = argumentParameterAnnotation.name();
- if (name.length() == 0)
- {
- throw new IllegalArgumentException();
- }
- if (methodParameters.containsKey(name))
- {
- throw new IllegalArgumentException();
- }
-
- //
- Description descriptionArgumentParameterAnnotation = (Description)parameterAnnotationMap.get(Description.class);
- String description = descriptionArgumentParameterAnnotation != null ? descriptionArgumentParameterAnnotation.description() : "";
- if (description.length() == 0)
- {
- description = "Method parameter " + name;
- }
-
- //
- methodParameters.put(name, new ArgumentTestParameter(name, description));
- }
- else
- {
- throw new IllegalArgumentException();
- }
- }
-
- //
- String name = testMethodAnnotation.name();
- if (testMethodAnnotation.name().length() == 0)
- {
- name = method.getName();
- }
-
- //
- Description descriptionMethodAnnotation = method.getAnnotation(Description.class);
- String description = descriptionMethodAnnotation != null ? descriptionMethodAnnotation.description() : "";
- if (description.length() == 0)
- {
- description = "Test of method " + method.getName();
- }
-
- //
- Set<String> keywords = new HashSet<String>();
- Tag tagMethodAnnotation = method.getAnnotation(Tag.class);
- if (tagMethodAnnotation != null)
- {
- keywords.addAll(CollectionTools.set(tagMethodAnnotation.value()));
- }
-
- Map<String,TestParameter> parameters = new HashMap<String, TestParameter>(suiteParameters);
- parameters.putAll(methodParameters);
-
- //
- TestCaseDef testCaseDef = new TestCaseDef(method, name, description, parameters, methodParameters, keywords);
-
- //
- if (testCases.put(testCaseDef.getName(), testCaseDef) != null)
- {
- throw new IllegalArgumentException();
- }
- }
- }
-
- //
- this.suiteName = suiteName;
- this.suiteDescription = suiteDescription;
- this.suiteKeywords = suiteKeywords;
- this.suiteParameters = suiteParameters;
- this.testCases = testCases;
- this.ctor = ctor;
- this.create = create;
- this.destroy = destroy;
- }
-
- public TestSuiteDescriptor getDescriptor()
- {
- return this;
- }
-
- public TestLifeCycle getLifeCycle()
- {
- return this;
- }
-
- public String getName()
- {
- return suiteName;
- }
-
- public String getDescription()
- {
- return suiteDescription;
- }
-
- public Set<String> getKeywords()
- {
- return suiteKeywords;
- }
-
- public Map<String, ? extends ParameterDescriptor> getParameters()
- {
- return Collections.unmodifiableMap(suiteParameters);
- }
-
- public Map<String, ? extends TestCaseDescriptor> getTestCases()
- {
- return Collections.unmodifiableMap(testCases);
- }
-
- public TestCase newTestCase(String name) throws TestCaseLifeCycleException
- {
- TestCaseDef testCaseDef = testCases.get(name);
-
- //
- if (testCaseDef == null)
- {
- throw new TestCaseLifeCycleException("No such test case <" + name + ">");
- }
-
- //
- Object instance;
- try
- {
- instance = ctor.newInstance();
- }
- catch (InvocationTargetException e)
- {
- throw new TestCaseLifeCycleException("Cannot create test case " + name, e.getCause());
- }
- catch (Exception e)
- {
- throw new TestCaseLifeCycleException("Cannot configure parameter " + name, e);
- }
-
- //
- return new TestCaseImpl(testCaseDef, instance);
- }
-
- public void testCaseParametrize(TestCase _testCase, Map<String,String> parametrization) throws TestCaseLifeCycleException
- {
- TestCaseImpl testCase = (TestCaseImpl)_testCase;
-
- // Save parametrization
- testCase.parametrization = parametrization;
-
- //
- for (PropertyTestParameter parameter : suiteParameters.values())
- {
- if (!parametrization.containsKey(parameter.getName()))
- {
- throw new TestCaseLifeCycleException("Missing parameter " + parameter.getName());
- }
- String parameterValue = parametrization.get(parameter.getName());
- for (Method setter : parameter.setters)
- {
- try
- {
- setter.invoke(testCase.pojo, parameterValue);
- }
- catch (InvocationTargetException e)
- {
- throw new TestCaseLifeCycleException("Cannot configure parameter " + parameter.getName(), e.getCause());
- }
- catch (Exception e)
- {
- throw new TestCaseLifeCycleException("Cannot configure parameter " + parameter.getName(), e);
- }
- }
- }
- }
-
- public void testCaseCreate(TestCase _testCase) throws TestCaseLifeCycleException
- {
- TestCaseImpl testCase = (TestCaseImpl)_testCase;
-
- //
- if (create != null)
- {
- try
- {
- create.invoke(testCase.getPOJO());
- }
- catch (InvocationTargetException e)
- {
- throw new TestCaseLifeCycleException("Cannot create test case", e.getCause());
- }
- catch (Exception e)
- {
- throw new TestCaseLifeCycleException("Cannot create test case", e);
- }
- }
- }
-
- public void testCaseInvoke(TestCase _testCase) throws TestCaseLifeCycleException
- {
- TestCaseImpl testCase = (TestCaseImpl)_testCase;
-
- List<Object> argList = new ArrayList<Object>();
- for (String parameterName : testCase.def.arguments.keySet())
- {
- if (!testCase.parametrization.containsKey(parameterName))
- {
- throw new TestCaseLifeCycleException("Missing parameter " + parameterName);
- }
- String parameterValue = testCase.parametrization.get(parameterName);
- if (parameterValue == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- argList.add(parameterValue);
- }
- Object[] args = argList.toArray();
-
- try
- {
- testCase.def.method.invoke(testCase.pojo, args);
- }
- catch (InvocationTargetException e)
- {
- throw new TestCaseLifeCycleException("Cannot invoke test case", e.getCause());
- }
- catch (Exception e)
- {
- throw new TestCaseLifeCycleException("Cannot invoke test case", e);
- }
- }
-
- public void testCaseDestroy(TestCase _testCase)
- {
- TestCaseImpl testCase = (TestCaseImpl)_testCase;
-
- //
- if (destroy != null)
- {
- try
- {
- destroy.invoke(testCase.getPOJO());
- }
- catch (Throwable t)
- {
- // Log this as a warn
- // t.printStackTrace();
- }
- }
- }
-}
Deleted: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestLifeCycle.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestLifeCycle.java 2007-10-04 22:24:45 UTC (rev 8535)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestLifeCycle.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -1,75 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.unit.api.pojo;
-
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public interface TestLifeCycle
-{
-
- /**
- * Instantiate life cycle operation of a test case.
- *
- * @param name the test case name
- * @return the test case object
- * @throws TestCaseLifeCycleException
- */
- TestCase newTestCase(String name) throws TestCaseLifeCycleException;
-
- /**
- * Parametrize life cycle operation of a test case.
- *
- * @param testCase the test case
- * @param parametrization the parametrization
- * @throws TestCaseLifeCycleException
- */
- void testCaseParametrize(TestCase testCase, Map<String,String> parametrization) throws TestCaseLifeCycleException;
-
- /**
- * Create life cycle operation of a test case.
- *
- * @param testCase the test case
- * @throws TestCaseLifeCycleException
- */
- void testCaseCreate(TestCase testCase) throws TestCaseLifeCycleException;
-
- /**
- * Invocation life cycle operation of a test case.
- *
- * @param testCase the test case
- * @throws TestCaseLifeCycleException
- */
- void testCaseInvoke(TestCase testCase) throws TestCaseLifeCycleException;
-
- /**
- * Destroy life cycle operation of a test case.
- *
- * @param testCase the test case
- */
- void testCaseDestroy(TestCase testCase);
-
-}
Deleted: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestParameter.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestParameter.java 2007-10-04 22:24:45 UTC (rev 8535)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestParameter.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -1,61 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.unit.api.pojo;
-
-import java.util.List;
-import java.util.Collections;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-class TestParameter implements ParameterDescriptor
-{
-
- /** . */
- private final String name;
-
- /** . */
- private final String description;
-
- public TestParameter(String name, String description)
- {
- this.name = name;
- this.description = description;
- }
-
- public String getName()
- {
- return name;
- }
-
- public String getDescription()
- {
- return description;
- }
-
- public List<String> getDefaultValues()
- {
- return Collections.emptyList();
- }
-}
Deleted: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestSuiteDescriptor.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestSuiteDescriptor.java 2007-10-04 22:24:45 UTC (rev 8535)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestSuiteDescriptor.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -1,70 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.unit.api.pojo;
-
-import java.util.Set;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public interface TestSuiteDescriptor
-{
-
- /**
- * Return the test name.
- *
- * @return the test name
- */
- String getName();
-
- /**
- * Return the test description.
- *
- * @return the test description
- */
- String getDescription();
-
- /**
- * Returns the keywords for the test.
- *
- * @return the test keywords
- */
- Set<String> getKeywords();
-
- /**
- * Return the test parameters.
- *
- * @return the test parameters
- */
- Map<String,? extends ParameterDescriptor> getParameters();
-
- /**
- * Return the test case descriptions.
- *
- * @return the test case descriptions
- */
- Map<String,? extends TestCaseDescriptor> getTestCases();
-
-}
Deleted: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/annotations/Provider.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/annotations/Provider.java 2007-10-04 22:24:45 UTC (rev 8535)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/annotations/Provider.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -1,43 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.unit.api.pojo.annotations;
-
-import org.jboss.unit.api.pojo.TestHandler;
-
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import java.lang.annotation.ElementType;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-@Inherited
-(a)Retention(RetentionPolicy.RUNTIME)
-(a)Target({ElementType.ANNOTATION_TYPE,ElementType.TYPE})
-public @interface Provider
-{
- Class<? extends TestHandler> value();
-}
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitDescriptor.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitDescriptor.java 2007-10-04 22:24:45 UTC (rev 8535)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitDescriptor.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -22,14 +22,13 @@
******************************************************************************/
package org.jboss.unit.api.pojo.junit;
-import org.jboss.unit.api.pojo.TestSuiteDescriptor;
-import org.jboss.unit.api.pojo.ParameterDescriptor;
-import org.jboss.unit.api.pojo.TestCaseDescriptor;
+import org.jboss.unit.spi.pojo.TestSuiteDescriptor;
+import org.jboss.unit.spi.pojo.ParameterDescriptor;
+import org.jboss.unit.spi.pojo.TestCaseDescriptor;
import java.util.Map;
import java.util.Set;
import java.util.Collections;
-import java.util.Iterator;
import java.util.HashMap;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitLifeCycle.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitLifeCycle.java 2007-10-04 22:24:45 UTC (rev 8535)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitLifeCycle.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -22,8 +22,8 @@
******************************************************************************/
package org.jboss.unit.api.pojo.junit;
-import org.jboss.unit.api.pojo.TestLifeCycle;
-import org.jboss.unit.api.pojo.TestCaseLifeCycleException;
+import org.jboss.unit.spi.pojo.TestLifeCycle;
+import org.jboss.unit.spi.pojo.TestCaseLifeCycleException;
import java.util.Map;
import java.lang.reflect.InvocationTargetException;
@@ -43,7 +43,7 @@
this.provider = testCase;
}
- public org.jboss.unit.api.pojo.TestCase newTestCase(String name) throws TestCaseLifeCycleException
+ public org.jboss.unit.spi.pojo.TestCase newTestCase(String name) throws TestCaseLifeCycleException
{
JUnitTestMethod method = provider.descriptor.testMap.get(name);
if (method == null)
@@ -66,12 +66,12 @@
}
}
- public void testCaseParametrize(org.jboss.unit.api.pojo.TestCase testCase, Map<String, String> parametrization) throws TestCaseLifeCycleException
+ public void testCaseParametrize(org.jboss.unit.spi.pojo.TestCase testCase, Map<String, String> parametrization) throws TestCaseLifeCycleException
{
// No op
}
- public void testCaseCreate(org.jboss.unit.api.pojo.TestCase testCase) throws TestCaseLifeCycleException
+ public void testCaseCreate(org.jboss.unit.spi.pojo.TestCase testCase) throws TestCaseLifeCycleException
{
try
{
@@ -84,7 +84,7 @@
}
}
- public void testCaseInvoke(org.jboss.unit.api.pojo.TestCase testCase) throws TestCaseLifeCycleException
+ public void testCaseInvoke(org.jboss.unit.spi.pojo.TestCase testCase) throws TestCaseLifeCycleException
{
JUnitTestMethodLifeCycle lifeCycle = (JUnitTestMethodLifeCycle)testCase;
@@ -118,7 +118,7 @@
return new TestCaseLifeCycleException(throwable);
}
- public void testCaseDestroy(org.jboss.unit.api.pojo.TestCase testCase)
+ public void testCaseDestroy(org.jboss.unit.spi.pojo.TestCase testCase)
{
try
{
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitProvider.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitProvider.java 2007-10-04 22:24:45 UTC (rev 8535)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitProvider.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -22,10 +22,9 @@
******************************************************************************/
package org.jboss.unit.api.pojo.junit;
-import org.jboss.unit.api.pojo.annotations.Provider;
-import org.jboss.unit.api.pojo.TestHandler;
-import org.jboss.unit.api.pojo.TestSuiteDescriptor;
-import org.jboss.unit.api.pojo.TestLifeCycle;
+import org.jboss.unit.spi.pojo.TestHandler;
+import org.jboss.unit.spi.pojo.TestSuiteDescriptor;
+import org.jboss.unit.spi.pojo.TestLifeCycle;
/**
* @todo
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitTestMethod.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitTestMethod.java 2007-10-04 22:24:45 UTC (rev 8535)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitTestMethod.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -22,8 +22,8 @@
******************************************************************************/
package org.jboss.unit.api.pojo.junit;
-import org.jboss.unit.api.pojo.TestCaseDescriptor;
-import org.jboss.unit.api.pojo.ParameterDescriptor;
+import org.jboss.unit.spi.pojo.TestCaseDescriptor;
+import org.jboss.unit.spi.pojo.ParameterDescriptor;
import java.util.Map;
import java.util.Set;
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitTestMethodLifeCycle.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitTestMethodLifeCycle.java 2007-10-04 22:24:45 UTC (rev 8535)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitTestMethodLifeCycle.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -26,7 +26,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-class JUnitTestMethodLifeCycle implements org.jboss.unit.api.pojo.TestCase
+class JUnitTestMethodLifeCycle implements org.jboss.unit.spi.pojo.TestCase
{
/** . */
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/TestCase.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/TestCase.java 2007-10-04 22:24:45 UTC (rev 8535)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/TestCase.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.unit.api.pojo.junit;
-import org.jboss.unit.api.pojo.annotations.Provider;
+import org.jboss.unit.spi.pojo.annotations.Provider;
/**
Copied: modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/ArgumentTestParameter.java (from rev 8535, modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/ArgumentTestParameter.java)
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/ArgumentTestParameter.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/ArgumentTestParameter.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -0,0 +1,35 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.unit.spi.pojo;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+class ArgumentTestParameter extends TestParameter
+{
+ public ArgumentTestParameter(String name, String description)
+ {
+ super(name, description);
+ }
+}
Copied: modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/MethodKey.java (from rev 8535, modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/MethodKey.java)
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/MethodKey.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/MethodKey.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -0,0 +1,101 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.unit.spi.pojo;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.lang.reflect.Method;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+class MethodKey implements Comparable
+{
+
+ /** . */
+ private String name;
+
+ /** . */
+ private List<String> types;
+
+ MethodKey(Method method)
+ {
+ List<String> types = new ArrayList<String>();
+ for (Class type : method.getParameterTypes())
+ {
+ types.add(type.getName());
+ }
+
+ this.name = method.getName();
+ this.types = types;
+ }
+
+ public int hashCode()
+ {
+ return name.hashCode() + types.hashCode();
+ }
+
+ public boolean equals(Object object)
+ {
+ if (object == this)
+ {
+ return true;
+ }
+ if (object instanceof MethodKey)
+ {
+ MethodKey that = (MethodKey)object;
+ return that.name.equals(this.name) && that.types.equals(this.types);
+ }
+ return false;
+ }
+
+ public int compareTo(Object o)
+ {
+ MethodKey that = (MethodKey)o;
+
+ //
+ int sign = name.compareTo(that.name);
+ if (sign != 0)
+ {
+ return sign;
+ }
+
+ //
+ for (int index = 0;index < this.types.size() && index < that.types.size();index++)
+ {
+ String thisName = this.types.get(index);
+ String thatName = that.types.get(index);
+
+ //
+ int order = thisName.compareTo(thatName);
+ if (order != 0)
+ {
+ return order;
+ }
+ }
+
+ //
+ return that.types.size() - this.types.size();
+ }
+}
Copied: modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/ParameterDescriptor.java (from rev 8535, modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/ParameterDescriptor.java)
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/ParameterDescriptor.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/ParameterDescriptor.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -0,0 +1,41 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.unit.spi.pojo;
+
+import java.util.List;
+
+/**
+ * An object describing a parameter.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface ParameterDescriptor
+{
+
+ String getName();
+
+ String getDescription();
+
+ List<String> getDefaultValues();
+}
Copied: modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/PropertyTestParameter.java (from rev 8535, modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/PropertyTestParameter.java)
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/PropertyTestParameter.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/PropertyTestParameter.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -0,0 +1,48 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.unit.spi.pojo;
+
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+class PropertyTestParameter extends TestParameter
+{
+
+ /** . */
+ final List<Method> setters = new ArrayList<Method>();
+
+ public PropertyTestParameter(String name, String description)
+ {
+ super(name, description);
+ }
+
+ void addSetter(Method setter)
+ {
+ setters.add(setter);
+ }
+}
Copied: modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestCase.java (from rev 8535, modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCase.java)
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestCase.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestCase.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -0,0 +1,32 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.unit.spi.pojo;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface TestCase
+{
+ Object getPOJO();
+}
Copied: modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestCaseDef.java (from rev 8535, modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCaseDef.java)
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestCaseDef.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestCaseDef.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -0,0 +1,94 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.unit.spi.pojo;
+
+import java.lang.reflect.Method;
+import java.util.LinkedHashMap;
+import java.util.Set;
+import java.util.Map;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+class TestCaseDef implements TestCaseDescriptor
+{
+
+ /** . */
+ TestHandlerSupport driver;
+
+ /** . */
+ final Method method;
+
+ /** . */
+ final String name;
+
+ /** . */
+ final String description;
+
+ /** . */
+ final LinkedHashMap<String,ArgumentTestParameter> arguments;
+
+ /** . */
+ final Map<String,TestParameter> parameters;
+
+ /** . */
+ final Set<String> keywords;
+
+ TestCaseDef(
+ Method method,
+ String name,
+ String description,
+ Map<String, TestParameter> parameters,
+ LinkedHashMap<String, ArgumentTestParameter> arguments,
+ Set<String> keywords)
+ {
+ this.method = method;
+ this.name = name;
+ this.description = description;
+ this.arguments = arguments;
+ this.parameters = parameters;
+ this.keywords = keywords;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public Map<String, ? extends ParameterDescriptor> getParameters()
+ {
+ return Collections.unmodifiableMap(parameters);
+ }
+
+ public Set<String> getKeywords()
+ {
+ return Collections.unmodifiableSet(keywords);
+ }
+}
Copied: modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestCaseDescriptor.java (from rev 8535, modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCaseDescriptor.java)
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestCaseDescriptor.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestCaseDescriptor.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -0,0 +1,42 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.unit.spi.pojo;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface TestCaseDescriptor
+{
+
+ String getName();
+
+ String getDescription();
+
+ Map<String, ? extends ParameterDescriptor> getParameters();
+
+ Set<String> getKeywords();
+}
Copied: modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestCaseImpl.java (from rev 8535, modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCaseImpl.java)
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestCaseImpl.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestCaseImpl.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -0,0 +1,52 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.unit.spi.pojo;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+class TestCaseImpl implements TestCase
+{
+
+ final TestCaseDef def;
+
+ /** . */
+ final Object pojo;
+
+ /** . */
+ Map<String,String> parametrization;
+
+ public TestCaseImpl(TestCaseDef def, Object pojo)
+ {
+ this.def = def;
+ this.pojo = pojo;
+ }
+
+ public Object getPOJO()
+ {
+ return pojo;
+ }
+}
Copied: modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestCaseLifeCycleException.java (from rev 8535, modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCaseLifeCycleException.java)
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestCaseLifeCycleException.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestCaseLifeCycleException.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -0,0 +1,49 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.unit.spi.pojo;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestCaseLifeCycleException extends Exception
+{
+ public TestCaseLifeCycleException()
+ {
+ }
+
+ public TestCaseLifeCycleException(String string)
+ {
+ super(string);
+ }
+
+ public TestCaseLifeCycleException(String string, Throwable throwable)
+ {
+ super(string, throwable);
+ }
+
+ public TestCaseLifeCycleException(Throwable throwable)
+ {
+ super(throwable);
+ }
+}
Copied: modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestHandler.java (from rev 8535, modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestHandler.java)
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestHandler.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestHandler.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -0,0 +1,38 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.unit.spi.pojo;
+
+/**
+ * Allow a pojo class to take care of providing its description and perform test case life cycle management.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface TestHandler
+{
+
+ TestSuiteDescriptor getDescriptor();
+
+ TestLifeCycle getLifeCycle();
+
+}
Copied: modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestHandlerSupport.java (from rev 8535, modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestHandlerSupport.java)
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestHandlerSupport.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestHandlerSupport.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -0,0 +1,597 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.unit.spi.pojo;
+
+import org.jboss.unit.api.pojo.annotations.Test;
+import org.jboss.unit.api.pojo.annotations.Parameter;
+import org.jboss.unit.api.pojo.annotations.Create;
+import org.jboss.unit.api.pojo.annotations.Destroy;
+import org.jboss.unit.api.pojo.annotations.Description;
+import org.jboss.unit.api.pojo.annotations.Tag;
+import org.jboss.unit.util.CollectionTools;
+
+import java.util.SortedMap;
+import java.util.TreeMap;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Collections;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.annotation.Annotation;
+import java.beans.Introspector;
+
+/**
+ * Provide a default implementation that relies on the annotation defined in the <code>annotations</code> package.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestHandlerSupport implements TestHandler, TestLifeCycle, TestSuiteDescriptor
+{
+
+ /** . */
+ private final String suiteName;
+
+ /** . */
+ private final String suiteDescription;
+
+ /** . */
+ private final Map<String, TestCaseDef> testCases;
+
+ /** . */
+ private final Method create;
+
+ /** . */
+ private final Method destroy;
+
+ /** . */
+ final Map<String, PropertyTestParameter> suiteParameters;
+
+ /** . */
+ private final Constructor ctor;
+
+ /** . */
+ private final Set<String> suiteKeywords;
+
+ public TestHandlerSupport(Class testClass)
+ {
+ if (testClass == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ if (Modifier.isAbstract(testClass.getModifiers()))
+ {
+ throw new IllegalArgumentException("Test class is abstract");
+ }
+
+ // Check constructor
+ Constructor ctor;
+ try
+ {
+ ctor = testClass.getConstructor();
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new IllegalArgumentException(e);
+ }
+
+ //
+ Test testAnnotation = ((AnnotatedElement)testClass).getAnnotation(Test.class);
+ String suiteName = testAnnotation != null ? testAnnotation.name() : "";
+ if (suiteName.length() == 0)
+ {
+ suiteName = testClass.getName();
+ }
+
+ //
+ Description descriptionAnnotation = ((AnnotatedElement)testClass).getAnnotation(Description.class);
+ String suiteDescription = descriptionAnnotation != null ? descriptionAnnotation.description() : "";
+ if (suiteDescription.length() == 0)
+ {
+ suiteDescription = "Test of class " + testClass.getName();
+ }
+
+ Tag tag = ((AnnotatedElement)testClass).getAnnotation(Tag.class);
+ Set<String> suiteKeywords = new HashSet<String>();
+ if (tag != null)
+ {
+ suiteKeywords.addAll(CollectionTools.set(tag.value()));
+ }
+
+ //
+ SortedMap<MethodKey, Method> methods = new TreeMap<MethodKey, Method>();
+ for (Method method : testClass.getMethods())
+ {
+ MethodKey key = new MethodKey(method);
+ methods.put(key, method);
+ }
+
+ //
+ Map<String, PropertyTestParameter> suiteParameters = new HashMap<String, PropertyTestParameter>();
+ Map<String, TestCaseDef> testCases = new HashMap<String, TestCaseDef>();
+ Method create = null;
+ Method destroy = null;
+
+ // First pass for parameters and life cycle annotations
+ for (Method method : methods.values())
+ {
+ String methodName = method.getName();
+ int modifiers = method.getModifiers();
+ Parameter parameterMethodAnnotation = method.getAnnotation(Parameter.class);
+ Test testMethodAnnotation = method.getAnnotation(Test.class);
+ Create createMethodAnnotation = method.getAnnotation(Create.class);
+ Destroy destroyMethodAnnotation = method.getAnnotation(Destroy.class);
+
+ //
+ if (testMethodAnnotation != null && parameterMethodAnnotation != null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ if (createMethodAnnotation != null && parameterMethodAnnotation != null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (createMethodAnnotation != null && testMethodAnnotation != null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ if (destroyMethodAnnotation != null && parameterMethodAnnotation != null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (destroyMethodAnnotation != null && testMethodAnnotation != null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (destroyMethodAnnotation != null && createMethodAnnotation != null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ if (parameterMethodAnnotation != null)
+ {
+ if (!methodName.startsWith("set"))
+ {
+ throw new IllegalArgumentException();
+ }
+ if (methodName.length() < 4)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (method.getParameterTypes().length != 1)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (method.getReturnType() != void.class)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (Modifier.isAbstract(modifiers))
+ {
+ throw new IllegalArgumentException();
+ }
+ if (!Modifier.isPublic(modifiers))
+ {
+ throw new IllegalArgumentException();
+ }
+ if (Modifier.isStatic(modifiers))
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ String name = parameterMethodAnnotation.name();
+ if (name.length() == 0)
+ {
+ name = Introspector.decapitalize(method.getName().substring(3));
+ }
+
+ //
+ Description descriptionMethodAnnotation = method.getAnnotation(Description.class);
+ String description = descriptionMethodAnnotation != null ? descriptionMethodAnnotation.description() : "";
+ if (description.length() == 0)
+ {
+ description = "Parameter " + name;
+ }
+
+ //
+ PropertyTestParameter parameter = suiteParameters.get(name);
+ if (parameter == null)
+ {
+ parameter = new PropertyTestParameter(name, description);
+ suiteParameters.put(name, parameter);
+ }
+
+ //
+ parameter.addSetter(method);
+ }
+ else if (createMethodAnnotation != null)
+ {
+ if (create != null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (method.getReturnType() != void.class)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (Modifier.isAbstract(modifiers))
+ {
+ throw new IllegalArgumentException();
+ }
+ if (!Modifier.isPublic(modifiers))
+ {
+ throw new IllegalArgumentException();
+ }
+ if (Modifier.isStatic(modifiers))
+ {
+ throw new IllegalArgumentException();
+ }
+ if (method.getParameterTypes().length > 0)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ create = method;
+ }
+ else if (destroyMethodAnnotation != null)
+ {
+ if (destroy != null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (method.getReturnType() != void.class)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (Modifier.isAbstract(modifiers))
+ {
+ throw new IllegalArgumentException();
+ }
+ if (!Modifier.isPublic(modifiers))
+ {
+ throw new IllegalArgumentException();
+ }
+ if (Modifier.isStatic(modifiers))
+ {
+ throw new IllegalArgumentException();
+ }
+ if (method.getParameterTypes().length > 0)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ destroy = method;
+ }
+ }
+
+ // Second pass for test annotations
+ for (Method method : methods.values())
+ {
+ int modifiers = method.getModifiers();
+ Test testMethodAnnotation = method.getAnnotation(Test.class);
+
+ //
+ if (testMethodAnnotation != null)
+ {
+ if (method.getReturnType() != void.class)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (Modifier.isAbstract(modifiers))
+ {
+ throw new IllegalArgumentException();
+ }
+ if (!Modifier.isPublic(modifiers))
+ {
+ throw new IllegalArgumentException();
+ }
+ if (Modifier.isStatic(modifiers))
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ LinkedHashMap<String, ArgumentTestParameter> methodParameters = new LinkedHashMap<String, ArgumentTestParameter>();
+ for (Annotation[] parameterAnnotations : method.getParameterAnnotations())
+ {
+ Map<Class<? extends Annotation>,Annotation> parameterAnnotationMap = new HashMap<Class<? extends Annotation>, Annotation>();
+ for (Annotation parameterAnnotation : parameterAnnotations)
+ {
+ Class<? extends Annotation> blah = parameterAnnotation.annotationType();
+ parameterAnnotationMap.put(blah, parameterAnnotation);
+ }
+
+ //
+ Parameter argumentParameterAnnotation = (Parameter)parameterAnnotationMap.get(Parameter.class);
+
+ //
+ if (argumentParameterAnnotation != null)
+ {
+ //
+ String name = argumentParameterAnnotation.name();
+ if (name.length() == 0)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (methodParameters.containsKey(name))
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ Description descriptionArgumentParameterAnnotation = (Description)parameterAnnotationMap.get(Description.class);
+ String description = descriptionArgumentParameterAnnotation != null ? descriptionArgumentParameterAnnotation.description() : "";
+ if (description.length() == 0)
+ {
+ description = "Method parameter " + name;
+ }
+
+ //
+ methodParameters.put(name, new ArgumentTestParameter(name, description));
+ }
+ else
+ {
+ throw new IllegalArgumentException();
+ }
+ }
+
+ //
+ String name = testMethodAnnotation.name();
+ if (testMethodAnnotation.name().length() == 0)
+ {
+ name = method.getName();
+ }
+
+ //
+ Description descriptionMethodAnnotation = method.getAnnotation(Description.class);
+ String description = descriptionMethodAnnotation != null ? descriptionMethodAnnotation.description() : "";
+ if (description.length() == 0)
+ {
+ description = "Test of method " + method.getName();
+ }
+
+ //
+ Set<String> keywords = new HashSet<String>();
+ Tag tagMethodAnnotation = method.getAnnotation(Tag.class);
+ if (tagMethodAnnotation != null)
+ {
+ keywords.addAll(CollectionTools.set(tagMethodAnnotation.value()));
+ }
+
+ Map<String,TestParameter> parameters = new HashMap<String, TestParameter>(suiteParameters);
+ parameters.putAll(methodParameters);
+
+ //
+ TestCaseDef testCaseDef = new TestCaseDef(method, name, description, parameters, methodParameters, keywords);
+
+ //
+ if (testCases.put(testCaseDef.getName(), testCaseDef) != null)
+ {
+ throw new IllegalArgumentException();
+ }
+ }
+ }
+
+ //
+ this.suiteName = suiteName;
+ this.suiteDescription = suiteDescription;
+ this.suiteKeywords = suiteKeywords;
+ this.suiteParameters = suiteParameters;
+ this.testCases = testCases;
+ this.ctor = ctor;
+ this.create = create;
+ this.destroy = destroy;
+ }
+
+ public TestSuiteDescriptor getDescriptor()
+ {
+ return this;
+ }
+
+ public TestLifeCycle getLifeCycle()
+ {
+ return this;
+ }
+
+ public String getName()
+ {
+ return suiteName;
+ }
+
+ public String getDescription()
+ {
+ return suiteDescription;
+ }
+
+ public Set<String> getKeywords()
+ {
+ return suiteKeywords;
+ }
+
+ public Map<String, ? extends ParameterDescriptor> getParameters()
+ {
+ return Collections.unmodifiableMap(suiteParameters);
+ }
+
+ public Map<String, ? extends TestCaseDescriptor> getTestCases()
+ {
+ return Collections.unmodifiableMap(testCases);
+ }
+
+ public TestCase newTestCase(String name) throws TestCaseLifeCycleException
+ {
+ TestCaseDef testCaseDef = testCases.get(name);
+
+ //
+ if (testCaseDef == null)
+ {
+ throw new TestCaseLifeCycleException("No such test case <" + name + ">");
+ }
+
+ //
+ Object instance;
+ try
+ {
+ instance = ctor.newInstance();
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new TestCaseLifeCycleException("Cannot create test case " + name, e.getCause());
+ }
+ catch (Exception e)
+ {
+ throw new TestCaseLifeCycleException("Cannot configure parameter " + name, e);
+ }
+
+ //
+ return new TestCaseImpl(testCaseDef, instance);
+ }
+
+ public void testCaseParametrize(TestCase _testCase, Map<String,String> parametrization) throws TestCaseLifeCycleException
+ {
+ TestCaseImpl testCase = (TestCaseImpl)_testCase;
+
+ // Save parametrization
+ testCase.parametrization = parametrization;
+
+ //
+ for (PropertyTestParameter parameter : suiteParameters.values())
+ {
+ if (!parametrization.containsKey(parameter.getName()))
+ {
+ throw new TestCaseLifeCycleException("Missing parameter " + parameter.getName());
+ }
+ String parameterValue = parametrization.get(parameter.getName());
+ for (Method setter : parameter.setters)
+ {
+ try
+ {
+ setter.invoke(testCase.pojo, parameterValue);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new TestCaseLifeCycleException("Cannot configure parameter " + parameter.getName(), e.getCause());
+ }
+ catch (Exception e)
+ {
+ throw new TestCaseLifeCycleException("Cannot configure parameter " + parameter.getName(), e);
+ }
+ }
+ }
+ }
+
+ public void testCaseCreate(TestCase _testCase) throws TestCaseLifeCycleException
+ {
+ TestCaseImpl testCase = (TestCaseImpl)_testCase;
+
+ //
+ if (create != null)
+ {
+ try
+ {
+ create.invoke(testCase.getPOJO());
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new TestCaseLifeCycleException("Cannot create test case", e.getCause());
+ }
+ catch (Exception e)
+ {
+ throw new TestCaseLifeCycleException("Cannot create test case", e);
+ }
+ }
+ }
+
+ public void testCaseInvoke(TestCase _testCase) throws TestCaseLifeCycleException
+ {
+ TestCaseImpl testCase = (TestCaseImpl)_testCase;
+
+ List<Object> argList = new ArrayList<Object>();
+ for (String parameterName : testCase.def.arguments.keySet())
+ {
+ if (!testCase.parametrization.containsKey(parameterName))
+ {
+ throw new TestCaseLifeCycleException("Missing parameter " + parameterName);
+ }
+ String parameterValue = testCase.parametrization.get(parameterName);
+ if (parameterValue == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ argList.add(parameterValue);
+ }
+ Object[] args = argList.toArray();
+
+ try
+ {
+ testCase.def.method.invoke(testCase.pojo, args);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new TestCaseLifeCycleException("Cannot invoke test case", e.getCause());
+ }
+ catch (Exception e)
+ {
+ throw new TestCaseLifeCycleException("Cannot invoke test case", e);
+ }
+ }
+
+ public void testCaseDestroy(TestCase _testCase)
+ {
+ TestCaseImpl testCase = (TestCaseImpl)_testCase;
+
+ //
+ if (destroy != null)
+ {
+ try
+ {
+ destroy.invoke(testCase.getPOJO());
+ }
+ catch (Throwable t)
+ {
+ // Log this as a warn
+ // t.printStackTrace();
+ }
+ }
+ }
+}
Copied: modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestLifeCycle.java (from rev 8535, modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestLifeCycle.java)
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestLifeCycle.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestLifeCycle.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -0,0 +1,75 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.unit.spi.pojo;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface TestLifeCycle
+{
+
+ /**
+ * Instantiate life cycle operation of a test case.
+ *
+ * @param name the test case name
+ * @return the test case object
+ * @throws TestCaseLifeCycleException
+ */
+ TestCase newTestCase(String name) throws TestCaseLifeCycleException;
+
+ /**
+ * Parametrize life cycle operation of a test case.
+ *
+ * @param testCase the test case
+ * @param parametrization the parametrization
+ * @throws TestCaseLifeCycleException
+ */
+ void testCaseParametrize(TestCase testCase, Map<String,String> parametrization) throws TestCaseLifeCycleException;
+
+ /**
+ * Create life cycle operation of a test case.
+ *
+ * @param testCase the test case
+ * @throws TestCaseLifeCycleException
+ */
+ void testCaseCreate(TestCase testCase) throws TestCaseLifeCycleException;
+
+ /**
+ * Invocation life cycle operation of a test case.
+ *
+ * @param testCase the test case
+ * @throws TestCaseLifeCycleException
+ */
+ void testCaseInvoke(TestCase testCase) throws TestCaseLifeCycleException;
+
+ /**
+ * Destroy life cycle operation of a test case.
+ *
+ * @param testCase the test case
+ */
+ void testCaseDestroy(TestCase testCase);
+
+}
Copied: modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestParameter.java (from rev 8535, modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestParameter.java)
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestParameter.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestParameter.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -0,0 +1,61 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.unit.spi.pojo;
+
+import java.util.List;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+class TestParameter implements ParameterDescriptor
+{
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final String description;
+
+ public TestParameter(String name, String description)
+ {
+ this.name = name;
+ this.description = description;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public List<String> getDefaultValues()
+ {
+ return Collections.emptyList();
+ }
+}
Copied: modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestSuiteDescriptor.java (from rev 8535, modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestSuiteDescriptor.java)
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestSuiteDescriptor.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/TestSuiteDescriptor.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -0,0 +1,70 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.unit.spi.pojo;
+
+import java.util.Set;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface TestSuiteDescriptor
+{
+
+ /**
+ * Return the test name.
+ *
+ * @return the test name
+ */
+ String getName();
+
+ /**
+ * Return the test description.
+ *
+ * @return the test description
+ */
+ String getDescription();
+
+ /**
+ * Returns the keywords for the test.
+ *
+ * @return the test keywords
+ */
+ Set<String> getKeywords();
+
+ /**
+ * Return the test parameters.
+ *
+ * @return the test parameters
+ */
+ Map<String,? extends ParameterDescriptor> getParameters();
+
+ /**
+ * Return the test case descriptions.
+ *
+ * @return the test case descriptions
+ */
+ Map<String,? extends TestCaseDescriptor> getTestCases();
+
+}
Copied: modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/annotations/Provider.java (from rev 8535, modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/annotations/Provider.java)
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/annotations/Provider.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/spi/pojo/annotations/Provider.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.unit.spi.pojo.annotations;
+
+import org.jboss.unit.spi.pojo.TestHandler;
+
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+@Inherited
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target({ElementType.ANNOTATION_TYPE,ElementType.TYPE})
+public @interface Provider
+{
+ Class<? extends TestHandler> value();
+}
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOParameterInfo.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOParameterInfo.java 2007-10-04 22:24:45 UTC (rev 8535)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOParameterInfo.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.unit.unit.pojo;
-import org.jboss.unit.api.pojo.ParameterDescriptor;
+import org.jboss.unit.spi.pojo.ParameterDescriptor;
import org.jboss.unit.info.ParameterInfo;
import java.util.List;
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestCaseInfo.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestCaseInfo.java 2007-10-04 22:24:45 UTC (rev 8535)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestCaseInfo.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.unit.unit.pojo;
-import org.jboss.unit.api.pojo.TestCaseDescriptor;
+import org.jboss.unit.spi.pojo.TestCaseDescriptor;
import org.jboss.unit.info.TestCaseInfo;
/**
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestInfo.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestInfo.java 2007-10-04 22:24:45 UTC (rev 8535)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestInfo.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -24,11 +24,10 @@
import org.jboss.unit.info.ParameterInfo;
import org.jboss.unit.info.TestInfo;
-import org.jboss.unit.api.pojo.ParameterDescriptor;
+import org.jboss.unit.spi.pojo.ParameterDescriptor;
import java.util.Map;
import java.util.Set;
-import java.util.Collections;
import java.util.HashMap;
/**
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestSuiteDriver.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestSuiteDriver.java 2007-10-04 22:24:45 UTC (rev 8535)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestSuiteDriver.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -22,12 +22,12 @@
******************************************************************************/
package org.jboss.unit.unit.pojo;
-import org.jboss.unit.api.pojo.TestHandler;
-import org.jboss.unit.api.pojo.TestHandlerSupport;
-import org.jboss.unit.api.pojo.TestCaseLifeCycleException;
-import org.jboss.unit.api.pojo.TestLifeCycle;
-import org.jboss.unit.api.pojo.TestCase;
-import org.jboss.unit.api.pojo.annotations.Provider;
+import org.jboss.unit.spi.pojo.TestHandler;
+import org.jboss.unit.spi.pojo.TestHandlerSupport;
+import org.jboss.unit.spi.pojo.TestCaseLifeCycleException;
+import org.jboss.unit.spi.pojo.TestLifeCycle;
+import org.jboss.unit.spi.pojo.TestCase;
+import org.jboss.unit.spi.pojo.annotations.Provider;
import org.jboss.unit.driver.TestDriver;
import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.driver.DriverCommand;
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestSuiteInfo.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestSuiteInfo.java 2007-10-04 22:24:45 UTC (rev 8535)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestSuiteInfo.java 2007-10-04 22:40:54 UTC (rev 8536)
@@ -22,8 +22,8 @@
******************************************************************************/
package org.jboss.unit.unit.pojo;
-import org.jboss.unit.api.pojo.TestCaseDescriptor;
-import org.jboss.unit.api.pojo.TestSuiteDescriptor;
+import org.jboss.unit.spi.pojo.TestCaseDescriptor;
+import org.jboss.unit.spi.pojo.TestSuiteDescriptor;
import org.jboss.unit.info.TestSuiteInfo;
import org.jboss.unit.info.TestInfo;
import org.jboss.unit.TestId;
16 years, 8 months
JBoss Portal SVN: r8535 - in modules/test/trunk/unit/src/main/org/jboss: unit/api/pojo and 4 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-10-04 18:24:45 -0400 (Thu, 04 Oct 2007)
New Revision: 8535
Added:
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCaseImpl.java
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/annotations/Provider.java
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitProvider.java
Modified:
modules/test/trunk/unit/src/main/org/jboss/test/unit/pojo/TestHandlerSupportPOJOTest.java
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCase.java
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestHandlerSupport.java
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestLifeCycle.java
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitDescriptor.java
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitLifeCycle.java
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitTestMethodLifeCycle.java
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/TestCase.java
modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestSuiteInfo.java
modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestSuiteDriver.java
Log:
decouple the test handler class from the tested pojo life cycle by using annotation
Modified: modules/test/trunk/unit/src/main/org/jboss/test/unit/pojo/TestHandlerSupportPOJOTest.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/pojo/TestHandlerSupportPOJOTest.java 2007-10-04 21:32:02 UTC (rev 8534)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/pojo/TestHandlerSupportPOJOTest.java 2007-10-04 22:24:45 UTC (rev 8535)
@@ -25,6 +25,7 @@
import org.jboss.unit.api.pojo.TestHandler;
import org.jboss.unit.api.pojo.TestCaseLifeCycleException;
import org.jboss.unit.api.pojo.TestCaseDescriptor;
+import org.jboss.unit.api.pojo.TestCase;
import static org.jboss.unit.api.Assert.*;
@@ -77,7 +78,7 @@
public InvokeResult invoke(String testName, Map<String, String> parametrization)
{
- Object testCase = null;
+ TestCase testCase = null;
boolean invokeDestroy = false;
try
{
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCase.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCase.java 2007-10-04 21:32:02 UTC (rev 8534)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCase.java 2007-10-04 22:24:45 UTC (rev 8535)
@@ -22,26 +22,11 @@
******************************************************************************/
package org.jboss.unit.api.pojo;
-import java.util.Map;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-class TestCase
+public interface TestCase
{
-
- final TestCaseDef def;
-
- /** . */
- final Object pojo;
-
- /** . */
- Map<String,String> parametrization;
-
- public TestCase(TestCaseDef def, Object pojo)
- {
- this.def = def;
- this.pojo = pojo;
- }
+ Object getPOJO();
}
Added: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCaseImpl.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCaseImpl.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestCaseImpl.java 2007-10-04 22:24:45 UTC (rev 8535)
@@ -0,0 +1,52 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.unit.api.pojo;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+class TestCaseImpl implements TestCase
+{
+
+ final TestCaseDef def;
+
+ /** . */
+ final Object pojo;
+
+ /** . */
+ Map<String,String> parametrization;
+
+ public TestCaseImpl(TestCaseDef def, Object pojo)
+ {
+ this.def = def;
+ this.pojo = pojo;
+ }
+
+ public Object getPOJO()
+ {
+ return pojo;
+ }
+}
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestHandlerSupport.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestHandlerSupport.java 2007-10-04 21:32:02 UTC (rev 8534)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestHandlerSupport.java 2007-10-04 22:24:45 UTC (rev 8535)
@@ -456,7 +456,7 @@
return Collections.unmodifiableMap(testCases);
}
- public Object newTestCase(String name) throws TestCaseLifeCycleException
+ public TestCase newTestCase(String name) throws TestCaseLifeCycleException
{
TestCaseDef testCaseDef = testCases.get(name);
@@ -482,12 +482,12 @@
}
//
- return new TestCase(testCaseDef, instance);
+ return new TestCaseImpl(testCaseDef, instance);
}
- public void testCaseParametrize(Object _testCase, Map<String,String> parametrization) throws TestCaseLifeCycleException
+ public void testCaseParametrize(TestCase _testCase, Map<String,String> parametrization) throws TestCaseLifeCycleException
{
- TestCase testCase = (TestCase)_testCase;
+ TestCaseImpl testCase = (TestCaseImpl)_testCase;
// Save parametrization
testCase.parametrization = parametrization;
@@ -518,16 +518,16 @@
}
}
- public void testCaseCreate(Object _testCase) throws TestCaseLifeCycleException
+ public void testCaseCreate(TestCase _testCase) throws TestCaseLifeCycleException
{
- TestCase testCase = (TestCase)_testCase;
+ TestCaseImpl testCase = (TestCaseImpl)_testCase;
//
if (create != null)
{
try
{
- create.invoke(testCase.pojo);
+ create.invoke(testCase.getPOJO());
}
catch (InvocationTargetException e)
{
@@ -540,9 +540,9 @@
}
}
- public void testCaseInvoke(Object _testCase) throws TestCaseLifeCycleException
+ public void testCaseInvoke(TestCase _testCase) throws TestCaseLifeCycleException
{
- TestCase testCase = (TestCase)_testCase;
+ TestCaseImpl testCase = (TestCaseImpl)_testCase;
List<Object> argList = new ArrayList<Object>();
for (String parameterName : testCase.def.arguments.keySet())
@@ -576,16 +576,16 @@
}
}
- public void testCaseDestroy(Object _testCase)
+ public void testCaseDestroy(TestCase _testCase)
{
- TestCase testCase = (TestCase)_testCase;
+ TestCaseImpl testCase = (TestCaseImpl)_testCase;
//
if (destroy != null)
{
try
{
- destroy.invoke(testCase.pojo);
+ destroy.invoke(testCase.getPOJO());
}
catch (Throwable t)
{
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestLifeCycle.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestLifeCycle.java 2007-10-04 21:32:02 UTC (rev 8534)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/TestLifeCycle.java 2007-10-04 22:24:45 UTC (rev 8535)
@@ -38,7 +38,7 @@
* @return the test case object
* @throws TestCaseLifeCycleException
*/
- Object newTestCase(String name) throws TestCaseLifeCycleException;
+ TestCase newTestCase(String name) throws TestCaseLifeCycleException;
/**
* Parametrize life cycle operation of a test case.
@@ -47,7 +47,7 @@
* @param parametrization the parametrization
* @throws TestCaseLifeCycleException
*/
- void testCaseParametrize(Object testCase, Map<String,String> parametrization) throws TestCaseLifeCycleException;
+ void testCaseParametrize(TestCase testCase, Map<String,String> parametrization) throws TestCaseLifeCycleException;
/**
* Create life cycle operation of a test case.
@@ -55,7 +55,7 @@
* @param testCase the test case
* @throws TestCaseLifeCycleException
*/
- void testCaseCreate(Object testCase) throws TestCaseLifeCycleException;
+ void testCaseCreate(TestCase testCase) throws TestCaseLifeCycleException;
/**
* Invocation life cycle operation of a test case.
@@ -63,13 +63,13 @@
* @param testCase the test case
* @throws TestCaseLifeCycleException
*/
- void testCaseInvoke(Object testCase) throws TestCaseLifeCycleException;
+ void testCaseInvoke(TestCase testCase) throws TestCaseLifeCycleException;
/**
* Destroy life cycle operation of a test case.
*
* @param testCase the test case
*/
- void testCaseDestroy(Object testCase);
+ void testCaseDestroy(TestCase testCase);
}
Added: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/annotations/Provider.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/annotations/Provider.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/annotations/Provider.java 2007-10-04 22:24:45 UTC (rev 8535)
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.unit.api.pojo.annotations;
+
+import org.jboss.unit.api.pojo.TestHandler;
+
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+@Inherited
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target({ElementType.ANNOTATION_TYPE,ElementType.TYPE})
+public @interface Provider
+{
+ Class<? extends TestHandler> value();
+}
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitDescriptor.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitDescriptor.java 2007-10-04 21:32:02 UTC (rev 8534)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitDescriptor.java 2007-10-04 22:24:45 UTC (rev 8535)
@@ -47,9 +47,9 @@
/** . */
final Map<String,JUnitTestMethod> testMap;
- public JUnitDescriptor(Class testClass)
+ public JUnitDescriptor(JUnitProvider provider)
{
- this.testClass = testClass;
+ this.testClass = provider.testClass;
this.testMap = new HashMap<String, JUnitTestMethod>();
//
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitLifeCycle.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitLifeCycle.java 2007-10-04 21:32:02 UTC (rev 8534)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitLifeCycle.java 2007-10-04 22:24:45 UTC (rev 8535)
@@ -36,33 +36,47 @@
{
/** . */
- private final TestCase testCase;
+ private final JUnitProvider provider;
- public JUnitLifeCycle(TestCase testCase)
+ public JUnitLifeCycle(JUnitProvider testCase)
{
- this.testCase = testCase;
+ this.provider = testCase;
}
- public Object newTestCase(String name) throws TestCaseLifeCycleException
+ public org.jboss.unit.api.pojo.TestCase newTestCase(String name) throws TestCaseLifeCycleException
{
- JUnitTestMethod method = testCase.descriptor.testMap.get(name);
+ JUnitTestMethod method = provider.descriptor.testMap.get(name);
if (method == null)
{
throw new TestCaseLifeCycleException("No test case " + name + " found");
}
- return new JUnitTestMethodLifeCycle(method);
+
+ try
+ {
+ TestCase testCase = (TestCase)provider.testClass.newInstance();
+ return new JUnitTestMethodLifeCycle(testCase, method);
+ }
+ catch (InstantiationException e)
+ {
+ throw new TestCaseLifeCycleException(e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new TestCaseLifeCycleException(e);
+ }
}
- public void testCaseParametrize(Object _lifeCycle, Map<String, String> parametrization) throws TestCaseLifeCycleException
+ public void testCaseParametrize(org.jboss.unit.api.pojo.TestCase testCase, Map<String, String> parametrization) throws TestCaseLifeCycleException
{
// No op
}
- public void testCaseCreate(Object _lifeCycle) throws TestCaseLifeCycleException
+ public void testCaseCreate(org.jboss.unit.api.pojo.TestCase testCase) throws TestCaseLifeCycleException
{
try
{
- testCase.setUp();
+ JUnitTestMethodLifeCycle lifeCycle = (JUnitTestMethodLifeCycle)testCase;
+ lifeCycle.pojo.setUp();
}
catch (Throwable e)
{
@@ -70,14 +84,14 @@
}
}
- public void testCaseInvoke(Object _lifeCycle) throws TestCaseLifeCycleException
+ public void testCaseInvoke(org.jboss.unit.api.pojo.TestCase testCase) throws TestCaseLifeCycleException
{
- JUnitTestMethodLifeCycle lifeCycle = (JUnitTestMethodLifeCycle)_lifeCycle;
+ JUnitTestMethodLifeCycle lifeCycle = (JUnitTestMethodLifeCycle)testCase;
// Invoke test joinpoint
try
{
- lifeCycle.testMethod.method.invoke(testCase, new Object[0]);
+ lifeCycle.testMethod.method.invoke(lifeCycle.pojo);
}
catch (IllegalAccessException e)
{
@@ -104,8 +118,16 @@
return new TestCaseLifeCycleException(throwable);
}
- public void testCaseDestroy(Object _testCase)
+ public void testCaseDestroy(org.jboss.unit.api.pojo.TestCase testCase)
{
- testCase.tearDown();
+ try
+ {
+ JUnitTestMethodLifeCycle lifeCycle = (JUnitTestMethodLifeCycle)testCase;
+ lifeCycle.pojo.tearDown();
+ }
+ catch (Throwable e)
+ {
+ e.printStackTrace();
+ }
}
}
Added: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitProvider.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitProvider.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitProvider.java 2007-10-04 22:24:45 UTC (rev 8535)
@@ -0,0 +1,62 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.unit.api.pojo.junit;
+
+import org.jboss.unit.api.pojo.annotations.Provider;
+import org.jboss.unit.api.pojo.TestHandler;
+import org.jboss.unit.api.pojo.TestSuiteDescriptor;
+import org.jboss.unit.api.pojo.TestLifeCycle;
+
+/**
+ * @todo
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class JUnitProvider implements TestHandler
+{
+
+ /** . */
+ final JUnitDescriptor descriptor;
+
+ final JUnitLifeCycle lifeCycle;
+
+ final Class testClass;
+
+ public JUnitProvider(Class testClass)
+ {
+ this.testClass = testClass;
+ descriptor = new JUnitDescriptor(this);
+ lifeCycle = new JUnitLifeCycle(this);
+ }
+
+ public TestSuiteDescriptor getDescriptor()
+ {
+ return descriptor;
+ }
+
+ public TestLifeCycle getLifeCycle()
+ {
+ return lifeCycle;
+ }
+}
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitTestMethodLifeCycle.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitTestMethodLifeCycle.java 2007-10-04 21:32:02 UTC (rev 8534)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/JUnitTestMethodLifeCycle.java 2007-10-04 22:24:45 UTC (rev 8535)
@@ -26,14 +26,23 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-class JUnitTestMethodLifeCycle
+class JUnitTestMethodLifeCycle implements org.jboss.unit.api.pojo.TestCase
{
/** . */
+ final TestCase pojo;
+
+ /** . */
final JUnitTestMethod testMethod;
- public JUnitTestMethodLifeCycle(JUnitTestMethod testMethod)
+ public JUnitTestMethodLifeCycle(TestCase pojo, JUnitTestMethod testMethod)
{
+ this.pojo = pojo;
this.testMethod = testMethod;
}
+
+ public Object getPOJO()
+ {
+ return pojo;
+ }
}
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/TestCase.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/TestCase.java 2007-10-04 21:32:02 UTC (rev 8534)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/junit/TestCase.java 2007-10-04 22:24:45 UTC (rev 8535)
@@ -22,9 +22,7 @@
******************************************************************************/
package org.jboss.unit.api.pojo.junit;
-import org.jboss.unit.api.pojo.TestHandler;
-import org.jboss.unit.api.pojo.TestSuiteDescriptor;
-import org.jboss.unit.api.pojo.TestLifeCycle;
+import org.jboss.unit.api.pojo.annotations.Provider;
/**
@@ -33,18 +31,12 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class TestCase implements TestHandler
+(a)Provider(JUnitProvider.class)
+public class TestCase
{
- /** . */
- final JUnitDescriptor descriptor;
-
- final JUnitLifeCycle lifeCycle;
-
public TestCase()
{
- descriptor = new JUnitDescriptor(getClass());
- lifeCycle = new JUnitLifeCycle(this);
}
protected void setUp()
@@ -54,14 +46,4 @@
protected void tearDown()
{
}
-
- public TestSuiteDescriptor getDescriptor()
- {
- return descriptor;
- }
-
- public TestLifeCycle getLifeCycle()
- {
- return lifeCycle;
- }
}
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestSuiteInfo.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestSuiteInfo.java 2007-10-04 21:32:02 UTC (rev 8534)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestSuiteInfo.java 2007-10-04 22:24:45 UTC (rev 8535)
@@ -76,7 +76,39 @@
public TestInfo findTest(TestId id)
{
- return null;
+ if (id == null)
+ {
+ throw new IllegalArgumentException("No null id accepted");
+ }
+
+ //
+ if (id.getLength() == 0)
+ {
+ return this;
+ }
+
+ //
+ TestInfo child = tests.get(id.getName(0));
+
+ //
+ if (child == null)
+ {
+ return null;
+ }
+
+ //
+ if (child instanceof TestSuiteInfo)
+ {
+ return ((TestSuiteInfo)child).findTest(id.range(1));
+ }
+ else if (id.getLength() == 1)
+ {
+ return child;
+ }
+ else
+ {
+ return null;
+ }
}
public void addTest(TestInfo test)
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestSuiteDriver.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestSuiteDriver.java 2007-10-04 21:32:02 UTC (rev 8534)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/unit/pojo/POJOTestSuiteDriver.java 2007-10-04 22:24:45 UTC (rev 8535)
@@ -26,6 +26,8 @@
import org.jboss.unit.api.pojo.TestHandlerSupport;
import org.jboss.unit.api.pojo.TestCaseLifeCycleException;
import org.jboss.unit.api.pojo.TestLifeCycle;
+import org.jboss.unit.api.pojo.TestCase;
+import org.jboss.unit.api.pojo.annotations.Provider;
import org.jboss.unit.driver.TestDriver;
import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.driver.DriverCommand;
@@ -38,6 +40,10 @@
import org.jboss.unit.Failure;
import java.util.Map;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.annotation.Annotation;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -54,15 +60,50 @@
public POJOTestSuiteDriver(Class testClass) throws InstantiationException, IllegalAccessException
{
- if (TestHandler.class.isAssignableFrom(testClass))
+ // Get provider annotation
+ Provider provider = ((AnnotatedElement)testClass).getAnnotation(Provider.class);
+
+ // Scan meta annotations
+ if (provider == null)
{
- handler = (TestHandler)testClass.newInstance();
+ for (Annotation annotation : testClass.getAnnotations())
+ {
+ Class blah = annotation.annotationType();
+ provider = ((AnnotatedElement)blah).getAnnotation(Provider.class);
+ if (provider != null)
+ {
+ break;
+ }
+ }
}
+
+ if (provider != null)
+ {
+ try
+ {
+ Class<? extends TestHandler> providerClass = provider.value();
+ Constructor<? extends TestHandler> providerCtor = providerClass.getConstructor(Class.class);
+ handler = providerCtor.newInstance(testClass);
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new IllegalArgumentException(e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new IllegalArgumentException(e);
+ }
+ }
+// else if (TestHandler.class.isAssignableFrom(testClass))
+// {
+// handler = (TestHandler)testClass.newInstance();
+// }
else
{
handler = new TestHandlerSupport(testClass);
}
+ //
info = new POJOTestSuiteInfo(handler.getDescriptor());
}
@@ -90,10 +131,10 @@
String name = id.getName(0);
//
- Object pojo;
+ TestCase testCase;
try
{
- pojo = lifeCycle.newTestCase(name);
+ testCase = lifeCycle.newTestCase(name);
}
catch (Exception e)
{
@@ -106,7 +147,7 @@
//
try
{
- lifeCycle.testCaseParametrize(pojo, parametrization);
+ lifeCycle.testCaseParametrize(testCase, parametrization);
}
catch (Exception e)
{
@@ -116,10 +157,10 @@
//
try
{
- lifeCycle.testCaseCreate(pojo);
+ lifeCycle.testCaseCreate(testCase);
//
- lifeCycle.testCaseInvoke(pojo);
+ lifeCycle.testCaseInvoke(testCase);
}
catch (Exception e)
{
@@ -127,7 +168,7 @@
}
finally
{
- lifeCycle.testCaseDestroy(pojo);
+ lifeCycle.testCaseDestroy(testCase);
}
//
16 years, 8 months
JBoss Portal SVN: r8534 - modules/common/trunk/build/ide/intellij/idea60/modules.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-10-04 17:32:02 -0400 (Thu, 04 Oct 2007)
New Revision: 8534
Removed:
modules/common/trunk/build/ide/intellij/idea60/modules/testsuite/
modules/common/trunk/build/ide/intellij/idea60/modules/thirdparty/
modules/common/trunk/build/ide/intellij/idea60/modules/tools/
Log:
removing intellij modules for tools, thirdparty and testsuite
16 years, 8 months
JBoss Portal SVN: r8533 - in modules/common/trunk: build and 3 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-10-04 17:29:53 -0400 (Thu, 04 Oct 2007)
New Revision: 8533
Removed:
modules/common/trunk/build/build-thirdparty.xml
modules/common/trunk/build/build.sh
modules/common/trunk/build/build.xml
modules/common/trunk/build/distrib.xml
modules/common/trunk/build/etc/
modules/common/trunk/build/licences/
modules/common/trunk/common/build.bat
modules/common/trunk/common/build.sh
modules/common/trunk/common/build.xml
modules/common/trunk/mc/build.bat
modules/common/trunk/mc/build.sh
modules/common/trunk/mc/build.xml
modules/common/trunk/portal/build.bat
modules/common/trunk/portal/build.sh
modules/common/trunk/portal/build.xml
modules/common/trunk/testsuite/
modules/common/trunk/tools/
Log:
getting rid of build tragic in common module
Deleted: modules/common/trunk/build/build-thirdparty.xml
===================================================================
--- modules/common/trunk/build/build-thirdparty.xml 2007-10-04 17:58:22 UTC (rev 8532)
+++ modules/common/trunk/build/build-thirdparty.xml 2007-10-04 21:29:53 UTC (rev 8533)
@@ -1,100 +0,0 @@
-<?xml version="1.0"?>
-<project name="main.build"
- default="synchronize"
- basedir=".">
-
- <!-- Property File definitions -->
- <!--<property file="local.properties"/>
- <property file="synchronize.properties"/>-->
- <property environment="env"/>
-
- <!-- Property Definitions -->
- <property name="generatedLibrariesFiles" value="../thirdparty/libraries.ent"/>
-
-
- <property name="jboss.tasks.path"
- value="../tools/lib/jbossbuild.jar"/>
-
- <!-- Allow jbossbuild.repository to be set from (in order or priority)
- + Command line -Djbossbuild.repository=...
- + synchronize.properties jbossbuild.repository setting
- + JBOSS_REPOSITORY environment variable
- -->
- <condition property="jbossbuild.repository" value="${env.JBOSS_REPOSITORY}">
- <isset property="env.JBOSS_REPOSITORY"/>
- </condition>
- <!-- Fall back to default -->
- <property name="jbossbuild.repository" value="http://repository.jboss.com"/>
-
- <!-- File Imports -->
- <import file="../tools/etc/jbossbuild/tasks.xml"/>
-
-
- <!-- Main Definition of dependencies -->
- <build id="jbossportal-thirdparty"
- impltitle="JBossPortal"
- implversion="1.0.0"
- implvendor="JBoss, a division of Red Hat Inc."
- implurl="http://www.jboss.org"
- description="JBoss Portal"
- cvsroot="${cvs.prefix}@cvs.forge.jboss.com:/cvsroot/jboss"
- thirdpartypath="../thirdparty/"
- location="${jbossbuild.repository}"
- targetdefs="targets">
-
- <!--
- The repository is in CVS under the module repository.jboss.com whose contents
- are pushed to the http://repository.jboss.com site.
- -->
-
- <componentref name="apache-ant" version="1.6.5"/>
- <componentref name="apache-httpclient" version="3.0.1"/>
- <componentref name="apache-log4j" version="1.2.8"/>
- <componentref name="jbossas/core-libs" version="4.0.4.GA"/>
- <componentref name="jboss/test" version="1.0.0.CR1"/>
- <componentref name="junit" version="3.8.1"/>
- <componentref name="oswego-concurrent" version="1.3.4"/>
- <componentref name="sun-jaf" version="1.0.2"/>
- <componentref name="sun-javamail" version="1.3.1"/>
- <componentref name="sun-servlet" version="2.4"/>
-
- <componentref name="jboss/common" version="1.2.0.GA-brew"/>
- <componentref name="jboss/microcontainer" version="1.0.2"/>
-
-
- <!-- Based on http://anonsvn.jboss.org/repos/jbossas/tags/EMBEDDED_JBOSS_BETA_2/build/b... -->
-<!--
- <componentref name="jboss/microcontainer" version="2.0.0.Beta3"/>
- <componentref name="jboss/aop" version="2.0.0.alpha4"/>
- <componentref name="jboss/jbossxb" version="2.0.0.CR2"/>
- <componentref name="jboss/jboss-vfs" version="2.0.0.Beta4"/>
- <componentref name="jboss/common-core" version="2.0.4.Alpha"/>
- <componentref name="jboss/common-logging-log4j" version="2.0.2.GA"/>
- <componentref name="jboss/common-logging-jdk" version="2.0.2.GA"/>
- <componentref name="jboss/common-logging-spi" version="2.0.2.GA"/>
- <componentref name="javassist" version="3.5.0.CR1"/>
- <componentref name="apache-log4j" version="1.2.14"/>
- <componentref name="apache-xerces" version="2.7.1"/>
- <componentref name="sun-jaf" version="1.1"/>
- <componentref name="junit" version="3.8.1"/>
- <componentref name="wutka-dtdparser" version="1.2.1"/>
- <componentref name="trove" version="1.0.2"/>
--->
- </build>
-
- <synchronizeinfo/>
-
- <target name="generate-lib-file"
- description="generate libraries.ent and thirdparty license info"
- depends="synchronize">
- <gen-lib-file filename="${generatedLibrariesFiles}"/>
- <visit-componentref-graph
- componentVisitor="org.jboss.ant.util.graph.ComponentRefGraphLicenseVisitor"/>
- </target>
-
- <!-- Generate the targets -->
- <generate generate="jbossportal-thirdparty"/>
-
-
-
-</project>
Deleted: modules/common/trunk/build/build.sh
===================================================================
--- modules/common/trunk/build/build.sh 2007-10-04 17:58:22 UTC (rev 8532)
+++ modules/common/trunk/build/build.sh 2007-10-04 21:29:53 UTC (rev 8533)
@@ -1,49 +0,0 @@
-#!/bin/sh
-##
-## Invokes a script of the same name in the 'tools' module.
-##
-## The 'tools' module is expected to be a peer directory of the directory
-## in which this script lives.
-##
-## @author Jason Dillon <jason(a)planet57.com>
-##
-
-# $Id: build.sh 2 2005-01-14 23:01:32Z vietj $
-
-PROGNAME=`basename $0`
-DIRNAME=`dirname $0`
-
-# Buss it yo
-main() {
- if [ "x$TOOLS_ROOT" = "x" ]; then
- TOOLS_ROOT=`cd $DIRNAME/../tools && pwd`
- fi
-
- MODULE_ROOT=`cd $DIRNAME; pwd`
- export TOOLS_ROOT MODULE_ROOT DEBUG TRACE
-
- # Where is the target script?
- target="$TOOLS_ROOT/bin/$PROGNAME"
- if [ ! -f "$target" ]; then
- echo "${PROGNAME}: *ERROR* The target executable does not exist:"
- echo "${PROGNAME}:"
- echo "${PROGNAME}: $target"
- echo "${PROGNAME}:"
- echo "${PROGNAME}: Please make sure you have checked out the 'tools' module"
- echo "${PROGNAME}: and make sure it is up to date."
- exit 2
- fi
-
- # Get busy yo!
- if [ "x$DEBUG" != "x" ]; then
- echo "${PROGNAME}: Executing: /bin/sh $target $@"
- fi
- if [ "x$TRACE" = "x" ]; then
- exec /bin/sh $target "$@"
- else
- exec /bin/sh -x $target "$@"
- fi
-}
-
-# Lets get ready to rumble!
-main "$@"
Deleted: modules/common/trunk/build/build.xml
===================================================================
--- modules/common/trunk/build/build.xml 2007-10-04 17:58:22 UTC (rev 8532)
+++ modules/common/trunk/build/build.xml 2007-10-04 21:29:53 UTC (rev 8533)
@@ -1,411 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE project [
-
- <!ENTITY buildmagic SYSTEM "../tools/etc/buildfragments/buildmagic.ent">
- <!ENTITY modules SYSTEM "../tools/etc/buildfragments/modules.ent">
- <!ENTITY defaults SYSTEM "../tools/etc/buildfragments/defaults.ent">
-
-
- ]>
-
-<!-- $Id: build.xml 7880 2007-08-09 12:38:58Z thomas.heute(a)jboss.com $ -->
-
-<!--+======================================================================+-->
-<!--| JBoss Portal: The OpenSource Portal |-->
-<!--| |-->
-<!--| Distributable under LGPL license. |-->
-<!--| See terms of license at http://www.gnu.org. |-->
-<!--| |-->
-<!--| This file has been designed to work with the 'tools' module and |-->
-<!--| Buildmagic extentions. |-->
-<!--+======================================================================+-->
-
-<project default="main" name="JBoss Portal">
-
- <!--+====================================================================+-->
- <!--| Setup |-->
- <!--| |-->
- <!--| Include the common build elements. |-->
- <!--| |-->
- <!--| This defines several different targets, properties and paths. |-->
- <!--| It also sets up the basic extention tasks amoung other things. |-->
- <!--+====================================================================+-->
-
- &buildmagic;
- &modules;
- &defaults;
-
- <!--+====================================================================+-->
- <!--| Initialization |-->
- <!--| |-->
- <!--| Initialize the build system. Other targets should depend on |-->
- <!--| 'init'. |-->
- <!--+====================================================================+-->
-
- <target name="init" unless="init.disable" depends="_buildmagic:init">
- </target>
-
-
- <!--+====================================================================+-->
- <!--| Configuration |-->
- <!--| |-->
- <!--| This target is invoked by the Buildmagic initialization logic |-->
- <!--| and should contain module specific configuration elements. |-->
- <!--+====================================================================+-->
-
- <target name="configure" unless="configure.disable">
-
- <!--+==============================+-->
- <!--| Project version information. |-->
- <!--+==============================+-->
-
- <property name="version.major" value="1"/>
- <property name="version.minor" value="0"/>
- <property name="version.revision" value="0"/>
- <property name="version.tag" value="GA"/>
- <property name="version.name" value=""/>
-
- <!-- This must be set to the CVS tag for any release -->
- <property name="version.cvstag" value=""/>
-
- <!-- Module name(s) & version -->
- <property name="module.version"
- value="${version.major}.${version.minor}.${version.revision}${version.tag}"/>
-
- <!-- ========= -->
- <!-- Libraries -->
- <!-- ========= -->
-
- <!-- The combined library classpath -->
-
- <path id="library.classpath">
- </path>
-
- <!-- Configure modules -->
- <call target="configure-modules"/>
- <path id="dependentmodule.classpath">
- <!-- Add dependent module classpath elements here. -->
- </path>
-
- <!--+=======================================+-->
- <!--| Override any default properties here. |-->
- <!--+=======================================+-->
-
- <!-- Configure defaults & build tools -->
-
- <call target="configure-defaults"/>
-
- <!--+=======================================+-->
- <!--| Define module specific elements here. |-->
- <!--+=======================================+-->
-
- <!--+================================+-->
- <!--| Define project structure here. |-->
- <!--+================================+-->
-
- <!-- The group to use by default -->
- <property name="groups" value="default"/>
-
- <!-- Sets up the module configuration. -->
- <moduleconfig property="modules" selected="${groups}">
-
- <!-- Modules -->
-
- <module name="common"/>
- <module name="portal"/>
- <module name="mc"/>
-
- <!-- Module groups -->
-
- <group name="common">
- <include
- modules="common,portal,mc"/>
- </group>
-
- <group name="default">
- <include groups="common"/>
- </group>
-
- </moduleconfig>
-
- <!-- Configure project defaults -->
- <call target="configure-project"/>
-
- </target>
- <target name="modules-all" depends="_buildmagic:modules:all"/>
- <target name="modules-most" depends="_buildmagic:modules:most"/>
- <target name="modules-main" depends="_buildmagic:modules:main"/>
- <target name="modules-release" depends="_buildmagic:modules:release"/>
- <target name="modules-tests" depends="_buildmagic:modules:tests"/>
- <target name="modules-clean" depends="_buildmagic:modules:clean"/>
- <target name="modules-clobber" depends="_buildmagic:modules:clobber"/>
- <target name="modules-package-tests" depends="_buildmagic:modules:package-tests"/>
-
- <!--+====================================================================+-->
- <!--| Module Pass-through Hooks |-->
- <!--| |-->
- <!--| These hooks are executed after the above pass-through targets have |-->
- <!--| finished with a given module. |-->
- <!--+====================================================================+-->
-
- <!-- Add module pass-through hooks here. -->
-
-
- <!--+====================================================================+-->
- <!--| Compile |-->
- <!--| |-->
- <!--| This target should depend on other compile-* targets for each |-->
- <!--| different type of compile that needs to be performed, short of |-->
- <!--| documentation compiles. |-->
- <!--+====================================================================+-->
-
- <target name="compile"/>
-
- <!--+====================================================================+-->
- <!--| Generate Output |-->
- <!--| |-->
- <!--| Generates the target output for this module. Target output is |-->
- <!--| the output which is ment to be released or used by external |-->
- <!--| modules. |-->
- <!--+====================================================================+-->
-
- <target name="output"
- description="Generate all target output."
- depends="init">
- <!-- Add module specific elements here. -->
- </target>
-
- <!--+====================================================================+-->
- <!--| Documents |-->
- <!--| |-->
- <!--| Generate all documentation for this module. |-->
- <!--+====================================================================+-->
-
- <target name="docs">
- <ant antfile="build-targets.xml" target="_default:docs"/>
- <!-- Add module specific elements here. -->
- </target>
-
- <!--+====================================================================+-->
- <!--| Install & Release |-->
- <!--+====================================================================+-->
-
- <target name="release"
- description="Builds the default release structure."
- depends="modules-most, output"/>
-
- <target name="release-full"
- description="Builds the full release structure."
- depends="modules-all, release"/>
-
- <!--+====================================================================+-->
- <!--| Misc. |-->
- <!--| |-->
- <!--| Standard targets and pseudo-targets. |-->
- <!--+====================================================================+-->
-
- <target name="clean" depends="createthirdparty, modules-clean, _buildmagic:clean"
- description="Cleans up most generated files.">
- <!-- Add module specific elements here. -->
- </target>
-
- <target name="clobber" depends="_buildmagic:clobber, clean, modules-clobber"
- description="Cleans up all generated files.">
- <!-- Add module specific elements here. -->
- </target>
-
- <target name="main" depends="most"
- description="Executes the default target (most)."/>
-
- <target name="all" depends="createthirdparty, modules-all"
- description="Executes all modules and builds everything."/>
-
- <target name="most" depends="createthirdparty, modules-most"
- description="Executes all modules and builds most everything."/>
-
- <target name="help" depends="_buildmagic:help:build"
- description="Show this help message."/>
-
- <!--
- | Deploy the application
- -->
-
- <!--<target name="initsetup">-->
- <!--<available property="cmsdata" file="${jboss.home}/server/${portal.deploy.dir}/data/portal"/> -->
- <!--</target>-->
-
- <!--<target name="setup" depends="initsetup" unless="cmsdata">-->
- <!--<unzip src="../core/src/bin/setup/cms-content.zip" dest="${jboss.home}/server/${portal.deploy.dir}/data"/>-->
- <!--</target>-->
-
- <target name="deploy"
- description="Deploy."
- depends="main">
- <require file="${jboss.home}/server/${portal.deploy.dir}"/>
- <copy file="../core/output/lib/jboss-portal.sar" todir="${jboss.home}/server/${portal.deploy.dir}"
- overwrite="true"/>
- </target>
-
- <target name="undeploy"
- description="Undeploy."
- depends="init">
- <require file="${jboss.home}/server/${portal.deploy.dir}"/>
- <delete file="${jboss.home}/server/${portal.deploy.dir}/jboss-portal.sar"/>
- </target>
-
- <target name="deploy-all"
- description="Deploy all archives."
- depends="most">
- <require file="${jboss.home}/server/${portal.deploy.dir}"/>
- <copy file="../core/output/lib/jboss-portal.sar" todir="${jboss.home}/server/${portal.deploy.dir}" overwrite="true"/>
- <copy file="../core-admin/output/lib//portal-admin.sar" todir="${jboss.home}/server/${portal.deploy.dir}" overwrite="true"/>
- <copy file="../core-cms/output/lib/portal-cms.sar" todir="${jboss.home}/server/${portal.deploy.dir}" overwrite="true"/>
- <copy file="../core-management/output/lib/portal-management.sar" todir="${jboss.home}/server/${portal.deploy.dir}" overwrite="true"/>
- <copy file="../core-samples/output/lib/portal-basic-samples.sar" todir="${jboss.home}/server/${portal.deploy.dir}" overwrite="true"/>
- <copy file="../core-samples/output/lib/portal-news-samples.war" todir="${jboss.home}/server/${portal.deploy.dir}" overwrite="true"/>
- <copy file="../core-samples/output/lib/portal-jsp-samples.war" todir="${jboss.home}/server/${portal.deploy.dir}" overwrite="true"/>
- <copy file="../core-samples/output/lib/portal-weather-samples.war" todir="${jboss.home}/server/${portal.deploy.dir}" overwrite="true"/>
- <!--<copy file="../core-search/output/lib/portal-search.sar" todir="${jboss.home}/server/${portal.deploy.dir}" overwrite="true"/>-->
- <copy file="../widget/output/lib/widget.war" todir="${jboss.home}/server/${portal.deploy.dir}" overwrite="true"/>
- <copy file="../wsrp/output/lib/portal-wsrp.sar" todir="${jboss.home}/server/${portal.deploy.dir}" overwrite="true"/>
- </target>
-
- <target name="undeploy-all"
- description="Undeploy all archives."
- depends="init">
- <require file="${jboss.home}/server/${portal.deploy.dir}"/>
- <delete file="${jboss.home}/server/${portal.deploy.dir}/jboss-portal.sar"/>
- <delete file="${jboss.home}/server/${portal.deploy.dir}/portal-admin.sar"/>
- <delete file="${jboss.home}/server/${portal.deploy.dir}/portal-cms.sar"/>
- <delete file="${jboss.home}/server/${portal.deploy.dir}/portal-management.sar"/>
- <delete file="${jboss.home}/server/${portal.deploy.dir}/portal-basic-samples.sar"/>
- <delete file="${jboss.home}/server/${portal.deploy.dir}/portal-news-samples.war"/>
- <delete file="${jboss.home}/server/${portal.deploy.dir}/portal-jsp-samples.war"/>
- <delete file="${jboss.home}/server/${portal.deploy.dir}/portal-weather-samples.war"/>
- <!--<delete file="${jboss.home}/server/${portal.deploy.dir}/portal-search.sar"/>-->
- <delete file="${jboss.home}/server/${portal.deploy.dir}/widget.war"/>
- <delete file="${jboss.home}/server/${portal.deploy.dir}/portal-wsrp.sar"/>
- </target>
-
- <target name="exploded-deploy"
- description="Deploy exploded sar."
- depends="main">
- <require file="${jboss.home}/server/${portal.deploy.dir}"/>
- <delete dir="${jboss.home}/server/${portal.deploy.dir}/jboss-portal-exploded.sar"/>
- <mkdir dir="${jboss.home}/server/${portal.deploy.dir}/jboss-portal-exploded.sar"/>
- <copy todir="${jboss.home}/server/${portal.deploy.dir}/jboss-portal-exploded.sar">
- <fileset dir="../core/output/resources/jboss-portal.sar"/>
- </copy>
- </target>
-
- <target name="javadoc">
- <mkdir dir="javadoc"/>
- <javadoc destdir="javadoc">
- <classpath>
- <fileset dir="../thirdparty" includes="**/*.jar"/>
- </classpath>
- <packageset dir="../common/src/main">
- <exclude name="org/jboss/portal/test/**"/>
- </packageset>
- <packageset dir="../web/src/main">
- <exclude name="org/jboss/portal/test/**"/>
- </packageset>
- <packageset dir="../server/src/main">
- <exclude name="org/jboss/portal/test/**"/>
- </packageset>
- <packageset dir="../api/src/main">
- <exclude name="org/jboss/portal/test/**"/>
- </packageset>
- <packageset dir="../portlet/src/main">
- <exclude name="org/jboss/portal/test/**"/>
- </packageset>
- <packageset dir="../portlet-server/src/main">
- <exclude name="org/jboss/portal/test/**"/>
- </packageset>
- <packageset dir="../jems/src/main">
- <exclude name="org/jboss/portal/test/**"/>
- </packageset>
- <packageset dir="../identity/src/main">
- <exclude name="org/jboss/portal/test/**"/>
- </packageset>
- <packageset dir="../bridge/src/main">
- <exclude name="org/jboss/portal/test/**"/>
- </packageset>
- <packageset dir="../faces/src/main">
- <exclude name="org/jboss/portal/test/**"/>
- </packageset>
- <packageset dir="../portlet-federation/src/main">
- <exclude name="org/jboss/portal/test/**"/>
- </packageset>
- <packageset dir="../format/src/main">
- <exclude name="org/jboss/portal/test/**"/>
- </packageset>
- <packageset dir="../theme/src/main">
- <exclude name="org/jboss/portal/test/**"/>
- </packageset>
- <packageset dir="../cms/src/main">
- <exclude name="org/jboss/portal/test/**"/>
- </packageset>
- <packageset dir="../core/src/main">
- <exclude name="org/jboss/portal/test/**"/>
- </packageset>
- <packageset dir="../core-admin/src/main">
- <exclude name="org/jboss/portal/test/**"/>
- </packageset>
- <packageset dir="../core-cms/src/main">
- <exclude name="org/jboss/portal/test/**"/>
- </packageset>
- <packageset dir="../core-management/src/main">
- <exclude name="org/jboss/portal/test/**"/>
- </packageset>
- <packageset dir="../security/src/main">
- <exclude name="org/jboss/portal/test/**"/>
- </packageset>
- <packageset dir="../wsrp/src/main">
- <exclude name="org/jboss/portal/test/**"/>
- </packageset>
- <packageset dir="../wsrp/src/generated">
- <exclude name="org/jboss/portal/test/**"/>
- </packageset>
- <packageset dir="../registration/src/main">
- <exclude name="org/jboss/portal/test/**"/>
- </packageset>
- <packageset dir="../widget/src/main">
- <exclude name="org/jboss/portal/test/**"/>
- </packageset>
- <packageset dir="../workflow/src/main">
- <exclude name="org/jboss/portal/test/**"/>
- </packageset>
- <packageset dir="../search/src/main">
- <exclude name="org/jboss/portal/test/**"/>
- </packageset>
- <packageset dir="../core-samples/src/main">
- <exclude name="org/jboss/portal/test/**"/>
- </packageset>
- <packageset dir="../core-search/src/main">
- <exclude name="org/jboss/portal/test/**"/>
- </packageset>
- </javadoc>
- </target>
-
- <!-- create the thirdparty folder from items in the repository -->
- <!-- then generate a new libraries.ent file and include it in -->
- <!-- the build -->
- <target name="createthirdparty" unless="inhibit.downloads"
- depends="check.inhibit.downloads">
- <ant antfile="build-thirdparty.xml" target="generate-lib-file"/>
- </target>
-
- <!-- check if thirdparty libraries are to be downloaded -->
- <target name="check.inhibit.downloads">
- <condition property="inhibit.downloads">
- <or>
- <uptodate property="dependencies.current"
- srcfile="build-thirdparty.xml"
- targetfile="../thirdparty/libraries.ent"/>
- <istrue value="${nodownload}"/>
- </or>
- </condition>
- </target>
-
-</project>
Deleted: modules/common/trunk/build/distrib.xml
===================================================================
--- modules/common/trunk/build/distrib.xml 2007-10-04 17:58:22 UTC (rev 8532)
+++ modules/common/trunk/build/distrib.xml 2007-10-04 21:29:53 UTC (rev 8533)
@@ -1,398 +0,0 @@
-<project default="main" name="JBoss Portal">
-
- <property name="source.dir" value="../../jboss-portal-2.6"/>
- <property name="docs.dir" value="${source.dir}-docs"/>
- <property name="release.version" value="2.6.1.GA"/>
-
- <!-- -->
- <property name="portal.release.normal.name" value="jboss-portal-${release.version}"/>
- <property name="portal.release.ha.name" value="jboss-portal-ha-${release.version}"/>
-
- <!-- -->
- <property name="portal.build.src" value="output/${portal.release.normal.name}-src"/>
- <property name="portal.build.normal.bin" value="output/${portal.release.normal.name}"/>
- <property name="portal.build.ha.bin" value="output/${portal.release.ha.name}"/>
- <property name="portal.build.normal.bundled" value="output/${portal.release.normal.name}-bundled"/>
- <property name="portal.build.ha.bundled" value="output/${portal.release.ha.name}-bundled"/>
-
- <property environment="env"/>
-
- <target name="init" unless="jboss.home">
- <property name="jboss.home" value="${env.JBOSS_HOME}"/>
- <echo message="Using JBoss install from $JBOSS_HOME: ${jboss.home}"/>
- </target>
-
- <!--
- <property name="forums.release.name" value="jboss-forums-${release.version}"/>
- <property name="forums.build.bin" value="output/${forums.release.name}"/>
- <property name="forums.build.src" value="output/${forums.release.name}-src"/>
- -->
- <!-- Licenses -->
- <target name="licenses">
- <fileset id="thirdparty-licenses" dir="../thirdparty/licenses">
- <include name="antlr.txt"/>
- <include name="apache-2.0.txt"/>
- <include name="bsd.txt"/>
- <include name="cddl.txt"/>
- <include name="cpl-1.0/txt"/>
- <include name="day-jcr.txt"/>
- <include name="dom4j.txt"/>
- <include name="ehcache.txt"/>
- <include name="gpl.txt"/>
- <include name="hsqldb.txt"/>
- <include name="httpunit.txt"/>
- <include name="ironsmith.txt"/>
- <include name="lgpl.txt"/>
- <include name="nekohtml.txt"/>
- <include name="oswego.txt"/>
- <include name="public-domain.txt"/>
- <include name="slf4j.txt"/>
- <include name="sun-jaf.txt"/>
- <include name="sun-javamail.txt"/>
- <include name="xdoclet.txt"/>
- </fileset>
- <mkdir dir="output/docs/licenses"/>
- <concat destfile="output/docs/licenses/thirdparty-licenses.txt">
- <fileset refid="thirdparty-licenses"/>
- </concat>
- <copy todir="output/docs/licenses">
- <fileset refid="thirdparty-licenses"/>
- <fileset dir="licences" includes="JBossEULA.txt"/>
- </copy>
- </target>
-
- <!-- Normal build -->
- <target name="_normal.build" depends="init" unless="normal.build.done">
- <ant dir="${source.dir}/build" antfile="build.xml"/>
-
- <!-- to prevent building several times -->
- <property name="normal.build.done" value="true"/>
- </target>
-
- <!-- Build JBoss Portal artifacts -->
- <target name="source.build" depends="_normal.build">
- <!-- HA specific targets -->
- <ant dir="${source.dir}/core" antfile="build.xml" target="output-ha"/>
- <ant dir="${source.dir}/core-cms" antfile="build.xml" target="output-ha"/>
-
- <!-- Datasource files -->
- <ant dir="${source.dir}/core" antfile="build.xml" target="datasource">
- <!-- Hack because invoking the datasource generation from another build file replace ${/} -->
- <property name="/" value="${/}"/>
- </ant>
-
- <ant dir="${source.dir}/wsrp" antfile="build.xml" target="output"/>
- <ant dir="${source.dir}/wsrp" antfile="build.xml" target="explode"/>
- </target>
-
- <!-- Build JBoss Portal documentation -->
- <target name="doc.build" depends="_normal.build" unless="no-doc">
- <ant dir="${docs.dir}/referenceGuide" antfile="build.xml"/>
- <ant dir="${docs.dir}/userGuide" antfile="build.xml"/>
- <ant dir="${docs.dir}/quickstartuser" antfile="build.xml"/>
- </target>
-
- <!-- Build JBoss Portal -->
- <target name="build" depends="source.build,doc.build"/>
-
-
- <!--<macrodef name="package-doc">
- <attribute name="todir"/>
- <sequential>
- <mkdir dir="${todir}"/>
- <mkdir dir="${todir}/referenceGuide"/>
- <copy todir="${todir}/referenceGuide">
- <fileset dir="${docs.dir}/referenceGuide/build/en/"/>
- </copy>
- <mkdir dir="${todir}/userGuide"/>
- <copy todir="${todir}/userGuide">
- <fileset dir="${docs.dir}/userGuide/build/en/"/>
- </copy>
- <mkdir dir="${todir}/quickstartuser"/>
- <copy todir="${todir}/quickstartuser">
- <fileset dir="${docs.dir}/quickstartuser/build/en/"/>
- </copy>
- </sequential>
- </macrodef>-->
-
- <target name="package-doc">
- <sequential>
- <mkdir dir="${todir}"/>
- <mkdir dir="${todir}/referenceGuide"/>
- <copy todir="${todir}/referenceGuide">
- <fileset dir="${docs.dir}/referenceGuide/build/en/"/>
- </copy>
- <mkdir dir="${todir}/userGuide"/>
- <copy todir="${todir}/userGuide">
- <fileset dir="${docs.dir}/userGuide/build/en/"/>
- </copy>
- <mkdir dir="${todir}/quickstartuser"/>
- <copy todir="${todir}/quickstartuser">
- <fileset dir="${docs.dir}/quickstartuser/build/en/"/>
- </copy>
- </sequential>
- </target>
-
- <target name="package-ds">
- <sequential>
- <mkdir dir="${todir}"/>
- <copy todir="${todir}">
- <fileset dir="${source.dir}/core/output/resources/setup" includes="portal-*-ds.xml"/>
- </copy>
- </sequential>
- </target>
-
- <target name="package-samples">
- <sequential>
- <mkdir dir="${todir}"/>
- <copy todir="${todir}">
- <fileset dir="${source.dir}/core-samples/output/resources" includes="portal-basic-samples.sar/**"/>
- </copy>
- <copy file="${docs.dir}/readmeFiles/samples-readme.txt" tofile="${todir}/readme.txt"/>
- </sequential>
- </target>
-
- <target name="patch-log4j">
- <patch patchfile="${source.dir}/build/etc/resources/jboss-log4j.xml.diff"
- originalfile="${todir}/conf/jboss-log4j.xml" strip="1"/>
- </target>
-
- <!-- use -Dno-doc=true if you simply want jboss-portal.sar without licenses etc-->
- <target name="package-bin" unless="no-doc">
- <sequential>
- <mkdir dir="${todir}"/>
- <antcall target="package-doc">
- <param name="todir" value="${todir}/docs"/>
- </antcall>
- <antcall target="package-ds">
- <param name="todir" value="${todir}/setup"/>
- </antcall>
- <antcall target="package-samples">
- <param name="todir" value="${todir}/samples"/>
- </antcall>
- <copy file="${docs.dir}/readmeFiles/jboss-portal-bin.README" todir="${todir}"/>
- <copy todir="${todir}/docs/portal/licenses">
- <fileset dir="output/docs/licenses"/>
- </copy>
- </sequential>
- </target>
-
- <target name="package-bundled" unless="no-doc">
- <sequential>
- <mkdir dir="${todir}"/>
- <antcall target="package-doc">
- <param name="todir" value="${todir}/docs/portal"/>
- </antcall>
- <antcall target="package-ds">
- <param name="todir" value="${todir}/setup"/>
- </antcall>
- <antcall target="package-samples">
- <param name="todir" value="${todir}/samples"/>
- </antcall>
- <copy file="${docs.dir}/readmeFiles/jboss-portal-bin.README" todir="${todir}"/>
- <copy todir="${todir}/docs/portal/licenses">
- <fileset dir="output/docs/licenses"/>
- </copy>
- </sequential>
- </target>
-
- <!-- -->
- <target name="package">
-
- <!-- Create the output directory -->
- <mkdir dir="output"/>
-
- <!--
- | JBoss Portal source distribution
- -->
-
- <mkdir dir="${portal.build.src}"/>
- <antcall target="package-doc">
- <param name="todir" value="${portal.build.src}/docs"/>
- </antcall>
- <copy file="${docs.dir}/readmeFiles/jboss-portal-src.README" todir="${portal.build.src}"/>
- <copy todir="${portal.build.src}">
- <fileset dir="${source.dir}" includes="**/*"
- excludes="*/output/**,**/CVS/*,**/build.log,build/local.properties,forums/**,thirdparty/**"/>
- </copy>
- <copy todir="${portal.build.src}/docs/portal/licenses">
- <fileset dir="output/docs/licenses"/>
- </copy>
- <fixcrlf srcdir="${portal.build.src}" includes="**/*.sh" eol="lf" eof="remove"/>
- <fixcrlf srcdir="${portal.build.src}" includes="**/*.bat" eol="crlf"/>
-
- <!--
- | JBoss Portal binaries distribution
- -->
-
- <antcall target="package-normal"/>
- <antcall target="package-ha"/>
- <antcall target="package-normal-bundled"/>
- <antcall target="package-ha-bundled"/>
- </target>
-
- <!--
- | JBoss Portal binary distribution
- -->
-
- <target name="package-normal" description="package jboss-portal.sar">
- <mkdir dir="${portal.build.normal.bin}"/>
- <antcall target="package-bin">
- <param name="todir" value="${portal.build.normal.bin}"/>
- </antcall>
- <copy todir="${portal.build.normal.bin}/jboss-portal.sar">
- <fileset dir="${source.dir}/core/output/resources/jboss-portal.sar"/>
- </copy>
- <copy todir="${portal.build.normal.bin}/jboss-portal.sar/portal-cms.sar">
- <fileset dir="${source.dir}/core-cms/output/resources/portal-cms.sar" includes="**"/>
- </copy>
- <copy todir="${portal.build.normal.bin}/jboss-portal.sar">
- <fileset dir="${source.dir}/widget/output/resources" includes="widget.war/**"/>
- <fileset dir="${source.dir}/core-management/output/resources" includes="portal-management.sar/**"/>
- <fileset dir="${source.dir}/core-admin/output/resources" includes="portal-admin.sar/**"/>
- </copy>
- <copy todir="${portal.build.normal.bin}/jboss-portal.sar/samples">
- <fileset dir="${source.dir}/core-samples/output/resources" includes="portal-jsp-samples.war/**"/>
- <fileset dir="${source.dir}/core-samples/output/resources" includes="portal-news-samples.war/**"/>
- <fileset dir="${source.dir}/core-samples/output/resources" includes="portal-weather-samples.war/**"/>
- </copy>
- <mkdir dir="${portal.build.normal.bin}/jboss-portal.sar/portal-wsrp.sar"/>
- <copy todir="${portal.build.normal.bin}/jboss-portal.sar/portal-wsrp.sar">
- <fileset dir="${source.dir}/wsrp/output/lib/portal-wsrp-exploded.sar"/>
- </copy>
- </target>
-
- <!--
- | JBoss Portal ha binaries distribution
- -->
- <target name="package-ha" description="package jboss-portal-ha.sar">
- <mkdir dir="${portal.build.ha.bin}"/>
- <antcall target="package-bin">
- <param name="todir" value="${portal.build.ha.bin}"/>
- </antcall>
- <copy todir="${portal.build.ha.bin}/jboss-portal-ha.sar">
- <fileset dir="${source.dir}/core/output/resources/jboss-portal-ha.sar"/>
- </copy>
- <copy todir="${portal.build.ha.bin}/jboss-portal-ha.sar/portal-cms.sar">
- <fileset dir="${source.dir}/core-cms/output/resources/portal-cms-ha.sar" includes="**"/>
- </copy>
- <copy todir="${portal.build.ha.bin}/jboss-portal-ha.sar">
- <fileset dir="${source.dir}/widget/output/resources" includes="widget.war/**"/>
- <fileset dir="${source.dir}/core-management/output/resources" includes="portal-management.sar/**"/>
- <fileset dir="${source.dir}/core-admin/output/resources" includes="portal-admin.sar/**"/>
- </copy>
- <copy todir="${portal.build.ha.bin}/jboss-portal-ha.sar/samples">
- <fileset dir="${source.dir}/core-samples/output/resources" includes="portal-jsp-samples.war/**"/>
- <fileset dir="${source.dir}/core-samples/output/resources" includes="portal-news-samples.war/**"/>
- <fileset dir="${source.dir}/core-samples/output/resources" includes="portal-weather-samples.war/**"/>
- </copy>
- <mkdir dir="${portal.build.ha.bin}/jboss-portal-ha.sar/portal-wsrp.sar"/>
- <copy todir="${portal.build.ha.bin}/jboss-portal-ha.sar/portal-wsrp.sar">
- <fileset dir="${source.dir}/wsrp/output/lib/portal-wsrp-exploded.sar"/>
- </copy>
- <copy file="${docs.dir}/readmeFiles/jboss-portal-ha-bin.README" todir="${portal.build.ha.bin}"/>
- </target>
-
-
- <!--
- | JBoss Portal bundled distribution
- -->
- <target name="package-normal-bundled" depends="package-normal" if="jboss.home"
- description="package jboss-portal bundled with JBoss AS">
- <mkdir dir="${portal.build.normal.bundled}"/>
- <antcall target="package-bundled">
- <param name="todir" value="${portal.build.normal.bundled}"/>
- </antcall>
- <copy todir="${portal.build.normal.bundled}/server/default/deploy/jboss-portal.sar">
- <fileset dir="${portal.build.normal.bin}/jboss-portal.sar"/>
- </copy>
- <copy todir="${portal.build.normal.bundled}/server/default/deploy">
- <fileset dir="${portal.build.normal.bin}/setup" includes="portal-hsqldb-ds.xml"/>
- </copy>
- <copy todir="${portal.build.normal.bundled}">
- <fileset dir="${jboss.home}">
- <include name="bin/**"/>
- <include name="client/**"/>
- <include name="docs/**"/>
- <include name="lib/**"/>
- <include name="server/default/**"/>
- </fileset>
- </copy>
- <copy file="${docs.dir}/readmeFiles/jboss-portal-bin.README" todir="${portal.build.normal.bundled}"/>
- <antcall target="patch-log4j">
- <param name="todir" value="${portal.build.normal.bundled}/server/default"/>
- </antcall>
- </target>
-
- <!--
- | JBoss Portal ha bundled distribution
- -->
-
- <target name="package-ha-bundled" depends="package-ha" if="jboss.home"
- description="package jboss-portal-ha bundled with JBoss AS">
- <mkdir dir="${portal.build.ha.bundled}"/>
- <antcall target="package-bundled">
- <param name="todir" value="${portal.build.ha.bundled}"/>
- </antcall>
- <copy todir="${portal.build.ha.bundled}/server/all/deploy/jboss-portal-ha.sar">
- <fileset dir="${portal.build.ha.bin}/jboss-portal-ha.sar"/>
- </copy>
- <copy todir="${portal.build.ha.bundled}">
- <fileset dir="${jboss.home}">
- <include name="bin/**"/>
- <include name="client/**"/>
- <include name="docs/**"/>
- <include name="lib/**"/>
- <include name="server/all/**"/>
- </fileset>
- </copy>
- <copy file="${docs.dir}/readmeFiles/jboss-portal-ha-bin.README" todir="${portal.build.ha.bundled}"/>
- <antcall target="patch-log4j">
- <param name="todir" value="${portal.build.normal.bundled}/server/default"/>
- </antcall>
-
- </target>
-
- <!-- Create packages -->
- <target name="zip">
-
- <tar destfile="${portal.build.src}.tar.gz"
- compression="gzip">
- <tarfileset prefix="${portal.release.normal.name}-src" filemode="775" dir="${portal.build.src}"/>
- </tar>
- <checksum file="${portal.build.src}.tar.gz"/>
-
- <zip destfile="${portal.build.normal.bin}.zip">
- <zipfileset prefix="${portal.release.normal.name}" dir="${portal.build.normal.bin}"/>
- </zip>
- <checksum file="${portal.build.normal.bin}.zip"/>
-
- <zip destfile="${portal.build.ha.bin}.zip">
- <zipfileset prefix="${portal.release.ha.name}" dir="${portal.build.ha.bin}"/>
- </zip>
- <checksum file="${portal.build.ha.bin}.zip"/>
-
- <zip destfile="${portal.build.normal.bundled}.zip">
- <zipfileset prefix="${portal.release.normal.name}" dir="${portal.build.normal.bundled}"/>
- </zip>
- <checksum file="${portal.build.normal.bin}.zip"/>
-
- <zip destfile="${portal.build.ha.bundled}.zip">
- <zipfileset prefix="${portal.release.ha.name}" dir="${portal.build.ha.bundled}"/>
- </zip>
- <checksum file="${portal.build.ha.bundled}.zip"/>
-
- <!--
- <tar destfile="${forums.build.src}.tar.gz"
- compression="gzip">
- <tarfileset dir="output/${forums.release.name}-src"
- prefix="${forums.release.name}-src"/>
- </tar>
- <zip destfile="${forums.build.bin}.zip"
- basedir="output/${forums.release.name}"/>
- -->
- </target>
-
- <!-- Build and compress everything -->
- <target name="main" depends="licenses,build,package,zip" description="do everything - build source, doc, distro"/>
-</project>
Deleted: modules/common/trunk/common/build.bat
===================================================================
--- modules/common/trunk/common/build.bat 2007-10-04 17:58:22 UTC (rev 8532)
+++ modules/common/trunk/common/build.bat 2007-10-04 21:29:53 UTC (rev 8533)
@@ -1,54 +0,0 @@
-@echo off
-rem
-rem Invokes a script of the same name in the 'tools' module.
-rem
-rem The 'tools' module is expected to be a peer directory of the directory
-rem in which this script lives.
-rem
-rem @author Jason Dillon <jason(a)planet57.com>
-rem
-
-rem $Id: build.bat 2 2005-01-14 23:01:32Z vietj $
-
-setlocal
-
-set PROGNAME=%~nx0
-set DIRNAME=%~dp0
-
-rem Legacy shell support
-if x%PROGNAME%==x set PROGNAME=build.bat
-if x%DIRNAME%==x set DIRNAME=.\
-
-set MODULE_ROOT=%DIRNAME%
-if x%TOOLS_ROOT%==x set TOOLS_ROOT=%DIRNAME%..\tools
-set TARGET=%TOOLS_ROOT%\bin\build.bat
-set ARGS=%*
-
-rem Start'er up yo
-goto main
-
-:debug
-if not x%DEBUG%==x echo %PROGNAME%: %*
-goto :EOF
-
-:main
-call :debug PROGNAME=%PROGNAME%
-call :debug DIRNAME=%DIRNAME%
-call :debug TOOLS_ROOT=%TOOLS_ROOT%
-call :debug TARGET=%TARGET%
-
-if exist %TARGET% call :call-script & goto :EOF
-rem else fail, we can not go on
-
-echo %PROGNAME%: *ERROR* The target executable does not exist:
-echo %PROGNAME%:
-echo %PROGNAME%: %TARGET%
-echo %PROGNAME%:
-echo %PROGNAME%: Please make sure you have checked out the 'tools' module
-echo %PROGNAME%: and make sure it is up to date.
-goto :EOF
-
-:call-script
-call :debug Executing %TARGET% %ARGS%
-call %TARGET% %ARGS%
-goto :EOF
Deleted: modules/common/trunk/common/build.sh
===================================================================
--- modules/common/trunk/common/build.sh 2007-10-04 17:58:22 UTC (rev 8532)
+++ modules/common/trunk/common/build.sh 2007-10-04 21:29:53 UTC (rev 8533)
@@ -1,49 +0,0 @@
-#!/bin/sh
-##
-## Invokes a script of the same name in the 'tools' module.
-##
-## The 'tools' module is expected to be a peer directory of the directory
-## in which this script lives.
-##
-## @author Jason Dillon <jason(a)planet57.com>
-##
-
-# $Id: build.sh 2 2005-01-14 23:01:32Z vietj $
-
-PROGNAME=`basename $0`
-DIRNAME=`dirname $0`
-
-# Buss it yo
-main() {
- if [ "x$TOOLS_ROOT" = "x" ]; then
- TOOLS_ROOT=`cd $DIRNAME/../tools && pwd`
- fi
-
- MODULE_ROOT=`cd $DIRNAME; pwd`
- export TOOLS_ROOT MODULE_ROOT DEBUG TRACE
-
- # Where is the target script?
- target="$TOOLS_ROOT/bin/$PROGNAME"
- if [ ! -f "$target" ]; then
- echo "${PROGNAME}: *ERROR* The target executable does not exist:"
- echo "${PROGNAME}:"
- echo "${PROGNAME}: $target"
- echo "${PROGNAME}:"
- echo "${PROGNAME}: Please make sure you have checked out the 'tools' module"
- echo "${PROGNAME}: and make sure it is up to date."
- exit 2
- fi
-
- # Get busy yo!
- if [ "x$DEBUG" != "x" ]; then
- echo "${PROGNAME}: Executing: /bin/sh $target $@"
- fi
- if [ "x$TRACE" = "x" ]; then
- exec /bin/sh $target "$@"
- else
- exec /bin/sh -x $target "$@"
- fi
-}
-
-# Lets get ready to rumble!
-main "$@"
Deleted: modules/common/trunk/common/build.xml
===================================================================
--- modules/common/trunk/common/build.xml 2007-10-04 17:58:22 UTC (rev 8532)
+++ modules/common/trunk/common/build.xml 2007-10-04 21:29:53 UTC (rev 8533)
@@ -1,261 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE project [
- <!ENTITY buildmagic SYSTEM "../tools/etc/buildfragments/buildmagic.ent">
- <!ENTITY tools SYSTEM "../tools/etc/buildfragments/tools.ent">
- <!ENTITY libraries SYSTEM "../thirdparty/libraries.ent">
- <!ENTITY modules SYSTEM "../tools/etc/buildfragments/modules.ent">
- <!ENTITY defaults SYSTEM "../tools/etc/buildfragments/defaults.ent">
- <!ENTITY targets SYSTEM "../tools/etc/buildfragments/targets.ent">
- ]>
-
-<!-- $Id: build.xml 7453 2007-06-17 19:40:50Z julien(a)jboss.com $ -->
-
-<!--+======================================================================+-->
-<!--| JBoss Portal (The OpenSource Portal) Build File |-->
-<!--| |-->
-<!--| Distributable under LGPL license. |-->
-<!--| See terms of license at http://www.gnu.org. |-->
-<!--| |-->
-<!--| This file has been designed to work with the 'tools' module and |-->
-<!--| Buildmagic extentions. |-->
-<!--+======================================================================+-->
-
-<project default="main" name="JBoss Portal">
-
- <!--+====================================================================+-->
- <!--| Setup |-->
- <!--| |-->
- <!--| Include the common build elements. |-->
- <!--| |-->
- <!--| This defines several different targets, properties and paths. |-->
- <!--| It also sets up the basic extention tasks amoung other things. |-->
- <!--+====================================================================+-->
-
- &buildmagic;
- &modules;
- &defaults;
- &tools;
- &targets;
-
- <!-- ================================================================== -->
- <!-- Initialization -->
- <!-- ================================================================== -->
-
- <!--
- | Initialize the build system. Must depend on '_buildmagic:init'.
- | Other targets should depend on 'init' or things will mysteriously fail.
- -->
-
- <target name="init" unless="init.disable" depends="_buildmagic:init">
- </target>
-
- <!--+====================================================================+-->
- <!--| Configuration |-->
- <!--| |-->
- <!--| This target is invoked by the Buildmagic initialization logic |-->
- <!--| and should contain module specific configuration elements. |-->
- <!--+====================================================================+-->
-
- <target name="configure" unless="configure.disable">
-
- <!-- Configure some properties -->
- <property name="jboss-junit-configuration" value=""/>
- <property name="junit.formatter.usefile" value="true"/>
-
- <!-- Configure thirdparty libraries -->
- &libraries;
-
- <path id="library.classpath">
- <path refid="sun.jaf.classpath"/>
- <path refid="sun.servlet.classpath"/>
- <path refid="oswego.concurrent.classpath"/>
- <path refid="apache.ant.classpath"/>
- <path refid="apache.log4j.classpath"/>
- <pathelement location="${jbossas/core.libs.lib}jboss-j2ee.jar"/>
- <path refid="junit.junit.classpath"/>
- <path refid="apache.httpclient.classpath"/>
- <pathelement location="../tools/lib/cargo-core-uberjar-0.8.jar"/>
- <pathelement location="../tools/lib/cargo-ant-0.8.jar"/>
- <pathelement location="../tools/lib/ant-junit.jar"/>
- </path>
-
- <!-- Configure modules -->
- <call target="configure-modules"/>
- <path id="dependentmodule.classpath">
- </path>
-
- <!--+=======================================+-->
- <!--| Override any default properties here. |-->
- <!--+=======================================+-->
-
- <!-- Configure defaults & build tools -->
- <call target="configure-defaults"/>
- <call target="configure-tools"/>
-
- <!--+=======================================+-->
- <!--| Define module specific elements here. |-->
- <!--+=======================================+-->
- <property name="javadoc.private" value="true"/>
- <property name="javadoc.protected" value="false"/>
-
- </target>
-
-
- <!--+====================================================================+-->
- <!--| Compile |-->
- <!--| |-->
- <!--| This target should depend on other compile-* targets for each |-->
- <!--| different type of compile that needs to be performed, short of |-->
- <!--| documentation compiles. |-->
- <!--+====================================================================+-->
-
- <target name="compile"
- description="Compile all source files."
- depends="generate-parsers,
- _default:compile-classes,
- _default:compile-test-classes,
- _default:compile-etc,
- _default:compile-resources,
- _default:compile-test-resources">
- <!-- Add module specific elements here. -->
-
- </target>
-
- <target name="generate-parsers" depends="init">
- </target>
-
- <!--+====================================================================+-->
- <!--| Generate Output |-->
- <!--| |-->
- <!--| Generates the target output for this module. Target output is |-->
- <!--| the output which is ment to be released or used by external |-->
- <!--| modules. |-->
- <!--+====================================================================+-->
-
- <target name="output"
- description="Generate all target output."
- depends="compile">
-
- <mkdir dir="${build.lib}"/>
-
- <jar jarfile="${build.lib}/portal-common-lib.jar" manifest="${build.etc}/portal-common-lib-jar.mf">
- <fileset dir="${build.resources}/format/code"/>
- <fileset dir="${build.classes}">
- <exclude name="org/jboss/portal/common/ant/**/*"/>
- </fileset>
- </jar>
-
- <jar jarfile="${build.lib}/portal-common-test-lib.jar">
- <fileset dir="${build.test.classes}">
- <exclude name="org/jboss/portal/common/ant/**/*"/>
- </fileset>
- </jar>
-
- <!-- Build the ant task that explodes archives -->
- <jar jarfile="${build.lib}/explode.jar">
- <fileset dir="${build.classes}">
- <include name="org/jboss/portal/common/ant/**"/>
- <include name="org/jboss/portal/common/junit/ant/**"/>
- </fileset>
- </jar>
- </target>
-
- <!-- generates artifacts used for tests, requires output to be previously run -->
- <target name="package-tests" depends="init">
- <jar jarfile="${build.test.resources}/test.jar">
- <fileset dir="${build.test.resources}/test-jar"/>
- </jar>
- </target>
-
-
- <!-- ================================================================== -->
- <!-- Cleaning -->
- <!-- ================================================================== -->
-
- <!-- Clean up all build output -->
- <target name="clean" depends="_default:clean">
- <!-- Add module specific elements here. -->
- </target>
-
- <!--+====================================================================+-->
- <!--| Documents |-->
- <!--| |-->
- <!--| Generate all documentation for this module. |-->
- <!--+====================================================================+-->
-
- <target name="docs" depends="_default:docs">
- <!-- Add module specific elements here. -->
- </target>
-
- <!-- ================================================================== -->
- <!-- Misc. -->
- <!-- ================================================================== -->
-
- <target name="main" depends="most"/>
- <target name="all" depends="_default:all"/>
- <target name="most" depends="_default:most"/>
- <target name="help" depends="_default:help"/>
-
- <target name="tests" depends="init">
-
- <execute-tests>
-
- <x-sysproperty>
-<!--
- <jvmarg value="-Xdebug"/>
- <jvmarg value="-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"/>
--->
- </x-sysproperty>
-
- <x-test>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.http.QueryStringParserTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.text.FastURLDecoderTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.text.CharBufferTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.text.TextToolsTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.text.FastURLEncoderTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.text.CharToByteEncoderTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.net.URLNavigatorTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.net.URLToolsTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.io.IOToolsTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.io.WriterCharWriterTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.reflect.ReflectionTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.reflect.ModifierTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.adapter.AdapterTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.BundleNameIteratorTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.BundleNameParserTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.ComplexResourceBundleFactoryTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.MarkupTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.TypedMapTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.AbstractInvocationContextTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.LocaleFormatTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.ParentChildResourceBundleTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.ValveTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.ValueTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.DescriptionTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.TemporaryHashTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.HexTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.StringTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.JarTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.PathTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.JavaBeanModelMBeanBuilderTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.ParameterMapTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.LocalizedStringTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.ImplodeTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.BufferedStreamTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.CopyOnWriteRegistryTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.ToolsTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.IteratorStatusTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.PathMapperTestCase"/>
- </x-test>
- <x-classpath>
- <pathelement location="${build.classes}"/>
- <pathelement location="${build.test.classes}"/>
- <pathelement location="${build.test.resources}"/>
- <path refid="dom4j.dom4j.classpath"/>
- <path refid="library.classpath"/>
- <path refid="dependentmodule.classpath"/>
- </x-classpath>
- </execute-tests>
- </target>
-
-</project>
Deleted: modules/common/trunk/mc/build.bat
===================================================================
--- modules/common/trunk/mc/build.bat 2007-10-04 17:58:22 UTC (rev 8532)
+++ modules/common/trunk/mc/build.bat 2007-10-04 21:29:53 UTC (rev 8533)
@@ -1,54 +0,0 @@
-@echo off
-rem
-rem Invokes a script of the same name in the 'tools' module.
-rem
-rem The 'tools' module is expected to be a peer directory of the directory
-rem in which this script lives.
-rem
-rem @author Jason Dillon <jason(a)planet57.com>
-rem
-
-rem $Id: build.bat 2 2005-01-14 23:01:32Z vietj $
-
-setlocal
-
-set PROGNAME=%~nx0
-set DIRNAME=%~dp0
-
-rem Legacy shell support
-if x%PROGNAME%==x set PROGNAME=build.bat
-if x%DIRNAME%==x set DIRNAME=.\
-
-set MODULE_ROOT=%DIRNAME%
-if x%TOOLS_ROOT%==x set TOOLS_ROOT=%DIRNAME%..\tools
-set TARGET=%TOOLS_ROOT%\bin\build.bat
-set ARGS=%*
-
-rem Start'er up yo
-goto main
-
-:debug
-if not x%DEBUG%==x echo %PROGNAME%: %*
-goto :EOF
-
-:main
-call :debug PROGNAME=%PROGNAME%
-call :debug DIRNAME=%DIRNAME%
-call :debug TOOLS_ROOT=%TOOLS_ROOT%
-call :debug TARGET=%TARGET%
-
-if exist %TARGET% call :call-script & goto :EOF
-rem else fail, we can not go on
-
-echo %PROGNAME%: *ERROR* The target executable does not exist:
-echo %PROGNAME%:
-echo %PROGNAME%: %TARGET%
-echo %PROGNAME%:
-echo %PROGNAME%: Please make sure you have checked out the 'tools' module
-echo %PROGNAME%: and make sure it is up to date.
-goto :EOF
-
-:call-script
-call :debug Executing %TARGET% %ARGS%
-call %TARGET% %ARGS%
-goto :EOF
Deleted: modules/common/trunk/mc/build.sh
===================================================================
--- modules/common/trunk/mc/build.sh 2007-10-04 17:58:22 UTC (rev 8532)
+++ modules/common/trunk/mc/build.sh 2007-10-04 21:29:53 UTC (rev 8533)
@@ -1,49 +0,0 @@
-#!/bin/sh
-##
-## Invokes a script of the same name in the 'tools' module.
-##
-## The 'tools' module is expected to be a peer directory of the directory
-## in which this script lives.
-##
-## @author Jason Dillon <jason(a)planet57.com>
-##
-
-# $Id: build.sh 2 2005-01-14 23:01:32Z vietj $
-
-PROGNAME=`basename $0`
-DIRNAME=`dirname $0`
-
-# Buss it yo
-main() {
- if [ "x$TOOLS_ROOT" = "x" ]; then
- TOOLS_ROOT=`cd $DIRNAME/../tools && pwd`
- fi
-
- MODULE_ROOT=`cd $DIRNAME; pwd`
- export TOOLS_ROOT MODULE_ROOT DEBUG TRACE
-
- # Where is the target script?
- target="$TOOLS_ROOT/bin/$PROGNAME"
- if [ ! -f "$target" ]; then
- echo "${PROGNAME}: *ERROR* The target executable does not exist:"
- echo "${PROGNAME}:"
- echo "${PROGNAME}: $target"
- echo "${PROGNAME}:"
- echo "${PROGNAME}: Please make sure you have checked out the 'tools' module"
- echo "${PROGNAME}: and make sure it is up to date."
- exit 2
- fi
-
- # Get busy yo!
- if [ "x$DEBUG" != "x" ]; then
- echo "${PROGNAME}: Executing: /bin/sh $target $@"
- fi
- if [ "x$TRACE" = "x" ]; then
- exec /bin/sh $target "$@"
- else
- exec /bin/sh -x $target "$@"
- fi
-}
-
-# Lets get ready to rumble!
-main "$@"
Deleted: modules/common/trunk/mc/build.xml
===================================================================
--- modules/common/trunk/mc/build.xml 2007-10-04 17:58:22 UTC (rev 8532)
+++ modules/common/trunk/mc/build.xml 2007-10-04 21:29:53 UTC (rev 8533)
@@ -1,185 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ JBoss, a division of Red Hat ~
- ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
- ~ contributors as indicated by the @authors tag. See the ~
- ~ copyright.txt in the distribution for a full listing of ~
- ~ individual contributors. ~
- ~ ~
- ~ This is free software; you can redistribute it and/or modify it ~
- ~ under the terms of the GNU Lesser General Public License as ~
- ~ published by the Free Software Foundation; either version 2.1 of ~
- ~ the License, or (at your option) any later version. ~
- ~ ~
- ~ This software is distributed in the hope that it will be useful, ~
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
- ~ Lesser General Public License for more details. ~
- ~ ~
- ~ You should have received a copy of the GNU Lesser General Public ~
- ~ License along with this software; if not, write to the Free ~
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
- ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
-
-<!DOCTYPE project [
- <!ENTITY libraries SYSTEM "../thirdparty/libraries.ent">
- <!ENTITY buildmagic SYSTEM "../tools/etc/buildfragments/buildmagic.ent">
- <!ENTITY tools SYSTEM "../tools/etc/buildfragments/tools.ent">
- <!ENTITY modules SYSTEM "../tools/etc/buildfragments/modules.ent">
- <!ENTITY defaults SYSTEM "../tools/etc/buildfragments/defaults.ent">
- <!ENTITY targets SYSTEM "../tools/etc/buildfragments/targets.ent">
- ]>
-
-<!-- $Id: build.xml 7910 2007-08-14 09:46:27Z julien(a)jboss.com $ -->
-
-<!--+======================================================================+-->
-<!--| JBoss Portal (The OpenSource Portal) Build File |-->
-<!--| |-->
-<!--| Distributable under LGPL license. |-->
-<!--| See terms of license at http://www.gnu.org. |-->
-<!--| |-->
-<!--| This file has been designed to work with the 'tools' module and |-->
-<!--| Buildmagic extentions. |-->
-<!--+======================================================================+-->
-
-<project default="main" name="JBoss Portal">
-
- <!--+====================================================================+-->
- <!--| Setup |-->
- <!--| |-->
- <!--| Include the common build elements. |-->
- <!--| |-->
- <!--| This defines several different targets, properties and paths. |-->
- <!--| It also sets up the basic extention tasks amoung other things. |-->
- <!--+====================================================================+-->
-
- &buildmagic;
-
- &modules;
- &defaults;
- &tools;
- &targets;
-
- <!-- ================================================================== -->
- <!-- Initialization -->
- <!-- ================================================================== -->
-
- <!--
- | Initialize the build system. Must depend on '_buildmagic:init'.
- | Other targets should depend on 'init' or things will mysteriously fail.
- -->
-
- <target name="init" unless="init.disable" depends="_buildmagic:init">
- </target>
-
- <!--+====================================================================+-->
- <!--| Configuration |-->
- <!--| |-->
- <!--| This target is invoked by the Buildmagic initialization logic |-->
- <!--| and should contain module specific configuration elements. |-->
- <!--+====================================================================+-->
-
- <target name="configure" unless="configure.disable">
-
- <!-- Override the javadoc packages to javax.portlet.* -->
- <property name="javadoc.packages" value="org.jboss.portal.*"/>
-
- <!-- Configure thirdparty libraries -->
- &libraries;
- <path id="library.classpath">
- <path refid="junit.junit.classpath"/>
- <path refid="jboss.microcontainer.classpath"/>
- <path refid="jboss.common.classpath"/>
- <path refid="apache.log4j.classpath"/>
- <path refid="sun.servlet.classpath"/>
- </path>
-
- <!-- Configure modules -->
- <call target="configure-modules"/>
- <path id="dependentmodule.classpath">
- </path>
-
- <!--+=======================================+-->
- <!--| Override any default properties here. |-->
- <!--+=======================================+-->
-
- <!-- Configure defaults & build tools -->
- <call target="configure-defaults"/>
- <call target="configure-tools"/>
-
- <!--+=======================================+-->
- <!--| Define module specific elements here. |-->
- <!--+=======================================+-->
- <property name="javadoc.private" value="true"/>
- <property name="javadoc.protected" value="false"/>
-
- </target>
-
- <!--+====================================================================+-->
- <!--| Compile |-->
- <!--| |-->
- <!--| This target should depend on other compile-* targets for each |-->
- <!--| different type of compile that needs to be performed, short of |-->
- <!--| documentation compiles. |-->
- <!--+====================================================================+-->
-
- <target name="compile"
- description="Compile all source files."
- depends="_default:compile-classes,
- _default:compile-etc,
- _default:compile-resources">
- <!-- Add module specific elements here. -->
- </target>
-
- <!--+====================================================================+-->
- <!--| Generate Output |-->
- <!--| |-->
- <!--| Generates the target output for this module. Target output is |-->
- <!--| the output which is ment to be released or used by external |-->
- <!--| modules. |-->
- <!--+====================================================================+-->
-
- <target name="output"
- description="Generate all target output."
- depends="compile">
-
- <mkdir dir="${build.lib}"/>
-
- <jar jarfile="${build.lib}/portal-common-mc-lib.jar" manifest="${build.etc}/portal-common-mc-lib-jar.mf">
- <fileset dir="${build.classes}"/>
- </jar>
-
- </target>
-
- <!-- ================================================================== -->
- <!-- Cleaning -->
- <!-- ================================================================== -->
-
- <!-- Clean up all build output -->
- <target name="clean" depends="_default:clean">
- <!-- Add module specific elements here. -->
- </target>
-
- <!--+====================================================================+-->
- <!--| Documents |-->
- <!--| |-->
- <!--| Generate all documentation for this module. |-->
- <!--+====================================================================+-->
-
- <target name="docs" depends="_default:docs">
- <!-- Add module specific elements here. -->
- </target>
-
- <!-- ================================================================== -->
- <!-- Misc. -->
- <!-- ================================================================== -->
-
- <target name="main" depends="most"/>
- <target name="all" depends="_default:all"/>
- <target name="most" depends="_default:most"/>
- <target name="help" depends="_default:help"/>
-
- <target name="package-tests"></target>
-
-</project>
Deleted: modules/common/trunk/portal/build.bat
===================================================================
--- modules/common/trunk/portal/build.bat 2007-10-04 17:58:22 UTC (rev 8532)
+++ modules/common/trunk/portal/build.bat 2007-10-04 21:29:53 UTC (rev 8533)
@@ -1,54 +0,0 @@
-@echo off
-rem
-rem Invokes a script of the same name in the 'tools' module.
-rem
-rem The 'tools' module is expected to be a peer directory of the directory
-rem in which this script lives.
-rem
-rem @author Jason Dillon <jason(a)planet57.com>
-rem
-
-rem $Id: build.bat 2 2005-01-14 23:01:32Z vietj $
-
-setlocal
-
-set PROGNAME=%~nx0
-set DIRNAME=%~dp0
-
-rem Legacy shell support
-if x%PROGNAME%==x set PROGNAME=build.bat
-if x%DIRNAME%==x set DIRNAME=.\
-
-set MODULE_ROOT=%DIRNAME%
-if x%TOOLS_ROOT%==x set TOOLS_ROOT=%DIRNAME%..\tools
-set TARGET=%TOOLS_ROOT%\bin\build.bat
-set ARGS=%*
-
-rem Start'er up yo
-goto main
-
-:debug
-if not x%DEBUG%==x echo %PROGNAME%: %*
-goto :EOF
-
-:main
-call :debug PROGNAME=%PROGNAME%
-call :debug DIRNAME=%DIRNAME%
-call :debug TOOLS_ROOT=%TOOLS_ROOT%
-call :debug TARGET=%TARGET%
-
-if exist %TARGET% call :call-script & goto :EOF
-rem else fail, we can not go on
-
-echo %PROGNAME%: *ERROR* The target executable does not exist:
-echo %PROGNAME%:
-echo %PROGNAME%: %TARGET%
-echo %PROGNAME%:
-echo %PROGNAME%: Please make sure you have checked out the 'tools' module
-echo %PROGNAME%: and make sure it is up to date.
-goto :EOF
-
-:call-script
-call :debug Executing %TARGET% %ARGS%
-call %TARGET% %ARGS%
-goto :EOF
Deleted: modules/common/trunk/portal/build.sh
===================================================================
--- modules/common/trunk/portal/build.sh 2007-10-04 17:58:22 UTC (rev 8532)
+++ modules/common/trunk/portal/build.sh 2007-10-04 21:29:53 UTC (rev 8533)
@@ -1,49 +0,0 @@
-#!/bin/sh
-##
-## Invokes a script of the same name in the 'tools' module.
-##
-## The 'tools' module is expected to be a peer directory of the directory
-## in which this script lives.
-##
-## @author Jason Dillon <jason(a)planet57.com>
-##
-
-# $Id: build.sh 2 2005-01-14 23:01:32Z vietj $
-
-PROGNAME=`basename $0`
-DIRNAME=`dirname $0`
-
-# Buss it yo
-main() {
- if [ "x$TOOLS_ROOT" = "x" ]; then
- TOOLS_ROOT=`cd $DIRNAME/../tools && pwd`
- fi
-
- MODULE_ROOT=`cd $DIRNAME; pwd`
- export TOOLS_ROOT MODULE_ROOT DEBUG TRACE
-
- # Where is the target script?
- target="$TOOLS_ROOT/bin/$PROGNAME"
- if [ ! -f "$target" ]; then
- echo "${PROGNAME}: *ERROR* The target executable does not exist:"
- echo "${PROGNAME}:"
- echo "${PROGNAME}: $target"
- echo "${PROGNAME}:"
- echo "${PROGNAME}: Please make sure you have checked out the 'tools' module"
- echo "${PROGNAME}: and make sure it is up to date."
- exit 2
- fi
-
- # Get busy yo!
- if [ "x$DEBUG" != "x" ]; then
- echo "${PROGNAME}: Executing: /bin/sh $target $@"
- fi
- if [ "x$TRACE" = "x" ]; then
- exec /bin/sh $target "$@"
- else
- exec /bin/sh -x $target "$@"
- fi
-}
-
-# Lets get ready to rumble!
-main "$@"
Deleted: modules/common/trunk/portal/build.xml
===================================================================
--- modules/common/trunk/portal/build.xml 2007-10-04 17:58:22 UTC (rev 8532)
+++ modules/common/trunk/portal/build.xml 2007-10-04 21:29:53 UTC (rev 8533)
@@ -1,181 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ JBoss, a division of Red Hat ~
- ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
- ~ contributors as indicated by the @authors tag. See the ~
- ~ copyright.txt in the distribution for a full listing of ~
- ~ individual contributors. ~
- ~ ~
- ~ This is free software; you can redistribute it and/or modify it ~
- ~ under the terms of the GNU Lesser General Public License as ~
- ~ published by the Free Software Foundation; either version 2.1 of ~
- ~ the License, or (at your option) any later version. ~
- ~ ~
- ~ This software is distributed in the hope that it will be useful, ~
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
- ~ Lesser General Public License for more details. ~
- ~ ~
- ~ You should have received a copy of the GNU Lesser General Public ~
- ~ License along with this software; if not, write to the Free ~
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
- ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
-
-<!DOCTYPE project [
- <!ENTITY libraries SYSTEM "../thirdparty/libraries.ent">
- <!ENTITY buildmagic SYSTEM "../tools/etc/buildfragments/buildmagic.ent">
- <!ENTITY tools SYSTEM "../tools/etc/buildfragments/tools.ent">
- <!ENTITY modules SYSTEM "../tools/etc/buildfragments/modules.ent">
- <!ENTITY defaults SYSTEM "../tools/etc/buildfragments/defaults.ent">
- <!ENTITY targets SYSTEM "../tools/etc/buildfragments/targets.ent">
- ]>
-
-<!-- $Id: build.xml 7910 2007-08-14 09:46:27Z julien(a)jboss.com $ -->
-
-<!--+======================================================================+-->
-<!--| JBoss Portal (The OpenSource Portal) Build File |-->
-<!--| |-->
-<!--| Distributable under LGPL license. |-->
-<!--| See terms of license at http://www.gnu.org. |-->
-<!--| |-->
-<!--| This file has been designed to work with the 'tools' module and |-->
-<!--| Buildmagic extentions. |-->
-<!--+======================================================================+-->
-
-<project default="main" name="JBoss Portal">
-
- <!--+====================================================================+-->
- <!--| Setup |-->
- <!--| |-->
- <!--| Include the common build elements. |-->
- <!--| |-->
- <!--| This defines several different targets, properties and paths. |-->
- <!--| It also sets up the basic extention tasks amoung other things. |-->
- <!--+====================================================================+-->
-
- &buildmagic;
-
- &modules;
- &defaults;
- &tools;
- &targets;
-
- <!-- ================================================================== -->
- <!-- Initialization -->
- <!-- ================================================================== -->
-
- <!--
- | Initialize the build system. Must depend on '_buildmagic:init'.
- | Other targets should depend on 'init' or things will mysteriously fail.
- -->
-
- <target name="init" unless="init.disable" depends="_buildmagic:init">
- </target>
-
- <!--+====================================================================+-->
- <!--| Configuration |-->
- <!--| |-->
- <!--| This target is invoked by the Buildmagic initialization logic |-->
- <!--| and should contain module specific configuration elements. |-->
- <!--+====================================================================+-->
-
- <target name="configure" unless="configure.disable">
-
- <!-- Override the javadoc packages to javax.portlet.* -->
- <property name="javadoc.packages" value="org.jboss.portal.*"/>
-
- <!-- Configure thirdparty libraries -->
- &libraries;
- <path id="library.classpath">
- <path refid="junit.junit.classpath"/>
- </path>
-
- <!-- Configure modules -->
- <call target="configure-modules"/>
- <path id="dependentmodule.classpath">
- </path>
-
- <!--+=======================================+-->
- <!--| Override any default properties here. |-->
- <!--+=======================================+-->
-
- <!-- Configure defaults & build tools -->
- <call target="configure-defaults"/>
- <call target="configure-tools"/>
-
- <!--+=======================================+-->
- <!--| Define module specific elements here. |-->
- <!--+=======================================+-->
- <property name="javadoc.private" value="true"/>
- <property name="javadoc.protected" value="false"/>
-
- </target>
-
- <!--+====================================================================+-->
- <!--| Compile |-->
- <!--| |-->
- <!--| This target should depend on other compile-* targets for each |-->
- <!--| different type of compile that needs to be performed, short of |-->
- <!--| documentation compiles. |-->
- <!--+====================================================================+-->
-
- <target name="compile"
- description="Compile all source files."
- depends="_default:compile-classes,
- _default:compile-etc,
- _default:compile-resources">
- <!-- Add module specific elements here. -->
- </target>
-
- <!--+====================================================================+-->
- <!--| Generate Output |-->
- <!--| |-->
- <!--| Generates the target output for this module. Target output is |-->
- <!--| the output which is ment to be released or used by external |-->
- <!--| modules. |-->
- <!--+====================================================================+-->
-
- <target name="output"
- description="Generate all target output."
- depends="compile">
-
- <mkdir dir="${build.lib}"/>
-
- <jar jarfile="${build.lib}/portal-common-portal-lib.jar" manifest="${build.etc}/portal-common-portal-lib-jar.mf">
- <fileset dir="${build.classes}"/>
- </jar>
-
- </target>
-
- <!-- ================================================================== -->
- <!-- Cleaning -->
- <!-- ================================================================== -->
-
- <!-- Clean up all build output -->
- <target name="clean" depends="_default:clean">
- <!-- Add module specific elements here. -->
- </target>
-
- <!--+====================================================================+-->
- <!--| Documents |-->
- <!--| |-->
- <!--| Generate all documentation for this module. |-->
- <!--+====================================================================+-->
-
- <target name="docs" depends="_default:docs">
- <!-- Add module specific elements here. -->
- </target>
-
- <!-- ================================================================== -->
- <!-- Misc. -->
- <!-- ================================================================== -->
-
- <target name="main" depends="most"/>
- <target name="all" depends="_default:all"/>
- <target name="most" depends="_default:most"/>
- <target name="help" depends="_default:help"/>
-
- <target name="package-tests"></target>
-
-</project>
16 years, 8 months
JBoss Portal SVN: r8532 - modules/common/trunk.
by portal-commits@lists.jboss.org
Author: wesleyhales
Date: 2007-10-04 13:58:22 -0400 (Thu, 04 Oct 2007)
New Revision: 8532
Modified:
modules/common/trunk/pom.xml
Log:
add a 3rd party repo until I get permission to upload to respository.jboss.org/maven2
Modified: modules/common/trunk/pom.xml
===================================================================
--- modules/common/trunk/pom.xml 2007-10-04 17:57:17 UTC (rev 8531)
+++ modules/common/trunk/pom.xml 2007-10-04 17:58:22 UTC (rev 8532)
@@ -11,6 +11,15 @@
<dependencies/>
<repositories>
+ <repository>
+ <id>repository.maven.org</id>
+ <name>Maven Repository</name>
+ <layout>default</layout>
+ <url>http://repo1.maven.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
<repository>
<id>repository.jboss.org</id>
<name>JBoss Repository</name>
16 years, 8 months
JBoss Portal SVN: r8531 - modules/common/trunk/common.
by portal-commits@lists.jboss.org
Author: wesleyhales
Date: 2007-10-04 13:57:17 -0400 (Thu, 04 Oct 2007)
New Revision: 8531
Modified:
modules/common/trunk/common/pom.xml
Log:
get rid of system dependencies
Modified: modules/common/trunk/common/pom.xml
===================================================================
--- modules/common/trunk/common/pom.xml 2007-10-04 13:49:07 UTC (rev 8530)
+++ modules/common/trunk/common/pom.xml 2007-10-04 17:57:17 UTC (rev 8531)
@@ -92,26 +92,20 @@
<dependency>
<groupId>ant</groupId>
- <artifactId>ant-launcher</artifactId>
- <version>0.1</version>
- <scope>system</scope>
- <systemPath>${basedir}/../tools/lib/ant-launcher.jar</systemPath>
+ <artifactId>ant-nodeps</artifactId>
+ <version>1.6.5</version>
</dependency>
<dependency>
<groupId>ant</groupId>
- <artifactId>ant-nodeps</artifactId>
- <version>0.1</version>
- <scope>system</scope>
- <systemPath>${basedir}/../tools/lib/ant-nodeps.jar</systemPath>
+ <artifactId>ant-launcher</artifactId>
+ <version>1.6.5</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>0.1</version>
- <scope>system</scope>
- <systemPath>${basedir}/../tools/lib/junit.jar</systemPath>
+ <version>3.8.1</version>
</dependency>
</dependencies>
16 years, 8 months
JBoss Portal SVN: r8530 - modules/common/trunk.
by portal-commits@lists.jboss.org
Author: wesleyhales
Date: 2007-10-04 09:49:07 -0400 (Thu, 04 Oct 2007)
New Revision: 8530
Added:
modules/common/trunk/pom.xml
Log:
move root pom to trunk
Added: modules/common/trunk/pom.xml
===================================================================
--- modules/common/trunk/pom.xml (rev 0)
+++ modules/common/trunk/pom.xml 2007-10-04 13:49:07 UTC (rev 8530)
@@ -0,0 +1,181 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.portal.common</groupId>
+ <artifactId>jboss-portal-modules-common-root</artifactId>
+ <packaging>pom</packaging>
+ <name>Jboss Portal Modules Common</name>
+ <version>1.1.0-SNAPSHOT</version>
+ <url>http://labs.jboss.com/jbossportal</url>
+
+ <dependencies/>
+
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <layout>default</layout>
+ <url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshots Repository</name>
+ <layout>default</layout>
+ <url>http://snapshots.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </repository>
+ </repositories>
+
+ <build>
+ <extensions>
+ <extension>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-webdav</artifactId>
+ <version>1.0-beta-2</version>
+ </extension>
+ </extensions>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <inherited>true</inherited>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ <showDeprecation>true</showDeprecation>
+ <showWarnings>true</showWarnings>
+ <optimize>true</optimize>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jboss-packaging-maven-plugin</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <extensions>true</extensions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-idea-plugin</artifactId>
+ <configuration>
+ <downloadSources>true</downloadSources>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jboss-deploy-plugin</artifactId>
+ <version>1.3</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>jboss-deploy</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <jbossDeployRoot>${jboss.repository.root}</jbossDeployRoot>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <distributionManagement>
+ <!--<repository>-->
+ <!--Copy the distribution jar file to a local checkout of the maven repository
+ - This variable can be set in $MAVEN_HOME/conf/settings.xml-->
+ <!--<id>repository.jboss.org</id>-->
+ <!--<url>file://${jboss.repository.root}</url>-->
+ <!--</repository>-->
+ <snapshotRepository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshot Repository</name>
+ <url>dav:https://snapshots.jboss.org/maven2</url>
+ <uniqueVersion>true</uniqueVersion>
+ </snapshotRepository>
+ </distributionManagement>
+
+ <modules>
+ <module>common</module>
+ <module>mc</module>
+ <module>portal</module>
+ </modules>
+
+
+ <issueManagement>
+ <system>JIRA</system>
+ <url>http://jira.jboss.com/jira/browse/JBPORTAL</url>
+ </issueManagement>
+ <ciManagement>
+ <system>cruisecontrol</system>
+ </ciManagement>
+
+ <licenses>
+ <license>
+ <name>LGPL 2.1</name>
+ <url>http://www.gnu.org/licenses/lgpl.html</url>
+ <distribution>repo</distribution>
+ <comments>
+ GNU LESSER GENERAL PUBLIC LICENSE Version 2.1
+ </comments>
+ </license>
+ </licenses>
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/portal/trunk</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/portal/trunk</developerConnection>
+ <url>https://svn.jboss.org/repos/portal/trunk</url>
+ </scm>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <artifactId>maven-changes-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ <version>2.0</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-jxr-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <configuration>
+ <linkXref>true</linkXref>
+ <targetJdk>1.5</targetJdk>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <properties/>
+
+</project>
\ No newline at end of file
16 years, 8 months
JBoss Portal SVN: r8529 - modules/common.
by portal-commits@lists.jboss.org
Author: wesleyhales
Date: 2007-10-04 09:46:53 -0400 (Thu, 04 Oct 2007)
New Revision: 8529
Removed:
modules/common/pom.xml
Log:
move to trunk
Deleted: modules/common/pom.xml
===================================================================
--- modules/common/pom.xml 2007-10-04 09:46:25 UTC (rev 8528)
+++ modules/common/pom.xml 2007-10-04 13:46:53 UTC (rev 8529)
@@ -1,181 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.portal.common</groupId>
- <artifactId>jboss-portal-modules-common-root</artifactId>
- <packaging>pom</packaging>
- <name>Jboss Portal Modules Common</name>
- <version>1.0-SNAPSHOT</version>
- <url>http://labs.jboss.com/jbossportal</url>
-
- <dependencies/>
-
- <repositories>
- <repository>
- <id>repository.jboss.org</id>
- <name>JBoss Repository</name>
- <layout>default</layout>
- <url>http://repository.jboss.org/maven2/</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- <repository>
- <id>snapshots.jboss.org</id>
- <name>JBoss Snapshots Repository</name>
- <layout>default</layout>
- <url>http://snapshots.jboss.org/maven2/</url>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <releases>
- <enabled>false</enabled>
- </releases>
- </repository>
- </repositories>
-
- <build>
- <extensions>
- <extension>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-webdav</artifactId>
- <version>1.0-beta-2</version>
- </extension>
- </extensions>
- <pluginManagement>
- <plugins>
- <plugin>
- <inherited>true</inherited>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- <showDeprecation>true</showDeprecation>
- <showWarnings>true</showWarnings>
- <optimize>true</optimize>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <configuration>
- <archive>
- <manifest>
- <addClasspath>true</addClasspath>
- </manifest>
- </archive>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>jboss-packaging-maven-plugin</artifactId>
- <version>2.0-SNAPSHOT</version>
- <extensions>true</extensions>
- </plugin>
- <plugin>
- <artifactId>maven-idea-plugin</artifactId>
- <configuration>
- <downloadSources>true</downloadSources>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.jboss.maven.plugins</groupId>
- <artifactId>maven-jboss-deploy-plugin</artifactId>
- <version>1.3</version>
- <executions>
- <execution>
- <goals>
- <goal>jboss-deploy</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <jbossDeployRoot>${jboss.repository.root}</jbossDeployRoot>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
-
- <distributionManagement>
- <!--<repository>-->
- <!--Copy the distribution jar file to a local checkout of the maven repository
- - This variable can be set in $MAVEN_HOME/conf/settings.xml-->
- <!--<id>repository.jboss.org</id>-->
- <!--<url>file://${jboss.repository.root}</url>-->
- <!--</repository>-->
- <snapshotRepository>
- <id>snapshots.jboss.org</id>
- <name>JBoss Snapshot Repository</name>
- <url>dav:https://snapshots.jboss.org/maven2</url>
- <uniqueVersion>true</uniqueVersion>
- </snapshotRepository>
- </distributionManagement>
-
- <modules>
- <module>trunk/common</module>
- <module>trunk/mc</module>
- <module>trunk/portal</module>
- </modules>
-
-
- <issueManagement>
- <system>JIRA</system>
- <url>http://jira.jboss.com/jira/browse/JBPORTAL</url>
- </issueManagement>
- <ciManagement>
- <system>cruisecontrol</system>
- </ciManagement>
-
- <licenses>
- <license>
- <name>LGPL 2.1</name>
- <url>http://www.gnu.org/licenses/lgpl.html</url>
- <distribution>repo</distribution>
- <comments>
- GNU LESSER GENERAL PUBLIC LICENSE Version 2.1
- </comments>
- </license>
- </licenses>
- <scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/portal/trunk</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/portal/trunk</developerConnection>
- <url>https://svn.jboss.org/repos/portal/trunk</url>
- </scm>
-
- <reporting>
- <plugins>
- <plugin>
- <artifactId>maven-changes-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-checkstyle-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>cobertura-maven-plugin</artifactId>
- <version>2.0</version>
- </plugin>
- <plugin>
- <artifactId>maven-javadoc-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-jxr-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-pmd-plugin</artifactId>
- <configuration>
- <linkXref>true</linkXref>
- <targetJdk>1.5</targetJdk>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-report-plugin</artifactId>
- </plugin>
- </plugins>
- </reporting>
-
- <properties/>
-
-</project>
\ No newline at end of file
16 years, 8 months
JBoss Portal SVN: r8528 - in modules/test/trunk/unit/src/main/org/jboss: unit/report/junit and 1 other directory.
by portal-commits@lists.jboss.org
Author: emuckenhuber
Date: 2007-10-04 05:46:25 -0400 (Thu, 04 Oct 2007)
New Revision: 8528
Added:
modules/test/trunk/unit/src/main/org/jboss/test/unit/blah/BlahTestTwo.java
modules/test/trunk/unit/src/main/org/jboss/unit/report/junit/JUnitTestReport.java
Modified:
modules/test/trunk/unit/src/main/org/jboss/unit/report/junit/JUnitReporter.java
modules/test/trunk/unit/src/main/org/jboss/unit/report/junit/XMLConstants.java
Log:
- inital junit xml reporter import
Added: modules/test/trunk/unit/src/main/org/jboss/test/unit/blah/BlahTestTwo.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/blah/BlahTestTwo.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/blah/BlahTestTwo.java 2007-10-04 09:46:25 UTC (rev 8528)
@@ -0,0 +1,61 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.test.unit.blah;
+
+import java.io.InputStream;
+
+import org.jboss.test.unit.PrintListener;
+import org.jboss.unit.report.junit.JUnitReporter;
+import org.jboss.unit.runner.TestRunner;
+import org.jboss.unit.runner.TestRunnerEventListener;
+import org.jboss.unit.runner.model.ModelBuilder;
+import org.jboss.unit.runner.model.TestSuiteDef;
+import org.xml.sax.InputSource;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class BlahTestTwo
+{
+
+ public static void main(String[] args) throws Exception
+ {
+
+ InputStream in = BlahTests.class.getResourceAsStream("f1.xml");
+ InputSource source = new InputSource(in);
+ ModelBuilder builder = new ModelBuilder(source);
+ TestSuiteDef suite = builder.build();
+
+ TestRunner runner = suite.createRunner();
+
+ TestRunnerEventListener junitReporter = new JUnitReporter("output", BlahTestTwo.class.getName());
+ // add listeners
+ runner.addListener(junitReporter);
+ runner.addListener(new PrintListener());
+
+ // run the test
+ runner.run();
+
+ }
+}
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/report/junit/JUnitReporter.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/report/junit/JUnitReporter.java 2007-10-04 00:13:14 UTC (rev 8527)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/report/junit/JUnitReporter.java 2007-10-04 09:46:25 UTC (rev 8528)
@@ -22,20 +22,142 @@
******************************************************************************/
package org.jboss.unit.report.junit;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintStream;
+
import org.jboss.unit.runner.TestRunnerEventListener;
import org.jboss.unit.runner.TestRunnerEvent;
+import org.jboss.unit.runner.event.EndRunnerEvent;
+import org.jboss.unit.runner.event.EndTestEvent;
+import org.jboss.unit.runner.event.RunnerFailureEvent;
+import org.jboss.unit.runner.event.StartRunnerEvent;
+import org.jboss.unit.runner.event.StartTestEvent;
/**
- * @todo
*
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
* @version $Revision: 1.1 $
*/
public class JUnitReporter implements TestRunnerEventListener
{
-
+ /** The JUnit test report */
+ private JUnitTestReport report;
+
+ /** The system error printStream */
+ private ByteArrayOutputStream systemError;
+
+ /** The system out printStream */
+ private ByteArrayOutputStream systemOut;
+
+ /** To dir */
+ private static String toDir;
+
+ public JUnitReporter(String reportToDir,
+ String testSuiteName)
+ {
+ this.report = new JUnitTestReport(testSuiteName);
+ toDir = reportToDir;
+ // redirecting system out and err
+ this.systemError = new ByteArrayOutputStream();
+ this.systemOut = new ByteArrayOutputStream();
+ this.setStreams(systemError, systemOut);
+ }
+
public void onEvent(TestRunnerEvent event)
{
+ if (event instanceof StartRunnerEvent)
+ {
+ report.startTestSuite((StartRunnerEvent) event);
+ }
+ else if (event instanceof EndRunnerEvent)
+ {
+ // append system out and system err
+ report.appendSystemError(systemError.toString());
+ report.appendSystemOutput(systemOut.toString());
+
+ // Testsuite End
+ report.endTestSuite((EndRunnerEvent) event);
+
+ // Export xml
+ report.exportXML(toDir);
+ }
+ else if (event instanceof RunnerFailureEvent)
+ {
+ report.runnerFailed((RunnerFailureEvent) event);
+ }
+ else if (event instanceof StartTestEvent)
+ {
+ report.startTest((StartTestEvent) event);
+ }
+ else if (event instanceof EndTestEvent)
+ {
+ report.endTest((EndTestEvent) event);
+ }
+ }
+
+ private void setStreams(ByteArrayOutputStream a, ByteArrayOutputStream b)
+ {
+ PrintStream savedError = System.err;
+ PrintStream savedOut = System.out;
+
+ System.setErr(new PrintStream(new CaptureOutputStream(savedError, a)));
+ System.setOut(new PrintStream(new CaptureOutputStream(savedOut, b)));
+
+ }
+
+ private class CaptureOutputStream extends OutputStream
+ {
+ private OutputStream s1;
+ private OutputStream s2;
+
+ public CaptureOutputStream(OutputStream s1, OutputStream s2)
+ {
+ this.s1 = s1;
+ this.s2 = s2;
+ }
+
+ @Override
+ public void close() throws IOException
+ {
+ try
+ {
+ s1.close();
+ }
+ finally
+ {
+ s2.close();
+ }
+ }
+ @Override
+ public void flush() throws IOException
+ {
+ s1.flush();
+ s2.flush();
+ }
+
+ @Override
+ public void write(int b) throws IOException
+ {
+ s1.write(b);
+ s2.write(b);
+ }
+
+ @Override
+ public void write(byte[] b) throws IOException
+ {
+ s1.write(b);
+ s2.write(b);
+ }
+
+ @Override
+ public void write(byte[] b, int off, int len) throws IOException
+ {
+ s1.write(b, off, len);
+ s2.write(b, off, len);
+ }
}
}
Added: modules/test/trunk/unit/src/main/org/jboss/unit/report/junit/JUnitTestReport.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/report/junit/JUnitTestReport.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/report/junit/JUnitTestReport.java 2007-10-04 09:46:25 UTC (rev 8528)
@@ -0,0 +1,292 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.unit.report.junit;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Iterator;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.jboss.unit.Failure;
+import org.jboss.unit.FailureType;
+import org.jboss.unit.TestId;
+import org.jboss.unit.runner.TestResult;
+import org.jboss.unit.runner.event.EndRunnerEvent;
+import org.jboss.unit.runner.event.EndTestEvent;
+import org.jboss.unit.runner.event.RunnerFailureEvent;
+import org.jboss.unit.runner.event.StartRunnerEvent;
+import org.jboss.unit.runner.event.StartTestEvent;
+import org.jboss.unit.runner.results.TestFailure;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class JUnitTestReport
+{
+
+ /** The test suite name */
+ private String testSuiteName;
+
+ /** The line separator */
+ private final static String ls = System.getProperty("line.separator");
+
+ /** The document */
+ private Document document;
+
+ /** The root element */
+ private Element rootElement;
+
+ /** The system error */
+ private StringBuffer systemErr = new StringBuffer();
+
+ /** The system output */
+ private StringBuffer systemOut = new StringBuffer();
+
+ /** The test count */
+ private int tests;
+
+ /** The error count */
+ private int errors;
+
+ /** The failed count */
+ private int failed;
+
+ public JUnitTestReport(String testSuiteName)
+ {
+ this.testSuiteName = testSuiteName;
+ }
+
+
+ public void startTestSuite(StartRunnerEvent event)
+ {
+ this.document = getDocumentBuilder().newDocument();
+ this.rootElement = this.document.createElement(XMLConstants.TESTSUITE);
+ this.rootElement.setAttribute(XMLConstants.TIMESTAMP, getTimestamp());
+ this.rootElement.setAttribute(XMLConstants.HOSTNAME, getHostName());
+ this.rootElement.setAttribute(XMLConstants.ATTR_NAME, this.testSuiteName);
+ Element properties = document.createElement(XMLConstants.PROPERTIES);
+ this.rootElement.appendChild(properties);
+ // add properties list
+
+ }
+
+ public void startTest(StartTestEvent event)
+ {
+ this.tests++;
+ }
+
+ public void runnerFailed(RunnerFailureEvent event)
+ {
+ this.tests++;
+ this.errors++;
+ Element e = document.createElement(XMLConstants.ERROR);
+ e.appendChild(document.createCDATASection(ls + event.getFailure().getMessage() + ls + stackToString(event.getFailure().getCause())));
+ rootElement.appendChild(e);
+ }
+
+ public void endTest(EndTestEvent event)
+ {
+ TestId testId = event.getTestId();
+ TestResult result = event.getTestResult();
+ Element test = document.createElement(XMLConstants.TESTCASE);
+ // The test name
+ StringBuffer nb = new StringBuffer();
+ for(int i = 0; i < testId.getLength(); i ++)
+ {
+ if (i > 0)
+ {
+ nb.append(".");
+ }
+ nb.append(testId.getName(i));
+ }
+ String testName = nb.toString();
+ // Test parameters
+ StringBuffer parameters = new StringBuffer();
+ for(Iterator<String> i = result.getParametrization().values().iterator(); i.hasNext(); )
+ {
+ String name = i.next();
+ String value = result.getParametrization().get(name);
+ parameters.append(name + "=" + value + "?");
+ }
+
+ if ( parameters.length() > 0)
+ testName = testName + "?" + parameters.toString();
+
+ test.setAttribute(XMLConstants.ATTR_NAME, testName);
+ // Testcase time
+ test.setAttribute(XMLConstants.ATTR_TIME, new Long(result.getDurationMillis()).toString());
+ // If test failed
+ if (result instanceof TestFailure)
+ {
+ TestFailure testFailure = (TestFailure) result;
+ Failure failure = testFailure.getFailure();
+
+ String failureType;
+ // Check failure type (failed, error)
+ if(FailureType.ASSERTION == failure.getType())
+ {
+ this.failed++;
+ failureType = XMLConstants.FAILURE;
+ }
+ else
+ {
+ this.errors++;
+ failureType = XMLConstants.ERROR;
+ }
+
+ test.appendChild(addError(failureType, failure.getCause()));
+ }
+ this.rootElement.appendChild(test);
+ }
+
+ public void endTestSuite(EndRunnerEvent event)
+ {
+ // Testsuite counts (tests, errors, failures)
+ this.rootElement.setAttribute(XMLConstants.ATTR_TESTS, Integer.toString(this.tests));
+ this.rootElement.setAttribute(XMLConstants.ATTR_ERRORS, Integer.toString(this.errors));
+ this.rootElement.setAttribute(XMLConstants.ATTR_FAILURES, Integer.toString(this.failed));
+
+ // Testsuite system-err
+ Element systemError = document.createElement(XMLConstants.SYSTEM_ERR);
+ systemError.appendChild(document.createCDATASection(systemErr.toString()));
+ // Testsuite system-out
+ Element systemOutElement = document.createElement(XMLConstants.SYSTEM_OUT);
+ systemOutElement.appendChild(document.createCDATASection(systemOut.toString()));
+
+ this.rootElement.appendChild(systemError);
+ this.rootElement.appendChild(systemOutElement);
+
+ // System.out.println(exportXML());
+ }
+
+ public void appendSystemOutput(String output)
+ {
+ this.systemOut.append(output);
+ }
+
+ public void appendSystemError(String error)
+ {
+ this.systemErr.append(error);
+ }
+
+ public void exportXML(String toDir)
+ {
+ try
+ {
+ File file = new File(toDir + "/" + "TEST-" + testSuiteName + ".xml");
+
+ Source source = new DOMSource(this.rootElement);
+ Transformer xtrans = TransformerFactory.newInstance().newTransformer();
+ xtrans.setOutputProperty(OutputKeys.INDENT, "yes");
+ Result result = new StreamResult(new FileOutputStream(file));
+ xtrans.transform(source, result);
+ }
+ catch(FileNotFoundException e)
+ {
+ e.printStackTrace();
+ }
+ catch(TransformerException e)
+ {
+ e.printStackTrace();
+ }
+ catch(IllegalArgumentException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private Element addError(String type, Throwable t)
+ {
+ Element error = document.createElement(type);
+ // Testcase error message
+ error.setAttribute(XMLConstants.ATTR_MESSAGE, t.getMessage());
+ // Testcase error type
+ error.setAttribute(XMLConstants.ATTR_TYPE, t.getClass().getName());
+ // Testcase stacktrace
+ error.appendChild(document.createCDATASection(stackToString(t)));
+ return error;
+ }
+
+ private static String stackToString(Throwable t)
+ {
+ final Writer writer = new StringWriter();
+ final PrintWriter printWriter = new PrintWriter(writer);
+ t.printStackTrace(printWriter);
+ printWriter.flush();
+ printWriter.close();
+ return writer.toString();
+ }
+
+ private static String getTimestamp()
+ {
+ SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
+ return date.format(new Date());
+ }
+
+ private static String getHostName()
+ {
+ try
+ {
+ return InetAddress.getLocalHost().getHostName();
+ }
+ catch(UnknownHostException e)
+ {
+ return "localhost";
+ }
+ }
+
+ private static DocumentBuilder getDocumentBuilder()
+ {
+ try
+ {
+ return DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ }
+ catch(ParserConfigurationException e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+}
\ No newline at end of file
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/report/junit/XMLConstants.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/report/junit/XMLConstants.java 2007-10-04 00:13:14 UTC (rev 8527)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/report/junit/XMLConstants.java 2007-10-04 09:46:25 UTC (rev 8528)
@@ -92,6 +92,13 @@
/** id attribute */
public static final String ATTR_ID = "id";
+
+ /** timestamp of test cases */
+ public static final String TIMESTAMP = "timestamp";
+
+ /** name of host running the tests */
+ public static final String HOSTNAME = "hostname";
+
}
/*
16 years, 8 months