Author: julien_viet
Date: 2011-06-24 16:54:47 -0400 (Fri, 24 Jun 2011)
New Revision: 6742
Removed:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/ContentTypesTestCase.java
Modified:
components/pc/trunk/mc/pom.xml
components/pc/trunk/portlet/pom.xml
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/container/LifeCycle1Test.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/container/LifeCycleReentranceDetectionTest.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/container/ManagedObjectRegistryEventList.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/support/PortletSupport.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/ContentBufferTestCase.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/ParametersTestCase.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/StateStringTestCase.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/info/AbstractInfoTest.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/info/CacheInfoTest.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/info/CapabilitiesInfoTest.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/info/MetaInfoTest.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/info/ModeInfoTest.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/info/PreferenceInfoTest.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/info/SecurityInfoTest.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/navigation/StateStringTestCase.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/StateConverterV0TestCase.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/ValueMapAssert.java
Log:
switched portlet module to junit
Modified: components/pc/trunk/mc/pom.xml
===================================================================
--- components/pc/trunk/mc/pom.xml 2011-06-24 20:51:14 UTC (rev 6741)
+++ components/pc/trunk/mc/pom.xml 2011-06-24 20:54:47 UTC (rev 6742)
@@ -33,7 +33,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
- <version>2.3.1</version>
<configuration>
<skip>false</skip>
</configuration>
Modified: components/pc/trunk/portlet/pom.xml
===================================================================
--- components/pc/trunk/portlet/pom.xml 2011-06-24 20:51:14 UTC (rev 6741)
+++ components/pc/trunk/portlet/pom.xml 2011-06-24 20:54:47 UTC (rev 6742)
@@ -35,32 +35,12 @@
<groupId>javax.ccpp</groupId>
<artifactId>ccpp</artifactId>
</dependency>
-
- <!--TEST SCOPE-->
<dependency>
- <groupId>org.jboss.unit</groupId>
- <artifactId>jboss-unit-remote</artifactId>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.2</version>
<scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>hibernate</groupId>
- <artifactId>hibernate3</artifactId>
- </exclusion>
- <exclusion>
- <groupId>apache-log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>apache-slide</groupId>
- <artifactId>webdavlib</artifactId>
- </exclusion>
- <exclusion>
- <groupId>apache-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- </exclusion>
- </exclusions>
</dependency>
-
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
@@ -69,156 +49,15 @@
</dependencies>
-
- <profiles>
- <!--By default Annotation Processing Tool related classes need to be
disabled-->
- <profile>
- <id>default</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>testCompile</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <testExcludes>
- <exclude>org/gatein/pc/test/unit/reports/*</exclude>
- </testExcludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <profile>
- <id>apt</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.myfaces.tobago</groupId>
- <artifactId>maven-apt-plugin</artifactId>
- <executions>
- <execution>
- <phase>package</phase>
- <configuration>
-
<factory>org.gatein.pc.test.unit.reports.TestCaseAPF</factory>
- <force>true</force>
- <target>1.5</target>
- <nocompile>true</nocompile>
- <showWarnings>true</showWarnings>
- </configuration>
- <goals>
- <goal>testExecute</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>sun.jdk</groupId>
- <artifactId>tools</artifactId>
- <version>1.5.0</version>
- <scope>system</scope>
- <systemPath>${java.home}/../lib/tools.jar</systemPath>
- </dependency>
- </dependencies>
- </profile>
-
- <!--On MacOSX the tools.jar should be already in the classpath-->
- <profile>
- <id>apt-mac</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.myfaces.tobago</groupId>
- <artifactId>maven-apt-plugin</artifactId>
- <executions>
- <execution>
- <phase>package</phase>
- <configuration>
-
<factory>org.gatein.pc.test.unit.reports.TestCaseAPF</factory>
- <force>true</force>
- <target>1.5</target>
- <nocompile>true</nocompile>
- <showWarnings>true</showWarnings>
- </configuration>
- <goals>
- <goal>testExecute</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- </profiles>
-
-
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <!--In 2.1 there is
http://jira.codehaus.org/browse/MJAR-30-->
- <!--2.2 should be used but SNAPSHOT is unstable for now-->
- <version>2.1</version>
- <executions>
- <execution>
- <goals>
- <goal>test-jar</goal>
- </goals>
- <phase>package</phase>
- <configuration>
- <includes>
- <include>org/**</include>
- </includes>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.jboss.unit</groupId>
- <artifactId>jboss-unit-tooling-maven2</artifactId>
- <executions>
- <execution>
- <phase>test</phase>
- <goals>
- <goal>execute</goal>
- </goals>
- </execution>
- </executions>
+ <artifactId>maven-surefire-plugin</artifactId>
<configuration>
-
- <!--Uncomment if needed-->
- <!--<jpda>false</jpda>-->
- <!--<jpdaPort>9000</jpdaPort>-->
- <!--<jpdaSuspend>true</jpdaSuspend>-->
- <failOnError>true</failOnError>
- <!--<assertions>true</assertions>-->
- <testsuites>
- <testsuite>
- <config>local-jboss-unit.xml</config>
- </testsuite>
- </testsuites>
- <reports>
- <xml>target/tests/reports/xml</xml>
- <html>target/tests/reports/html</html>
- </reports>
+ <skip>false</skip>
</configuration>
</plugin>
-
</plugins>
</build>
Modified:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/container/LifeCycle1Test.java
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/container/LifeCycle1Test.java 2011-06-24
20:51:14 UTC (rev 6741)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/container/LifeCycle1Test.java 2011-06-24
20:54:47 UTC (rev 6742)
@@ -22,21 +22,17 @@
******************************************************************************/
package org.gatein.pc.portlet.container;
-import org.jboss.unit.api.pojo.annotations.Test;
-import org.jboss.unit.api.pojo.annotations.Create;
+import junit.framework.TestCase;
import org.gatein.pc.portlet.impl.container.PortletApplicationLifeCycle;
import org.gatein.pc.portlet.impl.container.PortletFilterLifeCycle;
import org.gatein.pc.portlet.impl.container.PortletContainerLifeCycle;
import org.gatein.pc.portlet.container.managed.LifeCycleStatus;
-import static org.jboss.unit.api.Assert.*;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-@Test
-public class LifeCycle1Test
+public class LifeCycle1Test extends TestCase
{
ManagedObjectRegistryEventList events;
@@ -49,8 +45,8 @@
PortletFilterLifeCycle filterLC;
PortletContainerLifeCycle containerLC;
- @Create
- public void create()
+ @Override
+ protected void setUp() throws Exception
{
events = new ManagedObjectRegistryEventList();
@@ -89,7 +85,6 @@
assertEquals(filterStatus, filterLC.getStatus());
}
- @Test
public void testWiring()
{
events.assertAddedEvent(filterLC);
@@ -110,7 +105,6 @@
assertSame(filter, container.filters.get(filter.getId()));
}
- @Test
public void testApplicationLifeCycle()
{
events.clear();
@@ -143,7 +137,6 @@
events.assertEmpty();
}
- @Test
public void testFilterLifeCycle()
{
events.clear();
@@ -180,7 +173,6 @@
events.assertEmpty();
}
- @Test
public void testContainerLifeCycle()
{
events.clear();
@@ -208,7 +200,6 @@
events.assertEmpty();
}
- @Test
public void testContainerFailsOnStart()
{
events.clear();
@@ -275,7 +266,6 @@
events.assertEmpty();
}
- @Test
public void testApplicationFailsOnStart()
{
events.clear();
@@ -306,7 +296,6 @@
events.assertEmpty();
}
- @Test
public void testFilterFailsOnStart()
{
events.clear();
@@ -368,7 +357,6 @@
events.assertEmpty();
}
- @Test
public void testContainerFailsOnStop()
{
container.stopCallback = ObjectSupport.FAILURE_CALLBACK;
@@ -377,7 +365,6 @@
testApplicationLifeCycle();
}
- @Test
public void testApplicationFailsOnStop()
{
application.stopCallback = ObjectSupport.FAILURE_CALLBACK;
@@ -386,7 +373,6 @@
testApplicationLifeCycle();
}
- @Test
public void testFilterFailsOnStop()
{
filter.stopCallback = ObjectSupport.FAILURE_CALLBACK;
Modified:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/container/LifeCycleReentranceDetectionTest.java
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/container/LifeCycleReentranceDetectionTest.java 2011-06-24
20:51:14 UTC (rev 6741)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/container/LifeCycleReentranceDetectionTest.java 2011-06-24
20:54:47 UTC (rev 6742)
@@ -22,21 +22,17 @@
******************************************************************************/
package org.gatein.pc.portlet.container;
-import org.jboss.unit.api.pojo.annotations.Test;
-import org.jboss.unit.api.pojo.annotations.Create;
+import junit.framework.TestCase;
import org.gatein.pc.portlet.impl.container.PortletApplicationLifeCycle;
import org.gatein.pc.portlet.impl.container.PortletContainerLifeCycle;
import org.gatein.pc.portlet.impl.container.LifeCycle;
import org.gatein.pc.portlet.container.managed.LifeCycleStatus;
-import static org.jboss.unit.api.Assert.*;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-@Test
-public class LifeCycleReentranceDetectionTest
+public class LifeCycleReentranceDetectionTest extends TestCase
{
PortletApplicationLifeCycle applicationLF;
@@ -46,8 +42,8 @@
IllegalStateException ise;
- @Create
- public void create()
+ @Override
+ protected void setUp() throws Exception
{
this.ise = null;
}
@@ -97,8 +93,7 @@
}
}
- @Test
- public void applicationReentersApplication1()
+ public void testApplicationReentersApplication1()
{
application = new PortletApplicationObjectSupport("application");
applicationLF = new PortletApplicationLifeCycle(new
PortletApplicationContextSupport(), application);
@@ -115,8 +110,7 @@
assertEquals(LifeCycleStatus.STARTED, applicationLF.getStatus());
}
- @Test
- public void applicationReentersApplication2()
+ public void testApplicationReentersApplication2()
{
application = new PortletApplicationObjectSupport("application");
applicationLF = new PortletApplicationLifeCycle(new
PortletApplicationContextSupport(), application);
@@ -133,8 +127,7 @@
assertEquals(LifeCycleStatus.FAILED, applicationLF.getStatus());
}
- @Test
- public void containerReentersContainer1()
+ public void testContainerReentersContainer1()
{
application = new PortletApplicationObjectSupport("application");
applicationLF = new PortletApplicationLifeCycle(new
PortletApplicationContextSupport(), application);
@@ -154,8 +147,7 @@
assertEquals(LifeCycleStatus.STARTED, containerLF.getStatus());
}
- @Test
- public void containerReentersContainer2()
+ public void testContainerReentersContainer2()
{
application = new PortletApplicationObjectSupport("application");
applicationLF = new PortletApplicationLifeCycle(new
PortletApplicationContextSupport(), application);
@@ -175,8 +167,7 @@
assertEquals(LifeCycleStatus.FAILED, containerLF.getStatus());
}
- @Test
- public void containerReentersApplication1()
+ public void testContainerReentersApplication1()
{
application = new PortletApplicationObjectSupport("application");
applicationLF = new PortletApplicationLifeCycle(new
PortletApplicationContextSupport(), application);
@@ -196,8 +187,7 @@
assertEquals(LifeCycleStatus.STARTED, containerLF.getStatus());
}
- @Test
- public void containerReentersApplication2()
+ public void testContainerReentersApplication2()
{
application = new PortletApplicationObjectSupport("application");
applicationLF = new PortletApplicationLifeCycle(new
PortletApplicationContextSupport(), application);
Modified:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/container/ManagedObjectRegistryEventList.java
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/container/ManagedObjectRegistryEventList.java 2011-06-24
20:51:14 UTC (rev 6741)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/container/ManagedObjectRegistryEventList.java 2011-06-24
20:54:47 UTC (rev 6742)
@@ -22,6 +22,7 @@
******************************************************************************/
package org.gatein.pc.portlet.container;
+import junit.framework.Assert;
import org.gatein.pc.portlet.container.managed.ManagedObjectRegistryEventListener;
import org.gatein.pc.portlet.container.managed.ManagedObjectRegistryEvent;
import org.gatein.pc.portlet.container.managed.ManagedObject;
@@ -31,8 +32,6 @@
import java.util.LinkedList;
-import static org.jboss.unit.api.Assert.*;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
@@ -51,7 +50,7 @@
public void assertAddedEvent(ManagedObject managedObject)
{
ManagedObjectAddedEvent event = nextEvent(ManagedObjectAddedEvent.class);
- assertSame(managedObject, event.getManagedObject());
+ Assert.assertSame(managedObject, event.getManagedObject());
}
public void assertStartedEvent(ManagedObject managedObject)
@@ -72,13 +71,13 @@
public void assertLifeCycleEvent(ManagedObject managedObject, LifeCycleStatus status)
{
ManagedObjectLifeCycleEvent event = nextEvent(ManagedObjectLifeCycleEvent.class);
- assertSame(managedObject, event.getManagedObject());
- assertEquals(status, event.getStatus());
+ Assert.assertSame(managedObject, event.getManagedObject());
+ Assert.assertEquals(status, event.getStatus());
}
public void assertEmpty()
{
- assertTrue(list.isEmpty());
+ Assert.assertTrue(list.isEmpty());
}
public void clear()
@@ -88,7 +87,9 @@
private <T extends ManagedObjectRegistryEvent> T nextEvent(Class<T> type)
{
- assertFalse(list.isEmpty());
- return assertInstanceOf(list.removeFirst(), type);
+ Assert.assertFalse(list.isEmpty());
+ ManagedObjectRegistryEvent first = list.removeFirst();
+ Assert.assertTrue(type.isInstance(first));
+ return type.cast(first);
}
}
Modified:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/support/PortletSupport.java
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/support/PortletSupport.java 2011-06-24
20:51:14 UTC (rev 6741)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/support/PortletSupport.java 2011-06-24
20:54:47 UTC (rev 6742)
@@ -22,6 +22,7 @@
******************************************************************************/
package org.gatein.pc.portlet.support;
+import junit.framework.Assert;
import org.gatein.pc.api.PortletInvokerException;
import org.gatein.pc.api.PortletContext;
import org.gatein.pc.api.Portlet;
@@ -32,7 +33,6 @@
import org.gatein.pc.api.invocation.RenderInvocation;
import org.gatein.pc.api.invocation.ResourceInvocation;
import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
-import static org.jboss.unit.api.Assert.*;
import java.util.ArrayList;
import java.util.Map;
@@ -106,12 +106,12 @@
public void assertInvocationCountIs(int expectedInvocationCount)
{
- assertEquals(expectedInvocationCount, invocationCount);
+ Assert.assertEquals(expectedInvocationCount, invocationCount);
}
public PortletInvocationResponse invoke(PortletInvocation invocation) throws
PortletInvokerException
{
- assertNotNull(invocation);
+ Assert.assertNotNull(invocation);
//
if (invocationCount == handlers.size())
Modified:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/ContentBufferTestCase.java
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/ContentBufferTestCase.java 2011-06-24
20:51:14 UTC (rev 6741)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/ContentBufferTestCase.java 2011-06-24
20:54:47 UTC (rev 6742)
@@ -22,24 +22,21 @@
******************************************************************************/
package org.gatein.pc.test.portlet;
-import org.jboss.unit.api.pojo.annotations.Test;
+import junit.framework.TestCase;
import org.gatein.pc.portlet.impl.jsr168.ContentBuffer;
-import static org.jboss.unit.api.Assert.*;
-import static org.jboss.unit.api.Assert.assertEquals;
import java.io.PrintWriter;
import java.io.OutputStream;
import java.io.IOException;
+import java.util.Arrays;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-@Test
-public class ContentBufferTestCase
+public class ContentBufferTestCase extends TestCase
{
- @Test
public void testResetChars()
{
ContentBuffer buffer = new ContentBuffer();
@@ -50,7 +47,6 @@
assertEquals("", buffer.getChars());
}
- @Test
public void testResetBytes() throws IOException
{
ContentBuffer buffer = new ContentBuffer();
@@ -58,10 +54,9 @@
OutputStream out = buffer.getOutputStream();
out.write("foo".getBytes("UTF8"));
buffer.reset();
- assertEquals(new byte[0], buffer.getBytes());
+ assertEquals(0, buffer.getBytes().length);
}
- @Test
public void testResetAfterCommit()
{
ContentBuffer buffer = new ContentBuffer();
@@ -77,7 +72,6 @@
}
}
- @Test
public void testCommit()
{
ContentBuffer buffer = new ContentBuffer();
@@ -87,7 +81,6 @@
assertTrue(buffer.isCommited());
}
- @Test
public void testWriteCharsAfterCommit()
{
ContentBuffer buffer = new ContentBuffer();
@@ -100,7 +93,6 @@
assertEquals("foo", buffer.getChars());
}
- @Test
public void testWriteCharsAndCommit()
{
ContentBuffer buffer = new ContentBuffer();
@@ -114,7 +106,6 @@
assertEquals("foobar", buffer.getChars());
}
- @Test
public void testWriteBytesAfterCommit() throws IOException
{
ContentBuffer buffer = new ContentBuffer();
@@ -124,10 +115,9 @@
assertNotNull(out);
out.write("foo".getBytes("UTF8"));
out.close();
- assertEquals("foo".getBytes("UTF8"), buffer.getBytes());
+ assertTrue(Arrays.equals("foo".getBytes("UTF8"),
buffer.getBytes()));
}
- @Test
public void testWriteBytesAndCommit() throws IOException
{
ContentBuffer buffer = new ContentBuffer();
@@ -138,10 +128,9 @@
assertNotNull(out);
out.write("bar".getBytes("UTF8"));
out.close();
- assertEquals("foobar".getBytes("UTF8"), buffer.getBytes());
+ assertTrue(Arrays.equals("foobar".getBytes("UTF8"),
buffer.getBytes()));
}
- @Test
public void testFlushWriterDoesCommit()
{
ContentBuffer buffer = new ContentBuffer();
@@ -152,7 +141,6 @@
assertTrue(buffer.isCommited());
}
- @Test
public void testCloseWriterDoesCommit()
{
ContentBuffer buffer = new ContentBuffer();
@@ -163,7 +151,6 @@
assertTrue(buffer.isCommited());
}
- @Test
public void testFlushStreamDoesCommit() throws IOException
{
ContentBuffer buffer = new ContentBuffer();
@@ -174,8 +161,7 @@
assertTrue(buffer.isCommited());
}
- @Test
- public void testClosestreamDoesCommit() throws IOException
+ public void testClosestreamDoesCommit() throws IOException
{
ContentBuffer buffer = new ContentBuffer();
buffer.setContentType("text/html");
Deleted:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/ContentTypesTestCase.java
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/ContentTypesTestCase.java 2011-06-24
20:51:14 UTC (rev 6741)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/ContentTypesTestCase.java 2011-06-24
20:54:47 UTC (rev 6742)
@@ -1,89 +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.gatein.pc.test.portlet;
-
-import org.gatein.pc.api.Mode;
-import org.gatein.pc.portlet.impl.info.ContainerCapabilitiesInfo;
-
-import java.util.Collection;
-
-import static org.jboss.unit.api.Assert.*;
-import org.jboss.unit.api.pojo.annotations.Test;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
- * @version $Revision: 6720 $
- * @since 2.4
- */
-// @Test
-public class ContentTypesTestCase
-{
- private ContainerCapabilitiesInfo contentTypes;
-
- public ContentTypesTestCase()
- {
- contentTypes = new ContainerCapabilitiesInfo();
- ContainerCapabilitiesInfo md = new ContainerCapabilitiesInfo();
- md.add("text/html", org.gatein.pc.api.Mode.EDIT);
- md.add("text/html", Mode.HELP );
- md.add("text/html", org.gatein.pc.api.Mode.VIEW);
- md.add("text/xml", org.gatein.pc.api.Mode.VIEW);
- md.add("*", org.gatein.pc.api.Mode.VIEW);
-// md.add("*/*", new Mode[]{});
-// md.add("text/*", new Mode[]{});
-
- // should this be allowed?
-// md.add(new ContentTypeMetaData("pipo/pipo", new Mode[]{}));
- }
-
- @Test
- public void testGetAllModes()
- {
- Collection modes = contentTypes.getAllModes();
- assertEquals(3, modes.size());
- assertTrue(modes.contains(org.gatein.pc.api.Mode.EDIT));
- assertTrue(modes.contains(Mode.HELP));
- assertTrue(modes.contains(Mode.VIEW));
- }
-
- @Test
- public void testIsModeSupported()
- {
- }
-
- @Test
- public void testGetSupportedModes()
- {
- }
-
- public void testIsContentTypeSupported()
- {
- }
-
-
- @Test
- public void testIsModeSupportedFor()
- {
- }
-}
Modified:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/ParametersTestCase.java
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/ParametersTestCase.java 2011-06-24
20:51:14 UTC (rev 6741)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/ParametersTestCase.java 2011-06-24
20:54:47 UTC (rev 6742)
@@ -22,28 +22,23 @@
******************************************************************************/
package org.gatein.pc.test.portlet;
+import junit.framework.TestCase;
import org.gatein.pc.portlet.impl.jsr168.PortletParameterMap;
import org.gatein.pc.portlet.support.info.NavigationInfoSupport;
import org.gatein.pc.portlet.support.info.ParameterInfoSupport;
import java.util.Arrays;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-import static org.jboss.unit.api.Assert.*;
-import static org.jboss.unit.api.Assert.assertEquals;
-import org.jboss.unit.api.pojo.annotations.Test;
-import org.jboss.unit.api.pojo.annotations.Create;
-import org.jboss.unit.api.pojo.annotations.Destroy;
-
import javax.xml.namespace.QName;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 6639 $
*/
-@Test
-public class ParametersTestCase
+public class ParametersTestCase extends TestCase
{
public ParametersTestCase()
@@ -53,21 +48,18 @@
private NavigationInfoSupport navigation;
private PortletParameterMap map;
- @Create
public void setUp()
{
navigation = new NavigationInfoSupport();
map = new PortletParameterMap(navigation);
}
- @Destroy
public void tearDown()
{
map = null;
navigation = null;
}
- @Test
public void testGetWithNullName()
{
try
@@ -80,14 +72,12 @@
}
}
- @Test
public void testSet()
{
map.setParameterValue("a", "b");
assertEquals(map.getParameterValue("a"), "b");
}
- @Test
public void testSetWithNullName()
{
try
@@ -100,7 +90,6 @@
}
}
- @Test
public void testSetWithNullValue()
{
try
@@ -113,7 +102,6 @@
}
}
-// @Test
// public void testRemoveWithNullName()
// {
// try
@@ -126,7 +114,6 @@
// }
// }
-// @Test
// public void testRemove()
// {
// param.setValue("a", "b");
@@ -134,7 +121,6 @@
// assertEquals(param.getValue("a"), null);
// }
- @Test
public void testSetValues()
{
map.setParameterValues("a", new String[]{"b", "c"});
@@ -143,7 +129,6 @@
assertEquals(map.getParameterValue("a"), "b");
}
- @Test
public void testSetValuesWithNullName()
{
try
@@ -156,7 +141,6 @@
}
}
- @Test
public void testSetValuesWithNullValues()
{
try
@@ -169,7 +153,6 @@
}
}
- @Test
public void testSetValuesWithZeroLengthValues()
{
try
@@ -182,7 +165,6 @@
}
}
- @Test
public void testSetValuesWithOneNullValue()
{
try
@@ -206,7 +188,6 @@
// assertTrue(Arrays.equals(param.getValues("c"), new
String[]{"d", "e"}));
// }
- @Test
public void testBlah()
{
navigation.addPublicParameter(new ParameterInfoSupport("foo", new
QName("", "foo")));
@@ -218,21 +199,20 @@
Map<String, String[]> privateMap = map.getPrivateMapSnapshot();
assertEquals(1, privateMap.size());
- assertEquals(new String[]{"daa"}, privateMap.get("juu"));
+ assertEquals(Arrays.asList("daa"),
Arrays.asList(privateMap.get("juu")));
assertEquals(null, privateMap.get("abc"));
Map<String, String[]> publicMap = map.getPublicMapSnapshot();
assertEquals(2, publicMap.size());
- assertEquals(new String[]{"bar"}, publicMap.get("foo"));
- assertEquals(new String[]{}, publicMap.get("abc"));
+ assertEquals(Arrays.asList("bar"),
Arrays.asList(publicMap.get("foo")));
+ assertEquals(Collections.<String>emptyList(),
Arrays.asList(publicMap.get("abc")));
Map<String, String[]> combinedMap = map.getMap();
assertEquals(2, combinedMap.size());
- assertEquals(new String[]{"bar"}, combinedMap.get("foo"));
- assertEquals(new String[]{"daa"}, combinedMap.get("juu"));
+ assertEquals(Arrays.asList("bar"),
Arrays.asList(combinedMap.get("foo")));
+ assertEquals(Arrays.asList("daa"),
Arrays.asList(combinedMap.get("juu")));
}
-// @Test
// public void testReplaceWithNullMap()
// {
// try
@@ -245,7 +225,6 @@
// }
// }
-// @Test
// public void testReplaceWithInvalidMap()
// {
// Map[] maps = buildInvalidMaps();
@@ -265,7 +244,6 @@
// }
// }
-// @Test
// public void testReplace()
// {
// param.setValue("a", "b");
@@ -282,7 +260,6 @@
// assertEquals(param.getValues("h"), new String[]{"_i"});
// }
-// @Test
// public void testAppendWithInvalidMap()
// {
// Map[] maps = buildInvalidMaps();
@@ -305,7 +282,6 @@
// }
// }
-// @Test
// public void testAppend()
// {
// param.setValue("a", "b");
@@ -323,7 +299,6 @@
// assertEquals(param.getValues("h"), new String[]{"_i"});
// }
-// @Test
// public void testClear()
// {
// param.setValue("a", "b");
Modified:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/StateStringTestCase.java
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/StateStringTestCase.java 2011-06-24
20:51:14 UTC (rev 6741)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/StateStringTestCase.java 2011-06-24
20:54:47 UTC (rev 6742)
@@ -22,12 +22,11 @@
******************************************************************************/
package org.gatein.pc.test.portlet;
+import junit.framework.TestCase;
import org.gatein.common.util.MapBuilder;
import org.gatein.pc.api.OpaqueStateString;
import org.gatein.pc.api.ParametersStateString;
import org.gatein.pc.api.StateString;
-import static org.jboss.unit.api.Assert.assertEquals;
-import org.jboss.unit.api.pojo.annotations.Test;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -40,11 +39,9 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-@Test
-public class StateStringTestCase
+public class StateStringTestCase extends TestCase
{
- @Test
public void testMarshalling() throws IOException
{
check(new OpaqueStateString("blah"));
Modified:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/info/AbstractInfoTest.java
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/info/AbstractInfoTest.java 2011-06-24
20:51:14 UTC (rev 6741)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/info/AbstractInfoTest.java 2011-06-24
20:54:47 UTC (rev 6742)
@@ -22,133 +22,116 @@
******************************************************************************/
package org.gatein.pc.test.portlet.info;
-import org.gatein.pc.portlet.container.managed.PortletApplicationRegistry;
-import org.jboss.unit.info.TestInfo;
-import org.jboss.unit.info.impl.SimpleTestSuiteInfo;
-import org.jboss.unit.remote.driver.RemoteTestDriver;
-import org.jboss.unit.remote.RequestContext;
-import org.jboss.unit.remote.ResponseContext;
-import org.jboss.unit.driver.impl.composite.CompositeTestDriver;
-import org.jboss.unit.driver.DriverResponse;
-import org.jboss.unit.driver.DriverCommand;
-import org.jboss.unit.driver.DriverContext;
-import org.jboss.unit.driver.DriverException;
-import org.jboss.unit.driver.response.EndTestResponse;
-import org.jboss.unit.driver.response.FailureResponse;
-import org.jboss.unit.driver.command.StartTestCommand;
-import org.jboss.unit.Failure;
-import org.jboss.unit.TestId;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public abstract class AbstractInfoTest implements RemoteTestDriver
+public abstract class AbstractInfoTest // implements RemoteTestDriver
{
-
- /** The test id. */
- protected final String testCaseId;
-
- /** The test info. */
- protected final TestInfo testInfo;
-
- /** . */
- protected PortletApplicationRegistry registry;
-
- /** The controller. */
- protected CompositeTestDriver testDriverContainer;
-
- /** Not really used for now, we need the concept of non http test context. */
- private RequestContext testContext;
-
+//
+// /** The test id. */
+// protected final String testCaseId;
+//
+// /** The test info. */
+// protected final TestInfo testInfo;
+//
+// /** . */
+// protected PortletApplicationRegistry registry;
+//
+// /** The controller. */
+// protected CompositeTestDriver testDriverContainer;
+//
+// /** Not really used for now, we need the concept of non http test context. */
+// private RequestContext testContext;
+//
public AbstractInfoTest(String testCaseId)
{
- if (testCaseId == null)
- {
- throw new IllegalArgumentException("No null test case id accepted");
- }
-
- //
- this.testCaseId = testCaseId;
- this.testInfo = new SimpleTestSuiteInfo(testCaseId);
+// if (testCaseId == null)
+// {
+// throw new IllegalArgumentException("No null test case id
accepted");
+// }
+//
+// //
+// this.testCaseId = testCaseId;
+// this.testInfo = new SimpleTestSuiteInfo(testCaseId);
}
-
- public void pushContext(TestId testId, RequestContext requestContext)
- {
- this.testContext = requestContext;
- }
-
- public ResponseContext popContext(TestId testId)
- {
- return null;
- }
-
- public PortletApplicationRegistry getRegistry()
- {
- return registry;
- }
-
- public void setRegistry(PortletApplicationRegistry registry)
- {
- this.registry = registry;
- }
-
- public CompositeTestDriver getTestDriverRegistry()
- {
- return testDriverContainer;
- }
-
-
- public void initDriver(DriverContext driverContext) throws DriverException
- {
- }
-
- public void destroyDriver()
- {
- }
-
- public void setTestDriverRegistry(CompositeTestDriver testDriverContainer)
- {
- this.testDriverContainer = testDriverContainer;
- }
-
- public void create() throws Exception
- {
- testDriverContainer.mount(this);
- }
-
- public void destroy()
- {
- testDriverContainer.unmount(this);
- }
-
- public TestInfo getInfo()
- {
- return testInfo;
- }
-
- public DriverResponse invoke(TestId testId, DriverCommand cmd)
- {
- if (cmd instanceof StartTestCommand)
- {
- try
- {
- execute();
-
- //
- return new EndTestResponse();
- }
- catch (Exception e)
- {
- return new FailureResponse(Failure.createFailure(e));
- }
- }
- else
- {
- return new FailureResponse(Failure.createAssertionFailure("Unexpected
command"));
- }
- }
-
- protected abstract void execute();
-
+//
+// public void pushContext(TestId testId, RequestContext requestContext)
+// {
+// this.testContext = requestContext;
+// }
+//
+// public ResponseContext popContext(TestId testId)
+// {
+// return null;
+// }
+//
+// public PortletApplicationRegistry getRegistry()
+// {
+// return registry;
+// }
+//
+// public void setRegistry(PortletApplicationRegistry registry)
+// {
+// this.registry = registry;
+// }
+//
+// public CompositeTestDriver getTestDriverRegistry()
+// {
+// return testDriverContainer;
+// }
+//
+//
+// public void initDriver(DriverContext driverContext) throws DriverException
+// {
+// }
+//
+// public void destroyDriver()
+// {
+// }
+//
+// public void setTestDriverRegistry(CompositeTestDriver testDriverContainer)
+// {
+// this.testDriverContainer = testDriverContainer;
+// }
+//
+// public void create() throws Exception
+// {
+// testDriverContainer.mount(this);
+// }
+//
+// public void destroy()
+// {
+// testDriverContainer.unmount(this);
+// }
+//
+// public TestInfo getInfo()
+// {
+// return testInfo;
+// }
+//
+// public DriverResponse invoke(TestId testId, DriverCommand cmd)
+// {
+// if (cmd instanceof StartTestCommand)
+// {
+// try
+// {
+// execute();
+//
+// //
+// return new EndTestResponse();
+// }
+// catch (Exception e)
+// {
+// return new FailureResponse(Failure.createFailure(e));
+// }
+// }
+// else
+// {
+// return new FailureResponse(Failure.createAssertionFailure("Unexpected
command"));
+// }
+// }
+//
+// protected abstract void execute();
+//
}
Modified:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/info/CacheInfoTest.java
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/info/CacheInfoTest.java 2011-06-24
20:51:14 UTC (rev 6741)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/info/CacheInfoTest.java 2011-06-24
20:54:47 UTC (rev 6742)
@@ -22,12 +22,6 @@
******************************************************************************/
package org.gatein.pc.test.portlet.info;
-import org.gatein.pc.portlet.container.managed.ManagedPortletContainer;
-import org.gatein.pc.api.info.CacheInfo;
-import org.gatein.pc.api.info.PortletInfo;
-
-import static org.jboss.unit.api.Assert.*;
-
/**
* @author <a href="mailto:boleslaw.dawidowicz@jboss.com">Boleslaw
Dawidowicz</a>
* @version $Revision: 7954 $
@@ -40,12 +34,12 @@
super("CacheInfoTest");
}
- public void execute()
- {
- ManagedPortletContainer container =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("CachePortlet");
- PortletInfo info = container.getInfo();
- CacheInfo cacheInfo = info.getCache();
- assertEquals(65, cacheInfo.getExpirationSecs());
- //TODO:implement getReferenceType();
- }
+// public void execute()
+// {
+// ManagedPortletContainer container =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("CachePortlet");
+// PortletInfo info = container.getInfo();
+// CacheInfo cacheInfo = info.getCache();
+// assertEquals(65, cacheInfo.getExpirationSecs());
+// //TODO:implement getReferenceType();
+// }
}
Modified:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/info/CapabilitiesInfoTest.java
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/info/CapabilitiesInfoTest.java 2011-06-24
20:51:14 UTC (rev 6741)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/info/CapabilitiesInfoTest.java 2011-06-24
20:54:47 UTC (rev 6742)
@@ -23,22 +23,6 @@
package org.gatein.pc.test.portlet.info;
-import org.gatein.pc.api.Mode;
-import org.gatein.pc.api.WindowState;
-import org.gatein.common.net.media.MediaType;
-import org.gatein.pc.portlet.container.managed.ManagedPortletContainer;
-import org.gatein.pc.api.info.CapabilitiesInfo;
-import org.gatein.pc.api.info.ModeInfo;
-import org.gatein.pc.api.info.PortletInfo;
-import org.gatein.pc.api.info.WindowStateInfo;
-
-import static org.jboss.unit.api.Assert.*;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.Set;
-
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
* @version $Revision: 6720 $
@@ -53,109 +37,109 @@
public void execute()
{
- ManagedPortletContainer container =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("CapabilitiesPortlet");
- PortletInfo info = container.getInfo();
- CapabilitiesInfo capInfo = info.getCapabilities();
-
- //TODO: finish locales asserts
- // locales should at least contain Locale.ENGLISH
- Set allLocales = capInfo.getAllLocales();
- assertNotNull(allLocales);
- assertTrue(allLocales.contains(Locale.ENGLISH));
-
- //check mime types
- Set<MediaType> types = capInfo.getMediaTypes();
- String[] mt = new String[types.size()];
- int count = 0;
- for (Iterator i = types.iterator(); i.hasNext();)
- {
- Object o = i.next();
- mt[count++] = (String)o;
- }
- assertEquals(new String[]{"text/vnd.wap.wml", "text/html"},
mt);
-
- //check all modes
- Set modeInfos = capInfo.getAllModes();
- Set modes = extractModes(modeInfos);
-
- assertTrue(modes.contains(org.gatein.pc.api.Mode.VIEW));
- assertTrue(modes.contains(org.gatein.pc.api.Mode.HELP));
- assertTrue(modes.contains(Mode.EDIT));
-
- //check text/html modes
- modeInfos = capInfo.getModes(MediaType.TEXT_HTML);
- modes = extractModes(modeInfos);
- assertEquals(2, modes.size());
- assertTrue(modes.contains(org.gatein.pc.api.Mode.VIEW));
- assertTrue(modes.contains(org.gatein.pc.api.Mode.HELP));
-
- //check text/vnd.wap.wml modes
- modeInfos = capInfo.getModes(MediaType.create("text/vnd.wap.wml"));
- modes = extractModes(modeInfos);
- assertEquals(2, modes.size());
- assertTrue(modes.contains(org.gatein.pc.api.Mode.VIEW));
- assertTrue(modes.contains(org.gatein.pc.api.Mode.EDIT));
-
- //check undeclared
- modeInfos = capInfo.getModes(MediaType.create("text/undeclared"));
- modes = extractModes(modeInfos);
- assertEquals(0, modes.size());
-
- //check all window states
- Set stateInfos = capInfo.getAllWindowStates();
- Set states = extractWindowStates(stateInfos);
- assertEquals(3, states.size());
- assertTrue(states.contains(org.gatein.pc.api.WindowState.NORMAL));
- assertTrue(states.contains(org.gatein.pc.api.WindowState.MINIMIZED));
- assertTrue(states.contains(org.gatein.pc.api.WindowState.MAXIMIZED));
-
- //check for text/html
- stateInfos = capInfo.getWindowStates(MediaType.TEXT_HTML);
- states = extractWindowStates(stateInfos);
- assertEquals(3, states.size());
- assertTrue(states.contains(org.gatein.pc.api.WindowState.NORMAL));
- assertTrue(states.contains(WindowState.MINIMIZED));
- assertTrue(states.contains(org.gatein.pc.api.WindowState.MAXIMIZED));
-
- //simple check for text/vnd.wap.wml
- //TODO:is this really expected behaviour? shouldn't it return no states as this
is unsupported by portal one?
- states = capInfo.getWindowStates(MediaType.create("text/vnd.wap.wml"));
- assertEquals(3, states.size());
-
- //check undeclared
- states = capInfo.getWindowStates(MediaType.create("undeclared/mime"));
- assertEquals(0, states.size());
-
- //fail();
-
- //throw new UnsupportedOperationException("CapabilitiesInfoTest: Finish
implementation!");
+// ManagedPortletContainer container =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("CapabilitiesPortlet");
+// PortletInfo info = container.getInfo();
+// CapabilitiesInfo capInfo = info.getCapabilities();
+//
+// //TODO: finish locales asserts
+// // locales should at least contain Locale.ENGLISH
+// Set allLocales = capInfo.getAllLocales();
+// assertNotNull(allLocales);
+// assertTrue(allLocales.contains(Locale.ENGLISH));
+//
+// //check mime types
+// Set<MediaType> types = capInfo.getMediaTypes();
+// String[] mt = new String[types.size()];
+// int count = 0;
+// for (Iterator i = types.iterator(); i.hasNext();)
+// {
+// Object o = i.next();
+// mt[count++] = (String)o;
+// }
+// assertEquals(new String[]{"text/vnd.wap.wml", "text/html"},
mt);
+//
+// //check all modes
+// Set modeInfos = capInfo.getAllModes();
+// Set modes = extractModes(modeInfos);
+//
+// assertTrue(modes.contains(org.gatein.pc.api.Mode.VIEW));
+// assertTrue(modes.contains(org.gatein.pc.api.Mode.HELP));
+// assertTrue(modes.contains(Mode.EDIT));
+//
+// //check text/html modes
+// modeInfos = capInfo.getModes(MediaType.TEXT_HTML);
+// modes = extractModes(modeInfos);
+// assertEquals(2, modes.size());
+// assertTrue(modes.contains(org.gatein.pc.api.Mode.VIEW));
+// assertTrue(modes.contains(org.gatein.pc.api.Mode.HELP));
+//
+// //check text/vnd.wap.wml modes
+// modeInfos = capInfo.getModes(MediaType.create("text/vnd.wap.wml"));
+// modes = extractModes(modeInfos);
+// assertEquals(2, modes.size());
+// assertTrue(modes.contains(org.gatein.pc.api.Mode.VIEW));
+// assertTrue(modes.contains(org.gatein.pc.api.Mode.EDIT));
+//
+// //check undeclared
+// modeInfos = capInfo.getModes(MediaType.create("text/undeclared"));
+// modes = extractModes(modeInfos);
+// assertEquals(0, modes.size());
+//
+// //check all window states
+// Set stateInfos = capInfo.getAllWindowStates();
+// Set states = extractWindowStates(stateInfos);
+// assertEquals(3, states.size());
+// assertTrue(states.contains(org.gatein.pc.api.WindowState.NORMAL));
+// assertTrue(states.contains(org.gatein.pc.api.WindowState.MINIMIZED));
+// assertTrue(states.contains(org.gatein.pc.api.WindowState.MAXIMIZED));
+//
+// //check for text/html
+// stateInfos = capInfo.getWindowStates(MediaType.TEXT_HTML);
+// states = extractWindowStates(stateInfos);
+// assertEquals(3, states.size());
+// assertTrue(states.contains(org.gatein.pc.api.WindowState.NORMAL));
+// assertTrue(states.contains(WindowState.MINIMIZED));
+// assertTrue(states.contains(org.gatein.pc.api.WindowState.MAXIMIZED));
+//
+// //simple check for text/vnd.wap.wml
+// //TODO:is this really expected behaviour? shouldn't it return no states as
this is unsupported by portal one?
+// states =
capInfo.getWindowStates(MediaType.create("text/vnd.wap.wml"));
+// assertEquals(3, states.size());
+//
+// //check undeclared
+// states = capInfo.getWindowStates(MediaType.create("undeclared/mime"));
+// assertEquals(0, states.size());
+//
+// //fail();
+//
+// //throw new UnsupportedOperationException("CapabilitiesInfoTest: Finish
implementation!");
}
- public Set extractWindowStates(Set infos)
- {
- Set states = new HashSet();
-
- for (Iterator i = infos.iterator(); i.hasNext();)
- {
- WindowStateInfo info = (WindowStateInfo)i.next();
- org.gatein.pc.api.WindowState state = info.getWindowState();
- assertEquals(state.toString(), (info.getWindowStateName()));
- states.add(state);
- }
- return states;
- }
-
- public Set extractModes(Set infos)
- {
- Set modes = new HashSet();
-
- for (Iterator i = infos.iterator(); i.hasNext();)
- {
- ModeInfo info = (ModeInfo)i.next();
- Mode mode = info.getMode();
- assertEquals(mode.toString(), (info.getModeName()));
- modes.add(mode);
- }
- return modes;
- }
+// public Set extractWindowStates(Set infos)
+// {
+// Set states = new HashSet();
+//
+// for (Iterator i = infos.iterator(); i.hasNext();)
+// {
+// WindowStateInfo info = (WindowStateInfo)i.next();
+// org.gatein.pc.api.WindowState state = info.getWindowState();
+// assertEquals(state.toString(), (info.getWindowStateName()));
+// states.add(state);
+// }
+// return states;
+// }
+//
+// public Set extractModes(Set infos)
+// {
+// Set modes = new HashSet();
+//
+// for (Iterator i = infos.iterator(); i.hasNext();)
+// {
+// ModeInfo info = (ModeInfo)i.next();
+// Mode mode = info.getMode();
+// assertEquals(mode.toString(), (info.getModeName()));
+// modes.add(mode);
+// }
+// return modes;
+// }
}
Modified:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/info/MetaInfoTest.java
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/info/MetaInfoTest.java 2011-06-24
20:51:14 UTC (rev 6741)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/info/MetaInfoTest.java 2011-06-24
20:54:47 UTC (rev 6742)
@@ -22,15 +22,6 @@
******************************************************************************/
package org.gatein.pc.test.portlet.info;
-import org.gatein.common.i18n.LocalizedString;
-import org.gatein.pc.portlet.container.managed.ManagedPortletContainer;
-import org.gatein.pc.api.info.MetaInfo;
-import org.gatein.pc.api.info.PortletInfo;
-
-import static org.jboss.unit.api.Assert.*;
-
-import java.util.Locale;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 6818 $
@@ -45,23 +36,23 @@
public void execute()
{
- ManagedPortletContainer container =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("NoBundlePortlet");
- PortletInfo info = container.getInfo();
- MetaInfo metaInfo = info.getMeta();
-
- //
- LocalizedString title = metaInfo.getMetaValue(MetaInfo.TITLE);
- String titleEn = title.getString(Locale.ENGLISH, false);
- assertEquals("title", titleEn);
-
- //
- LocalizedString shortTitle = metaInfo.getMetaValue(MetaInfo.SHORT_TITLE);
- String shortTitleEn = shortTitle.getString(Locale.ENGLISH, false);
- assertEquals("short-title", shortTitleEn);
-
- //
- LocalizedString keywords = metaInfo.getMetaValue(MetaInfo.KEYWORDS);
- String keywordsEn = keywords.getString(Locale.ENGLISH, false);
- assertEquals("keywords", keywordsEn);
+// ManagedPortletContainer container =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("NoBundlePortlet");
+// PortletInfo info = container.getInfo();
+// MetaInfo metaInfo = info.getMeta();
+//
+// //
+// LocalizedString title = metaInfo.getMetaValue(MetaInfo.TITLE);
+// String titleEn = title.getString(Locale.ENGLISH, false);
+// assertEquals("title", titleEn);
+//
+// //
+// LocalizedString shortTitle = metaInfo.getMetaValue(MetaInfo.SHORT_TITLE);
+// String shortTitleEn = shortTitle.getString(Locale.ENGLISH, false);
+// assertEquals("short-title", shortTitleEn);
+//
+// //
+// LocalizedString keywords = metaInfo.getMetaValue(MetaInfo.KEYWORDS);
+// String keywordsEn = keywords.getString(Locale.ENGLISH, false);
+// assertEquals("keywords", keywordsEn);
}
}
Modified:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/info/ModeInfoTest.java
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/info/ModeInfoTest.java 2011-06-24
20:51:14 UTC (rev 6741)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/info/ModeInfoTest.java 2011-06-24
20:54:47 UTC (rev 6742)
@@ -22,18 +22,6 @@
******************************************************************************/
package org.gatein.pc.test.portlet.info;
-import org.gatein.pc.api.Mode;
-import org.gatein.common.net.media.MediaType;
-import org.gatein.pc.portlet.container.managed.ManagedPortletContainer;
-import org.gatein.pc.api.info.CapabilitiesInfo;
-import org.gatein.pc.api.info.ModeInfo;
-
-import static org.jboss.unit.api.Assert.*;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
/**
* @author <a href="mailto:boleslaw.dawidowicz@jboss.com">Boleslaw
Dawidowicz</a>
* @version $Revision: 7954 $
@@ -46,49 +34,49 @@
super("ModeInfoTest");
}
- public void execute()
- {
- ManagedPortletContainer container1 =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("ModePortlet1");
- ManagedPortletContainer container2 =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("ModePortlet2");
- CapabilitiesInfo capaInfo = container1.getInfo().getCapabilities();
-
- //Portlet 1 with VIEW, EDIT, HELP
- Set modeInfos = capaInfo.getModes(MediaType.TEXT_HTML);
-
- //shoule be 3 modes
- assertEquals(3, modeInfos.size());
-
- Set portletModes = new HashSet();
- for (Iterator i = modeInfos.iterator(); i.hasNext();)
- {
- ModeInfo mode = (ModeInfo)i.next();
- portletModes.add(mode.getMode());
- assertEquals(mode.getModeName(), mode.getMode().toString());
- }
-
-
- assertTrue(portletModes.contains(org.gatein.pc.api.Mode.VIEW));
- assertTrue(portletModes.contains(Mode.HELP));
- assertTrue(portletModes.contains(Mode.EDIT));
-
- //Portlet 2 with only VIEW
- capaInfo = container2.getInfo().getCapabilities();
- modeInfos = capaInfo.getModes(MediaType.TEXT_HTML);
-
- //shoule be 1 mode
- assertEquals(1, modeInfos.size());
-
-
- portletModes = new HashSet();
- for (Iterator i = modeInfos.iterator(); i.hasNext();)
- {
- ModeInfo mode = (ModeInfo)i.next();
- portletModes.add(mode.getMode());
- assertEquals(mode.getModeName(), mode.getMode().toString());
- }
-
- assertTrue(portletModes.contains(Mode.VIEW));
- assertTrue(!portletModes.contains(Mode.HELP));
- assertTrue(!portletModes.contains(Mode.EDIT));
- }
+// public void execute()
+// {
+// ManagedPortletContainer container1 =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("ModePortlet1");
+// ManagedPortletContainer container2 =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("ModePortlet2");
+// CapabilitiesInfo capaInfo = container1.getInfo().getCapabilities();
+//
+// //Portlet 1 with VIEW, EDIT, HELP
+// Set modeInfos = capaInfo.getModes(MediaType.TEXT_HTML);
+//
+// //shoule be 3 modes
+// assertEquals(3, modeInfos.size());
+//
+// Set portletModes = new HashSet();
+// for (Iterator i = modeInfos.iterator(); i.hasNext();)
+// {
+// ModeInfo mode = (ModeInfo)i.next();
+// portletModes.add(mode.getMode());
+// assertEquals(mode.getModeName(), mode.getMode().toString());
+// }
+//
+//
+// assertTrue(portletModes.contains(org.gatein.pc.api.Mode.VIEW));
+// assertTrue(portletModes.contains(Mode.HELP));
+// assertTrue(portletModes.contains(Mode.EDIT));
+//
+// //Portlet 2 with only VIEW
+// capaInfo = container2.getInfo().getCapabilities();
+// modeInfos = capaInfo.getModes(MediaType.TEXT_HTML);
+//
+// //shoule be 1 mode
+// assertEquals(1, modeInfos.size());
+//
+//
+// portletModes = new HashSet();
+// for (Iterator i = modeInfos.iterator(); i.hasNext();)
+// {
+// ModeInfo mode = (ModeInfo)i.next();
+// portletModes.add(mode.getMode());
+// assertEquals(mode.getModeName(), mode.getMode().toString());
+// }
+//
+// assertTrue(portletModes.contains(Mode.VIEW));
+// assertTrue(!portletModes.contains(Mode.HELP));
+// assertTrue(!portletModes.contains(Mode.EDIT));
+// }
}
Modified:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/info/PreferenceInfoTest.java
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/info/PreferenceInfoTest.java 2011-06-24
20:51:14 UTC (rev 6741)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/info/PreferenceInfoTest.java 2011-06-24
20:54:47 UTC (rev 6742)
@@ -22,18 +22,6 @@
******************************************************************************/
package org.gatein.pc.test.portlet.info;
-import org.gatein.pc.portlet.container.managed.ManagedPortletContainer;
-import org.gatein.pc.portlet.impl.info.ContainerPreferenceInfo;
-import org.gatein.pc.portlet.impl.info.ContainerPreferencesInfo;
-import org.gatein.pc.api.info.PortletInfo;
-
-import static org.jboss.unit.api.Assert.*;
-
-import java.util.Locale;
-import java.util.Set;
-import java.util.List;
-import java.util.Arrays;
-
/**
* @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw
Dawidowicz</a>
* @version $Revision: 6720 $
@@ -46,56 +34,56 @@
super("PreferenceInfoTest");
}
- public void execute()
- {
- ManagedPortletContainer container =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("PreferenceInfoPortlet");
-
- //
- PortletInfo info = container.getInfo();
- ContainerPreferencesInfo prefsInfo =
(ContainerPreferencesInfo)info.getPreferences();
-
- //
- ContainerPreferenceInfo prefInfo =
prefsInfo.getContainerPreference("localized_pref");
- assertEquals("localized_pref", prefInfo.getKey());
- assertEquals("english localized description",
prefInfo.getDescription().getString(Locale.ENGLISH, false));
- assertEquals("polish localized description",
prefInfo.getDescription().getString(new Locale("pl"), false));
- assertEquals("english_localized_name",
prefInfo.getDisplayName().getString(Locale.ENGLISH, false));
- assertEquals("polish_localized_name",
prefInfo.getDisplayName().getString(new Locale("pl"), false));
-
- //
- Set keys = prefsInfo.getKeys();
- assertTrue(keys.contains("localized_pref"));
- assertTrue(keys.contains("single_pref"));
- assertTrue(keys.contains("multi_pref"));
- assertTrue(keys.contains("single_pref_bis"));
- assertTrue(keys.contains("multi_pref_bis"));
-
- //
- prefInfo = prefsInfo.getContainerPreference("single_pref");
- assertEquals("single_pref", prefInfo.getKey());
- List<String> values = prefInfo.getDefaultValue();
- assertEquals(Arrays.asList("single_pref_value"), values);
- assertTrue(!prefInfo.isReadOnly().booleanValue());
-
- //
- prefInfo = prefsInfo.getContainerPreference("multi_pref");
- assertEquals("multi_pref", prefInfo.getKey());
- values = prefInfo.getDefaultValue();
- assertEquals(Arrays.asList("multi_pref_value_1",
"multi_pref_value_2"), values);
- assertTrue(!prefInfo.isReadOnly().booleanValue());
-
- //
- prefInfo = prefsInfo.getContainerPreference("single_pref_bis");
- assertEquals("single_pref_bis", prefInfo.getKey());
- values = prefInfo.getDefaultValue();
- assertEquals(Arrays.asList("single_pref_value"), values);
- assertTrue(prefInfo.isReadOnly().booleanValue());
-
- //
- prefInfo = prefsInfo.getContainerPreference("multi_pref_bis");
- assertEquals("multi_pref_bis", prefInfo.getKey());
- values = prefInfo.getDefaultValue();
- assertEquals(Arrays.asList("multi_pref_value_1",
"multi_pref_value_2"), values);
- assertTrue(prefInfo.isReadOnly().booleanValue());
- }
+// public void execute()
+// {
+// ManagedPortletContainer container =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("PreferenceInfoPortlet");
+//
+// //
+// PortletInfo info = container.getInfo();
+// ContainerPreferencesInfo prefsInfo =
(ContainerPreferencesInfo)info.getPreferences();
+//
+// //
+// ContainerPreferenceInfo prefInfo =
prefsInfo.getContainerPreference("localized_pref");
+// assertEquals("localized_pref", prefInfo.getKey());
+// assertEquals("english localized description",
prefInfo.getDescription().getString(Locale.ENGLISH, false));
+// assertEquals("polish localized description",
prefInfo.getDescription().getString(new Locale("pl"), false));
+// assertEquals("english_localized_name",
prefInfo.getDisplayName().getString(Locale.ENGLISH, false));
+// assertEquals("polish_localized_name",
prefInfo.getDisplayName().getString(new Locale("pl"), false));
+//
+// //
+// Set keys = prefsInfo.getKeys();
+// assertTrue(keys.contains("localized_pref"));
+// assertTrue(keys.contains("single_pref"));
+// assertTrue(keys.contains("multi_pref"));
+// assertTrue(keys.contains("single_pref_bis"));
+// assertTrue(keys.contains("multi_pref_bis"));
+//
+// //
+// prefInfo = prefsInfo.getContainerPreference("single_pref");
+// assertEquals("single_pref", prefInfo.getKey());
+// List<String> values = prefInfo.getDefaultValue();
+// assertEquals(Arrays.asList("single_pref_value"), values);
+// assertTrue(!prefInfo.isReadOnly().booleanValue());
+//
+// //
+// prefInfo = prefsInfo.getContainerPreference("multi_pref");
+// assertEquals("multi_pref", prefInfo.getKey());
+// values = prefInfo.getDefaultValue();
+// assertEquals(Arrays.asList("multi_pref_value_1",
"multi_pref_value_2"), values);
+// assertTrue(!prefInfo.isReadOnly().booleanValue());
+//
+// //
+// prefInfo = prefsInfo.getContainerPreference("single_pref_bis");
+// assertEquals("single_pref_bis", prefInfo.getKey());
+// values = prefInfo.getDefaultValue();
+// assertEquals(Arrays.asList("single_pref_value"), values);
+// assertTrue(prefInfo.isReadOnly().booleanValue());
+//
+// //
+// prefInfo = prefsInfo.getContainerPreference("multi_pref_bis");
+// assertEquals("multi_pref_bis", prefInfo.getKey());
+// values = prefInfo.getDefaultValue();
+// assertEquals(Arrays.asList("multi_pref_value_1",
"multi_pref_value_2"), values);
+// assertTrue(prefInfo.isReadOnly().booleanValue());
+// }
}
Modified:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/info/SecurityInfoTest.java
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/info/SecurityInfoTest.java 2011-06-24
20:51:14 UTC (rev 6741)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/info/SecurityInfoTest.java 2011-06-24
20:54:47 UTC (rev 6742)
@@ -22,13 +22,6 @@
******************************************************************************/
package org.gatein.pc.test.portlet.info;
-import org.gatein.pc.api.TransportGuarantee;
-import org.gatein.pc.portlet.container.managed.ManagedPortletContainer;
-import org.gatein.pc.api.info.PortletInfo;
-import org.gatein.pc.api.info.SecurityInfo;
-
-import static org.jboss.unit.api.Assert.*;
-
/**
* @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw
Dawidowicz</a>
* @version $Revision: 6720 $
@@ -41,36 +34,36 @@
super("SecurityInfoTest");
}
- public void execute()
- {
- //This asserts only .isRemotable() as rest is checked in other tests
-
- ManagedPortletContainer container =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("SecuredPortlet1");
- PortletInfo info = container.getInfo();
- SecurityInfo secInfo = info.getSecurity();
-
- secInfo = info.getSecurity();
- assertEquals(2, secInfo.getTransportGuarantees().size());
- assertTrue(secInfo.containsTransportGuarantee(TransportGuarantee.CONFIDENTIAL));
- //assertTrue(secInfo.containsTransportGuarantee(TransportGuarantee.INTEGRAL));
- assertTrue(secInfo.containsTransportGuarantee(TransportGuarantee.NONE));
-
-
- container =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("SecuredPortlet2");
- info = container.getInfo();
-
- secInfo = info.getSecurity();
- assertEquals(3, secInfo.getTransportGuarantees().size());
- assertTrue(secInfo.containsTransportGuarantee(TransportGuarantee.INTEGRAL));
- assertTrue(secInfo.containsTransportGuarantee(TransportGuarantee.CONFIDENTIAL));
- assertTrue(secInfo.containsTransportGuarantee(TransportGuarantee.NONE));
-
-
- container =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("SecuredPortlet3");
- info = container.getInfo();
- secInfo = info.getSecurity();
- assertEquals(2, secInfo.getTransportGuarantees().size());
- assertTrue(secInfo.containsTransportGuarantee(TransportGuarantee.INTEGRAL));
- assertTrue(secInfo.containsTransportGuarantee(TransportGuarantee.NONE));
- }
+// public void execute()
+// {
+// //This asserts only .isRemotable() as rest is checked in other tests
+//
+// ManagedPortletContainer container =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("SecuredPortlet1");
+// PortletInfo info = container.getInfo();
+// SecurityInfo secInfo = info.getSecurity();
+//
+// secInfo = info.getSecurity();
+// assertEquals(2, secInfo.getTransportGuarantees().size());
+// assertTrue(secInfo.containsTransportGuarantee(TransportGuarantee.CONFIDENTIAL));
+// //assertTrue(secInfo.containsTransportGuarantee(TransportGuarantee.INTEGRAL));
+// assertTrue(secInfo.containsTransportGuarantee(TransportGuarantee.NONE));
+//
+//
+// container =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("SecuredPortlet2");
+// info = container.getInfo();
+//
+// secInfo = info.getSecurity();
+// assertEquals(3, secInfo.getTransportGuarantees().size());
+// assertTrue(secInfo.containsTransportGuarantee(TransportGuarantee.INTEGRAL));
+// assertTrue(secInfo.containsTransportGuarantee(TransportGuarantee.CONFIDENTIAL));
+// assertTrue(secInfo.containsTransportGuarantee(TransportGuarantee.NONE));
+//
+//
+// container =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("SecuredPortlet3");
+// info = container.getInfo();
+// secInfo = info.getSecurity();
+// assertEquals(2, secInfo.getTransportGuarantees().size());
+// assertTrue(secInfo.containsTransportGuarantee(TransportGuarantee.INTEGRAL));
+// assertTrue(secInfo.containsTransportGuarantee(TransportGuarantee.NONE));
+// }
}
Modified:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/navigation/StateStringTestCase.java
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/navigation/StateStringTestCase.java 2011-06-24
20:51:14 UTC (rev 6741)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/navigation/StateStringTestCase.java 2011-06-24
20:54:47 UTC (rev 6742)
@@ -23,25 +23,21 @@
package org.gatein.pc.test.portlet.navigation;
+import junit.framework.TestCase;
import org.gatein.pc.api.ParametersStateString;
import org.gatein.pc.api.StateString;
-import static org.jboss.unit.api.Assert.assertEquals;
-import static org.jboss.unit.api.Assert.assertNotNull;
-import org.jboss.unit.api.pojo.annotations.Test;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
* @version $Revision: 5976 $
* @since 2.4 (Apr 30, 2006)
*/
-@Test
-public class StateStringTestCase
+public class StateStringTestCase extends TestCase
{
public static final String NAME1 = "param1";
public static final String VALUE1 = "value1";
public static final String VALUE2 = "value2";
- @Test
public void testNavigationalState() throws Exception
{
ParametersStateString ns = ParametersStateString.create();
Modified:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java 2011-06-24
20:51:14 UTC (rev 6741)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java 2011-06-24
20:54:47 UTC (rev 6742)
@@ -22,6 +22,8 @@
*/
package org.gatein.pc.test.portlet.state;
+import junit.framework.AssertionFailedError;
+import junit.framework.TestCase;
import org.gatein.common.util.Tools;
import org.gatein.common.i18n.LocalizedString;
import org.gatein.pc.api.InvalidPortletIdException;
@@ -48,10 +50,6 @@
import org.gatein.pc.portlet.state.SimplePropertyMap;
import org.gatein.pc.portlet.state.producer.PortletState;
-import static org.jboss.unit.api.Assert.*;
-
-import org.jboss.unit.api.pojo.annotations.Test;
-
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
@@ -63,7 +61,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public abstract class AbstractStatefulPortletInvokerTestCase
+public abstract class AbstractStatefulPortletInvokerTestCase extends TestCase
{
public static final String PORTLET_ID = "/foo.PortletId";
public static final String NON_EXISTING_PORTLET_ID =
"/foo.NonExistingPortletId";
@@ -205,7 +203,9 @@
}
catch (PortletInvokerException e)
{
- fail(e);
+ AssertionFailedError afe = new AssertionFailedError();
+ afe.initCause(e);
+ throw afe;
}
}
else
@@ -218,7 +218,9 @@
}
catch (PortletInvokerException e)
{
- fail(e);
+ AssertionFailedError afe = new AssertionFailedError();
+ afe.initCause(e);
+ throw afe;
}
}
}
@@ -252,7 +254,6 @@
return createPOPRef(info);
}
- @Test
public void testCloneWithNullContext() throws Exception
{
try
@@ -266,7 +267,6 @@
assertNoExistingState();
}
- @Test
public void testCloneNonExistingPOP() throws Exception
{
PortletContext popCtx = createNonExistingPOPRef();
@@ -281,7 +281,6 @@
assertNoExistingState();
}
- @Test
public void testCloneNonExistingCCP() throws Exception
{
PortletContext ccpCtx = createNonExistingLocalCCPRef();
@@ -296,7 +295,6 @@
assertNoExistingState();
}
-// @Test
// public void testCloneInvalidCCP() throws Exception
// {
// PortletContext ccpCtx = getProducer().wrapCCP("InvalidPortletId");
@@ -311,7 +309,6 @@
// assertNoExistingState();
// }
- @Test
public void testCloneInvalidPOP() throws Exception
{
PortletContext popCtx = createInvalidPOPRef();
@@ -326,7 +323,6 @@
assertNoExistingState();
}
- @Test
public void testClonePortlet() throws Exception
{
PortletInfoSupport info = new PortletInfoSupport();
@@ -370,7 +366,6 @@
assertEquals("MyPortlet", def.getString(Locale.ENGLISH, true));
}
- @Test
public void testGetWithNullId() throws Exception
{
try
@@ -383,7 +378,6 @@
}
}
- @Test
public void testGetNonExistingPOP() throws Exception
{
PortletContext pop = createNonExistingPOPRef();
@@ -397,7 +391,6 @@
}
}
- @Test
public void testGetNonExistingCCP() throws Exception
{
PortletContext ccpCtx = createNonExistingLocalCCPRef();
@@ -411,7 +404,6 @@
}
}
- @Test
public void testGetInvalidPOP() throws Exception
{
PortletContext popCtx = createInvalidPOPRef();
@@ -425,7 +417,6 @@
}
}
-// @Test
// public void testGetInvalidCCP() throws Exception
// {
// PortletContext ccpId = getProducer().wrapCCP("InvalidPortletId");
@@ -439,7 +430,6 @@
// }
// }
- @Test
public void testDestroyWithNullId() throws Exception
{
try
@@ -452,7 +442,6 @@
}
}
- @Test
public void testDestroyPOP() throws Exception
{
PortletContext popCtx = createPOPRef();
@@ -462,7 +451,6 @@
assertEquals(getPortletId(popCtx), failure.getPortletId());
}
- @Test
public void testDestroyCCP() throws Exception
{
PortletContext popCtx = createPOPRef();
@@ -482,7 +470,6 @@
// assertEquals(ccpId.getId(), failure.getPortletId());
// }
- @Test
public void testDestroyNonExistingCCP() throws Exception
{
PortletContext ccpCtx = createNonExistingLocalCCPRef();
@@ -492,7 +479,6 @@
assertEquals(getPortletId(ccpCtx), failure.getPortletId());
}
- @Test
public void testGetPropertiesWithNullPortlet() throws Exception
{
try
@@ -513,7 +499,6 @@
}
}
- @Test
public void testGetNonExistingPOPProperties() throws Exception
{
PortletContext popCtx = createNonExistingPOPRef();
@@ -535,7 +520,6 @@
}
}
- @Test
public void testGetInvalidPOPProperties() throws Exception
{
PortletContext popCtx = createInvalidPOPRef();
@@ -557,7 +541,6 @@
}
}
- @Test
public void testGetNonExistingCCPProperties() throws Exception
{
PortletContext ccpCtx = createNonExistingLocalCCPRef();
@@ -579,7 +562,6 @@
}
}
-// @Test
// public void testGetInvalidCCPProperties() throws Exception
// {
// PortletContext ccpId = getProducer().wrapCCP("InvalidPortletId");
@@ -601,7 +583,6 @@
// }
// }
- @Test
public void testGetPOPWithNullKeys() throws Exception
{
PortletContext popCtx = createPOPRef();
@@ -615,7 +596,6 @@
}
}
- @Test
public void testGetCCPWithNullKeys() throws Exception
{
PortletContext ccpCtx = createLocalCCPRef();
@@ -629,7 +609,6 @@
}
}
- @Test
public void testGetPOPProperties() throws Exception
{
PortletInfoSupport info = new PortletInfoSupport();
@@ -651,7 +630,6 @@
ValueMapAssert.assertEquals(expectedProps, props);
}
- @Test
public void testGetCCPProperties() throws Exception
{
PortletInfoSupport info = new PortletInfoSupport();
@@ -686,7 +664,6 @@
ValueMapAssert.assertEquals(expectedProps, props);
}
- @Test
public void testSetPropertiesWithNullId() throws Exception
{
try
@@ -699,7 +676,6 @@
}
}
- @Test
public void testSetPropertiesWithNullProperties() throws Exception
{
PortletContext ccpCtx = createLocalCCPRef();
@@ -713,7 +689,6 @@
}
}
- @Test
public void testSetPOPProperties() throws Exception
{
PortletContext popCtx = createPOPRef();
@@ -727,7 +702,6 @@
}
}
- @Test
public void testSetNonExistingCCPProperties() throws Exception
{
PortletContext ccpCtx = createNonExistingLocalCCPRef();
@@ -741,7 +715,6 @@
}
}
- @Test
public void testSetCCPProperties() throws Exception
{
PortletInfoSupport info = new PortletInfoSupport();
@@ -796,13 +769,11 @@
ValueMapAssert.assertEquals(expectedProps, ccpProps);
}
- @Test
public void testInvokeCloneBeforeWritePOPWithUpdate() throws Exception
{
invokeCloneBeforeWriteWithUpdate(true);
}
- @Test
public void testInvokeCloneBeforeWriteCCPWithUpdate() throws Exception
{
invokeCloneBeforeWriteWithUpdate(false);
@@ -862,7 +833,6 @@
assertCloneDoesNotExist(cloneRef);
}
- @Test
public void testInvokeReadOnlyWithUpdate() throws Exception
{
final Boolean[] ise = {Boolean.FALSE};
@@ -903,7 +873,6 @@
assertEquals(Boolean.TRUE, ise[0]);
}
- @Test
public void testInvokeReadWriteWithUpdate() throws Exception
{
PortletInfoSupport info = new PortletInfoSupport();
@@ -978,7 +947,6 @@
}
}
- @Test
public void testExportNullPortletContext() throws Exception
{
try
@@ -993,7 +961,6 @@
assertNoExistingState();
}
- @Test
public void testExportsNonExisitngPOP() throws Exception
{
PortletContext popCTX = createNonExistingPOPRef();
@@ -1009,7 +976,6 @@
assertNoExistingState();
}
- @Test
public void testExportNonExisitngCCP() throws Exception
{
PortletContext ccpCTX = createNonExistingLocalCCPRef();
@@ -1025,7 +991,6 @@
assertNoExistingState();
}
- @Test
public void testExportInvalidPOP() throws Exception
{
PortletContext popCtx = createInvalidPOPRef();
@@ -1040,7 +1005,6 @@
assertNoExistingState();
}
- @Test
public void testExportPortlet() throws Exception
{
PropertyMap expectedProperties = new SimplePropertyMap();
@@ -1126,7 +1090,6 @@
}
- @Test
public void testImportNullPortletContext() throws Exception
{
try
@@ -1141,7 +1104,6 @@
assertNoExistingState();
}
- @Test
public void testImportsNonExisitngPOP() throws Exception
{
PortletContext popCTX = createNonExistingPOPRef();
@@ -1157,7 +1119,6 @@
assertNoExistingState();
}
- @Test
public void testImportNonExisitngCCP() throws Exception
{
PortletContext ccpCTX = createNonExistingLocalCCPRef();
@@ -1173,7 +1134,6 @@
assertNoExistingState();
}
- @Test
public void testImportInvalidPOP() throws Exception
{
PortletContext popCtx = createInvalidPOPRef();
@@ -1188,7 +1148,6 @@
assertNoExistingState();
}
- @Test
public void testImport() throws Exception
{
//This will create the portlet into the container and check that it doesn't
have any properties set
@@ -1211,5 +1170,4 @@
//Make sure that this new portlet has the properties we want
assertEquals(propertyMap, getProperties(importedPortletContext));
}
-
}
Modified:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java 2011-06-24
20:51:14 UTC (rev 6741)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java 2011-06-24
20:54:47 UTC (rev 6742)
@@ -45,10 +45,6 @@
import org.gatein.pc.portlet.state.producer.ProducerPortletInvoker;
import org.gatein.pc.portlet.state.producer.ProducerPortlet;
-import static org.jboss.unit.api.Assert.*;
-
-import org.jboss.unit.api.pojo.annotations.Create;
-
import java.util.Collections;
import java.util.List;
import java.util.Set;
@@ -57,7 +53,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class ConsumerStatefulPortletInvokerTestCase extends
AbstractStatefulPortletInvokerTestCase
+public abstract class ConsumerStatefulPortletInvokerTestCase extends
AbstractStatefulPortletInvokerTestCase
{
public ConsumerStatefulPortletInvokerTestCase(boolean persistLocally)
{
@@ -85,7 +81,6 @@
/** . */
protected StateConverter stateConverter;
- @Create
public void setUp() throws Exception
{
consumer = new ConsumerPortletInvoker();
Modified:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java 2011-06-24
20:51:14 UTC (rev 6741)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java 2011-06-24
20:54:47 UTC (rev 6742)
@@ -42,15 +42,11 @@
import org.gatein.pc.portlet.support.PortletInvokerSupport;
import org.gatein.pc.portlet.support.PortletSupport;
import org.gatein.pc.portlet.support.info.PortletInfoSupport;
-import org.jboss.unit.api.pojo.annotations.Create;
-import org.jboss.unit.api.pojo.annotations.Test;
import java.util.Collections;
import java.util.List;
import java.util.Set;
-import static org.jboss.unit.api.Assert.*;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 6691 $
@@ -78,8 +74,8 @@
/** . */
protected StateConverter stateConverter;
- @Create
- public void create() throws Exception
+ @Override
+ protected void setUp() throws Exception
{
producer = new ProducerPortletInvoker();
container = new PortletInvokerSupport();
@@ -252,7 +248,6 @@
return producer.exportPortlet(PortletStateType.OPAQUE, originalPortletContext);
}
- @Test
public void testGetStatus() throws Exception
{
PortletInfoSupport info = new PortletInfoSupport();
Modified:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/StateConverterV0TestCase.java
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/StateConverterV0TestCase.java 2011-06-24
20:51:14 UTC (rev 6741)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/StateConverterV0TestCase.java 2011-06-24
20:54:47 UTC (rev 6742)
@@ -22,6 +22,7 @@
******************************************************************************/
package org.gatein.pc.test.portlet.state;
+import junit.framework.TestCase;
import org.gatein.pc.portlet.impl.state.StateConverterV0;
import org.gatein.pc.api.PortletStateType;
import org.gatein.pc.api.state.PropertyMap;
@@ -30,9 +31,6 @@
import org.gatein.pc.portlet.state.StateConverter;
import org.gatein.pc.portlet.state.producer.PortletState;
-import static org.jboss.unit.api.Assert.*;
-import org.jboss.unit.api.pojo.annotations.Test;
-
import java.util.Arrays;
import java.util.ArrayList;
@@ -40,13 +38,11 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-@Test
-public class StateConverterV0TestCase
+public class StateConverterV0TestCase extends TestCase
{
private final StateConverter converter = new StateConverterV0();
- @Test
public void testIAE() throws StateConversionException
{
try
@@ -67,7 +63,6 @@
}
}
- @Test
public void testAlteredMagic() throws StateConversionException
{
byte[] bytes = converter.marshall(PortletStateType.OPAQUE, new
PortletState("foo"));
@@ -85,7 +80,6 @@
}
}
- @Test
public void testBadVersionNumber() throws StateConversionException
{
byte[] bytes = converter.marshall(PortletStateType.OPAQUE,new
PortletState("foo"));
@@ -100,7 +94,6 @@
}
}
- @Test
public void testWorks() throws Exception
{
assertWorks(new PortletState("foo"));
Modified:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/ValueMapAssert.java
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/ValueMapAssert.java 2011-06-24
20:51:14 UTC (rev 6741)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/ValueMapAssert.java 2011-06-24
20:54:47 UTC (rev 6742)
@@ -22,18 +22,17 @@
******************************************************************************/
package org.gatein.pc.test.portlet.state;
+import junit.framework.Assert;
import org.gatein.pc.api.state.PropertyMap;
import java.util.HashSet;
import java.util.List;
-import org.jboss.unit.api.Assert;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 5448 $
*/
-public class ValueMapAssert
+public class ValueMapAssert extends Assert
{
public static void assertEquals(PropertyMap vm1, PropertyMap vm2)
{
@@ -41,24 +40,22 @@
{
if (vm2 != null)
{
- Assert.fail("Value map should be null");
+ fail("Value map should be null");
}
}
else
{
if (vm2 == null)
{
- Assert.fail("Value map should not be null");
+ fail("Value map should not be null");
}
- Assert.assertEquals("Value maps don't have the same keys", new
HashSet<String>(vm1.keySet()), new HashSet<String>(vm2.keySet()));
+ assertEquals("Value maps don't have the same keys", new
HashSet<String>(vm1.keySet()), new HashSet<String>(vm2.keySet()));
for (String key : vm1.keySet())
{
List<String> v1 = vm1.getProperty(key);
List<String> v2 = vm2.getProperty(key);
- Assert.assertEquals("Values for key " + key + " are not
equals", v1, v2);
+ assertEquals("Values for key " + key + " are not equals",
v1, v2);
}
}
}
-
-
}