Author: julien(a)jboss.com
Date: 2007-01-30 10:43:16 -0500 (Tue, 30 Jan 2007)
New Revision: 6125
Modified:
trunk/core/build.xml
trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java
Log:
- make ProducerTestCase tearDown() called
- enable tests to run on ProducerTestCase
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2007-01-30 13:36:59 UTC (rev 6124)
+++ trunk/core/build.xml 2007-01-30 15:43:16 UTC (rev 6125)
@@ -549,6 +549,7 @@
</x-sysproperty>
<x-test>
+<!--
<zest todir="${test.reports}"
name="org.jboss.portal.test.core.model.portal.PortalObjectContainerTestCase"
outfile="TEST-PortalObjectContainerTestCase">
<parameter name="CacheNaturalId" value="true"/>
@@ -577,18 +578,23 @@
<parameter name="CloneOnCreate" value="false"/>
<parameter name="CacheNaturalId" value="true"/>
</zest>
+-->
<zest todir="${test.reports}"
name="org.jboss.portal.test.core.state.ProducerTestCase"
outfile="TEST-ProducerTestCase">
</zest>
+<!--
<zest todir="${test.reports}"
name="org.jboss.portal.test.core.state.RegistrationPersistenceManagerTestCase"
outfile="TEST-RegistrationPersistenceManagerTestCase">
</zest>
+-->
+<!--
<test todir="${test.reports}"
name="org.jboss.portal.test.core.deployment.JBossApplicationMetaDataFactoryTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.core.model.portal.PortalObjectPermissionTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.core.model.portal.PortalObjectIdTestCase"/>
+-->
</x-test>
<x-classpath>
<pathelement location="${build.lib}/portal-core-lib.jar"/>
@@ -665,4 +671,16 @@
</junit>
</target>
+
+ <target name="reports" depends="init">
+ <mkdir dir="${build.reports}"/>
+ <property name="test.reports"
value="${module.output}/tests"/>
+ <junitreport todir="${build.reports}">
+ <fileset dir="${test.reports}">
+ <include name="TEST-*.xml"/>
+ </fileset>
+ <report format="frames"
todir="${build.reports}/html"/>
+ </junitreport>
+ </target>
+
</project>
Modified: trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java 2007-01-30
13:36:59 UTC (rev 6124)
+++ trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java 2007-01-30
15:43:16 UTC (rev 6125)
@@ -43,6 +43,7 @@
import org.jboss.portal.portlet.NoSuchPortletException;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletContext;
+import org.jboss.portal.portlet.info.MetaInfo;
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
@@ -183,8 +184,8 @@
portletContainer.addPortlet("SimplePortlet", new PortletSupport()
{
{
- PreferencesInfoSupport prefs = info.getPreferencesSupport();
- prefs.addPreference("abc", new StringValue("def"));
+ info.getPreferencesSupport().addPreference("abc", new
StringValue("def"));
+ info.getMetaSupport().setDisplayName("SimplePortlet");
}
public PortletInvocationResponse invoke(PortletInvocation invocation)
@@ -248,7 +249,7 @@
});
}
- protected void tearDown() throws Exception
+ public void tearDown() throws Exception
{
// Cleanup any pending transaction
TransactionAssert.endTransaction();
@@ -309,7 +310,7 @@
// todo check state
}
- public void _testCloneNullPortletWithinTx() throws Exception
+ public void testCloneNullPortletWithinTx() throws Exception
{
try
{
@@ -323,7 +324,7 @@
}
}
- public void _testCloneExistingPortletWithinTx() throws Exception
+ public void testCloneExistingPortletWithinTx() throws Exception
{
// Clone a POP
TransactionAssert.beginTransaction();
@@ -371,7 +372,7 @@
TransactionAssert.commitTransaction();
}
- public void _testDestroyNonExistingPortletWithinTx() throws Exception
+ public void testDestroyNonExistingPortletWithinTx() throws Exception
{
TransactionAssert.beginTransaction();
List failures =
producer.destroyClones(Collections.singletonList(PortletContext.createPortletContext("_1")));
@@ -379,7 +380,7 @@
TransactionAssert.commitTransaction();
}
- public void _testDestroyNullPortletWithinTx() throws Exception
+ public void testDestroyNullPortletWithinTx() throws Exception
{
try
{
@@ -409,7 +410,7 @@
}
*/
- public void _testDestroyPortletWithinTx() throws Exception
+ public void testDestroyPortletWithinTx() throws Exception
{
// Clone a POP 2 times
TransactionAssert.beginTransaction();
@@ -448,7 +449,7 @@
TransactionAssert.commitTransaction();
}
- public void _testInvokeCloneBeforeWritePOPWithinTx() throws Exception
+ public void testInvokeCloneBeforeWritePOPWithinTx() throws Exception
{
TransactionAssert.beginTransaction();
PortletInvocation action = new ActionInvocation(new ActionContextImpl(Mode.VIEW));
@@ -474,7 +475,7 @@
TransactionAssert.commitTransaction();
}
- public void _testInvokeReadWritePOPWithinTx() throws Exception
+ public void testInvokeReadWritePOPWithinTx() throws Exception
{
TransactionAssert.beginTransaction();
PortletInvocation action = new ActionInvocation(new ActionContextImpl(Mode.VIEW));
@@ -492,7 +493,7 @@
TransactionAssert.commitTransaction();
}
- public void _testInvokeReadOnlyPOPWithinTx() throws Exception
+ public void testInvokeReadOnlyPOPWithinTx() throws Exception
{
TransactionAssert.beginTransaction();
PortletInvocation action = new ActionInvocation(new ActionContextImpl(Mode.VIEW));
@@ -510,7 +511,7 @@
TransactionAssert.commitTransaction();
}
- public void _testInvokeCloneBeforeWriteCCPWithinTx() throws Exception
+ public void testInvokeCloneBeforeWriteCCPWithinTx() throws Exception
{
TransactionAssert.beginTransaction();
PortletContext cloningPortletId =
producer.createClone(PortletContext.createPortletContext("CloningPortlet"));
@@ -549,7 +550,7 @@
TransactionAssert.commitTransaction();
}
- public void _testInvokeReadWriteCCPWithinTx() throws Exception
+ public void testInvokeReadWriteCCPWithinTx() throws Exception
{
TransactionAssert.beginTransaction();
PortletContext cloningPortletId =
producer.createClone(PortletContext.createPortletContext("CloningPortlet"));
@@ -579,7 +580,7 @@
TransactionAssert.commitTransaction();
}
- public void _testInvokeReadOnlyCCPWithinTx() throws Exception
+ public void testInvokeReadOnlyCCPWithinTx() throws Exception
{
TransactionAssert.beginTransaction();
PortletContext cloneFailedCloningPortletId =
producer.createClone(PortletContext.createPortletContext("CloneFailedCloningPortlet"));
@@ -601,7 +602,7 @@
TransactionAssert.commitTransaction();
}
- public void _testInvokeCloneBeforeWritePOPWithinTxThrowsException() throws Exception
+ public void testInvokeCloneBeforeWritePOPWithinTxThrowsException() throws Exception
{
TransactionAssert.beginTransaction();
PortletInvocation action = new ActionInvocation(new ActionContextImpl(Mode.VIEW));
@@ -638,28 +639,30 @@
}
/** todo : should check the portlet metadata as well */
- public void _testGetPortlet() throws Exception
+ public void testGetPortlet() throws Exception
{
// Clone a POP
TransactionAssert.beginTransaction();
- PortletContext cloneId =
producer.createClone(PortletContext.createPortletContext("SimplePortlet"));
+ PortletContext cloneContext =
producer.createClone(PortletContext.createPortletContext("SimplePortlet"));
TransactionAssert.commitTransaction();
//
TransactionAssert.beginTransaction();
- Portlet portlet =
producer.getPortlet(PortletContext.createPortletContext(cloneId.getId()));
- assertEquals("SimplePortlet", portlet.getContext().getId());
+ Portlet portlet = producer.getPortlet(cloneContext);
+ assertEquals(cloneContext, portlet.getContext());
+ assertEquals("SimplePortlet",
portlet.getInfo().getMeta().getMetaValue(MetaInfo.DISPLAY_NAME).getDefaultString());
TransactionAssert.commitTransaction();
// Clone the modified CCP
TransactionAssert.beginTransaction();
- PortletContext cloneCloneId = producer.createClone(cloneId);
+ PortletContext cloneCloneContext = producer.createClone(cloneContext);
TransactionAssert.commitTransaction();
//
TransactionAssert.beginTransaction();
- portlet =
producer.getPortlet(PortletContext.createPortletContext(cloneCloneId.getId()));
- assertEquals("SimplePortlet", portlet.getContext().getId());
+ portlet = producer.getPortlet(cloneCloneContext);
+ assertEquals(cloneCloneContext, portlet.getContext());
+ assertEquals("SimplePortlet",
portlet.getInfo().getMeta().getMetaValue(MetaInfo.DISPLAY_NAME).getDefaultString());
TransactionAssert.commitTransaction();
}