Author: chris.laprun(a)jboss.com
Date: 2011-04-07 11:02:19 -0400 (Thu, 07 Apr 2011)
New Revision: 6174
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/ConsumerStatefulPortletInvokerTestCase.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java
Log:
- GTNPC-58: Use constants and change portlet id value so that it passes PortletContext
validation.
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-04-07
14:27:35 UTC (rev 6173)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java 2011-04-07
15:02:19 UTC (rev 6174)
@@ -1,25 +1,25 @@
-/******************************************************************************
- * 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. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, 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.state;
import org.gatein.common.util.Tools;
@@ -65,6 +65,9 @@
*/
public abstract class AbstractStatefulPortletInvokerTestCase
{
+ public static final String PORTLET_ID = "/foo.PortletId";
+ public static final String NON_EXISTING_PORTLET_ID =
"/foo.NonExistingPortletId";
+ public static final String INVALID_PORTLET_ID = "/foo.InvalidPortletId";
/** . */
protected final boolean persistLocally;
@@ -472,7 +475,7 @@
// @Test
// public void testDestroyInvalidCCP() throws Exception
// {
-// PortletContext ccpId = getProducer().wrapCCP("PortletId");
+// PortletContext ccpId = getProducer().wrapCCP(PORTLET_ID);
// List failures = getProducer().destroyClones(Collections.singletonList(ccpId));
// assertEquals(1, failures.size());
// DestroyCloneFailure failure = (DestroyCloneFailure)failures.get(0);
@@ -1050,7 +1053,7 @@
PortletContext export0Ctx = exportPortletContext(popCtx);
//Make sure we get back the ID for the original portlet
- assertEquals("PortletId", export0Ctx.getId());
+ assertEquals(PORTLET_ID, export0Ctx.getId());
//check by doing an import
checkWithImportPortlet(export0Ctx, popCtx, new SimplePropertyMap());
@@ -1060,7 +1063,7 @@
PortletContext export1Ctx = exportPortletContext(popCtx);
//Make sure we get back the ID for the original portlet
- assertEquals("PortletId", export1Ctx.getId());
+ assertEquals(PORTLET_ID, export1Ctx.getId());
//check by doing an import
checkWithImportPortlet(export1Ctx, popCtx, expectedProperties);
@@ -1068,7 +1071,7 @@
PortletContext export2Ctx = exportPortletContext(ccp1Ctx);
//Make sure we get back the ID for the original portlet
- assertEquals("PortletId", export2Ctx.getId());
+ assertEquals(PORTLET_ID, export2Ctx.getId());
//Check by doing an import
checkWithImportPortlet(export2Ctx, ccp1Ctx, expectedProperties);
@@ -1083,7 +1086,7 @@
PortletContext export3Ctx = exportPortletContext(ccp2Ctx);
//Make sure we get back the ID for the original portlet
- assertEquals("PortletId", export3Ctx.getId());
+ assertEquals(PORTLET_ID, export3Ctx.getId());
//Check by doing an import
checkWithImportPortlet(export3Ctx, ccp2Ctx, expectedProperties);
}
@@ -1198,10 +1201,10 @@
StateConverter sc = new StateConverterV0();
PropertyMap propertyMap = new SimplePropertyMap();
propertyMap.setProperty("test", Arrays.asList("123"));
- PortletState portletState = new PortletState("PortletId", propertyMap);
+ PortletState portletState = new PortletState(PORTLET_ID, propertyMap);
byte[] stateBytes = sc.marshall(PortletStateType.OPAQUE, portletState);
- StatefulPortletContext portletContext =
StatefulPortletContext.create("PortletId", PortletStateType.OPAQUE,
stateBytes);
+ StatefulPortletContext portletContext = StatefulPortletContext.create(PORTLET_ID,
PortletStateType.OPAQUE, stateBytes);
//import portlet
PortletContext importedPortletContext = importPortletContext(portletContext);
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-04-07
14:27:35 UTC (rev 6173)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java 2011-04-07
15:02:19 UTC (rev 6174)
@@ -1,25 +1,25 @@
-/******************************************************************************
- * 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. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, 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.state;
import org.gatein.pc.api.Portlet;
@@ -46,6 +46,7 @@
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;
@@ -58,7 +59,6 @@
*/
public class ConsumerStatefulPortletInvokerTestCase extends
AbstractStatefulPortletInvokerTestCase
{
-
public ConsumerStatefulPortletInvokerTestCase(boolean persistLocally)
{
super(persistLocally);
@@ -137,24 +137,24 @@
protected PortletContext createPOPRef(PortletInfoSupport portletSupport) throws
PortletInvokerException
{
- container.addPortlet("PortletId", portletSupport);
+ container.addPortlet(PORTLET_ID, portletSupport);
Portlet portlet = getSinglePOP();
return portlet.getContext();
}
protected PortletContext createNonExistingPOPRef() throws PortletInvokerException
{
- container.addPortlet("NonExistingPortletId", new PortletInfoSupport());
+ container.addPortlet(NON_EXISTING_PORTLET_ID, new PortletInfoSupport());
PortletContext popContext = getSinglePOP().getContext();
- container.removePortlet("NonExistingPortletId");
+ container.removePortlet(NON_EXISTING_PORTLET_ID);
return popContext;
}
protected PortletContext createInvalidPOPRef() throws PortletInvokerException
{
- container.addPortlet("InvalidPortletId", new PortletInfoSupport());
+ container.addPortlet(INVALID_PORTLET_ID, new PortletInfoSupport());
PortletContext popContext = getSinglePOP().getContext();
- container.setValid("InvalidPortletId", false);
+ container.setValid(INVALID_PORTLET_ID, false);
return popContext;
}
@@ -252,12 +252,12 @@
assertEquals(1, portlets.size());
return (Portlet)portlets.iterator().next();
}
-
+
protected PortletContext importPortletContext(PortletContext contextToImport) throws
PortletInvokerException
{
return consumer.importPortlet(PortletStateType.OPAQUE, contextToImport);
}
-
+
protected PortletContext exportPortletContext(PortletContext originalPortletContext)
throws PortletInvokerException
{
return consumer.exportPortlet(PortletStateType.OPAQUE, originalPortletContext);
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-04-07
14:27:35 UTC (rev 6173)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java 2011-04-07
15:02:19 UTC (rev 6174)
@@ -1,25 +1,25 @@
-/******************************************************************************
- * 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. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, 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.state;
import org.gatein.pc.api.Portlet;
@@ -104,24 +104,24 @@
protected PortletContext createPOPRef(PortletInfoSupport portletSupport) throws
PortletInvokerException
{
- container.addPortlet("PortletId", portletSupport);
+ container.addPortlet(PORTLET_ID, portletSupport);
Portlet portlet = getSinglePOP();
return portlet.getContext();
}
protected PortletContext createNonExistingPOPRef()
{
- container.addPortlet("NonExistingPortletId", new PortletInfoSupport());
+ container.addPortlet(NON_EXISTING_PORTLET_ID, new PortletInfoSupport());
PortletContext popCtx = getSinglePOP().getContext();
- container.removePortlet("NonExistingPortletId");
+ container.removePortlet(NON_EXISTING_PORTLET_ID);
return popCtx;
}
protected PortletContext createInvalidPOPRef()
{
- container.addPortlet("InvalidPortletId", new PortletInfoSupport());
+ container.addPortlet(INVALID_PORTLET_ID, new PortletInfoSupport());
PortletContext popCtx = getSinglePOP().getContext();
- container.setValid("InvalidPortletId", false);
+ container.setValid(INVALID_PORTLET_ID, false);
return popCtx;
}