taylor 2004/09/30 12:42:15
Modified:
components/registry/src/test/org/apache/jetspeed/components/portletregistry
AbstractRegistryTest.java TestRegistryDirect.java
TestRegistryDirectPart2.java
Added:
components/registry/src/test/org/apache/jetspeed/components/portletregistry
TestRegistryDirectPart1a.java
Log:
new test, TestRegistryDirectPart1a, that runs in between TestRegistryDirect and
TestRegistryDirectPart2
to test update a PA by adding new user attributes
This test case runs fine in the unit test, but fails in production
So much for unit tests isolating bugs :(
Revision Changes Path
1.4 +10 -2
jakarta-jetspeed-2/components/registry/src/test/org/apache/jetspeed/components/portletregistry/AbstractRegistryTest.java
Index: AbstractRegistryTest.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/components/registry/src/test/org/apache/jetspeed/components/portletregistry/AbstractRegistryTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AbstractRegistryTest.java 1 Aug 2004 22:46:57 -0000 1.3
+++ AbstractRegistryTest.java 30 Sep 2004 19:42:15 -0000 1.4
@@ -126,7 +126,7 @@
persistenceStore.getTransaction().commit();
}
- protected void verifyData() throws Exception
+ protected void verifyData(boolean afterUpdates) throws Exception
{
PortletApplicationDefinitionImpl app;
WebApplicationDefinitionImpl webApp;
@@ -152,7 +152,15 @@
assertNotNull("Failed to reteive portlet application via registry",
registry.getPortletApplication("App_1"));
assertNotNull("Web app was not saved along with the portlet app.", webApp);
assertNotNull("Portlet was not saved along with the portlet app.",
app.getPortletDefinitionByName("Portlet 1"));
- assertTrue("\"user.name.family\" user attribute was not found.",
app.getUserAttributes().size() == 1);
+ if (!afterUpdates)
+ {
+ assertTrue("\"user.name.family\" user attribute was not found.",
app.getUserAttributes().size() == 1);
+ }
+ else
+ {
+ assertTrue("\"user.name.family\" and user.pets user attributes were not
found.", app.getUserAttributes().size() == 2);
+
+ }
portlet = (PortletDefinitionComposite)
registry.getPortletDefinitionByUniqueName("App_1::Portlet 1");
1.14 +2 -2
jakarta-jetspeed-2/components/registry/src/test/org/apache/jetspeed/components/portletregistry/TestRegistryDirect.java
Index: TestRegistryDirect.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/components/registry/src/test/org/apache/jetspeed/components/portletregistry/TestRegistryDirect.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- TestRegistryDirect.java 16 Aug 2004 18:28:52 -0000 1.13
+++ TestRegistryDirect.java 30 Sep 2004 19:42:15 -0000 1.14
@@ -190,6 +190,6 @@
public void testData() throws Exception
{
- verifyData();
+ verifyData(false);
}
}
1.15 +2 -2
jakarta-jetspeed-2/components/registry/src/test/org/apache/jetspeed/components/portletregistry/TestRegistryDirectPart2.java
Index: TestRegistryDirectPart2.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/components/registry/src/test/org/apache/jetspeed/components/portletregistry/TestRegistryDirectPart2.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- TestRegistryDirectPart2.java 16 Aug 2004 18:28:52 -0000 1.14
+++ TestRegistryDirectPart2.java 30 Sep 2004 19:42:15 -0000 1.15
@@ -86,6 +86,6 @@
public void testData() throws Exception
{
- verifyData();
+ verifyData(true);
}
}
1.1
jakarta-jetspeed-2/components/registry/src/test/org/apache/jetspeed/components/portletregistry/TestRegistryDirectPart1a.java
Index: TestRegistryDirectPart1a.java
===================================================================
/*
* Copyright 2000-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.jetspeed.components.portletregistry;
import java.util.Iterator;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.jetspeed.cache.PortletCache;
import org.apache.jetspeed.components.persistence.store.Filter;
import org.apache.jetspeed.factory.JetspeedPortletFactory;
import org.apache.jetspeed.factory.JetspeedPortletFactoryProxy;
import org.apache.jetspeed.om.common.UserAttribute;
import org.apache.jetspeed.om.portlet.impl.PortletApplicationDefinitionImpl;
import org.apache.jetspeed.components.persistence.store.Transaction;
/**
*
* TestRegistry runs a suite updating PAs
*
* @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
* @version $Id: TestRegistryDirectPart1a.java,v 1.1 2004/09/30 19:42:15 taylor Exp $
*
*/
public class TestRegistryDirectPart1a extends AbstractRegistryTest
{
/*
* (non-Javadoc)
*
* @see junit.framework.TestCase#setUp()
*/
protected void setUp() throws Exception
{
super.setUp();
}
/*
* (non-Javadoc)
*
* @see junit.framework.TestCase#tearDown()
*/
protected void tearDown() throws Exception
{
// super.tearDown();
}
/**
* @param testName
*/
public TestRegistryDirectPart1a(String testName)
{
super(testName);
}
public static Test suite()
{
// All methods starting with "test" will be executed in the test suite.
return new TestSuite(TestRegistryDirectPart1a.class);
}
public void testUpdates() throws Exception
{
Transaction tx = persistenceStore.getTransaction();
tx.begin();
Filter filter = persistenceStore.newFilter();
PortletApplicationDefinitionImpl app = (PortletApplicationDefinitionImpl)
registry.getPortletApplication("App_1");
assertNotNull("PA App_1 is NULL", app);
app.addUserAttribute("user.pets.doggie", "Busby");
registry.getPersistenceStore().lockForWrite(app);
tx.commit();
System.out.println("PA update test complete");
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]