Author: julien_viet
Date: 2011-08-31 18:32:32 -0400 (Wed, 31 Aug 2011)
New Revision: 7269
Added:
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/content/
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/content/ContentRegistryTestCase.java
Modified:
portal/branches/api/component/api-impl/pom.xml
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/AbstractAPITestCase.java
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/id/ComplexApplicationContextTestCase.java
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/portal/NavigationTestCase.java
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/portal/SiteTestCase.java
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/util/AggregatedIterableIdentifiableCollectionTestCase.java
Log:
embryo of content registry unit test
Modified: portal/branches/api/component/api-impl/pom.xml
===================================================================
--- portal/branches/api/component/api-impl/pom.xml 2011-08-31 22:02:22 UTC (rev 7268)
+++ portal/branches/api/component/api-impl/pom.xml 2011-08-31 22:32:32 UTC (rev 7269)
@@ -62,13 +62,6 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
-
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- <version>5.14.10</version>
- <scope>test</scope>
- </dependency>
</dependencies>
</project>
\ No newline at end of file
Modified:
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/AbstractAPITestCase.java
===================================================================
---
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/AbstractAPITestCase.java 2011-08-31
22:02:22 UTC (rev 7268)
+++
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/AbstractAPITestCase.java 2011-08-31
22:32:32 UTC (rev 7269)
@@ -1,15 +1,32 @@
package org.gatein.portal.api.impl;
+import junit.framework.AssertionFailedError;
+import org.exoplatform.component.test.ConfigurationUnit;
+import org.exoplatform.component.test.ConfiguredBy;
+import org.exoplatform.component.test.ContainerScope;
import org.exoplatform.container.PortalContainer;
import org.exoplatform.portal.AbstractPortalTest;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.SiteType;
+import org.exoplatform.portal.mop.navigation.NavigationContext;
import org.exoplatform.portal.mop.navigation.NavigationService;
+import org.exoplatform.portal.mop.navigation.NavigationState;
+import org.exoplatform.portal.mop.navigation.NodeContext;
+import org.exoplatform.portal.mop.navigation.NodeModel;
+import org.exoplatform.portal.mop.navigation.Scope;
import org.exoplatform.portal.pom.config.POMSessionManager;
import org.exoplatform.portal.pom.data.ModelDataStorage;
import org.exoplatform.web.application.RequestContext;
import org.gatein.api.GateIn;
/** @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a> */
-public class AbstractAPITestCase extends AbstractPortalTest
+@ConfiguredBy({
+ @ConfigurationUnit(scope = ContainerScope.PORTAL, path =
"conf/exo.portal.component.test.jcr-configuration.xml"),
+ @ConfigurationUnit(scope = ContainerScope.PORTAL, path =
"conf/exo.portal.component.identity-configuration.xml"),
+ @ConfigurationUnit(scope = ContainerScope.PORTAL, path =
"conf/exo.portal.component.portal-configuration.xml")
+})
+public abstract class AbstractAPITestCase extends AbstractPortalTest
{
/** . */
@@ -54,4 +71,30 @@
RequestContext.setCurrentInstance(new SimpleRequestContext(null));
}
+ @Override
+ protected void tearDown() throws Exception
+ {
+ end(false);
+ }
+
+ protected NodeContext createSite(SiteType type, String name)
+ {
+ try
+ {
+ storage.create(new PortalConfig(type.getName(), name).build());
+ NavigationContext nav = new NavigationContext(new SiteKey(type, name), new
NavigationState(0));
+ navService.saveNavigation(nav);
+ //
+ storage.create(new org.exoplatform.portal.config.model.Page(type.getName(),
name, "homepage").build());
+
+ //
+ return navService.loadNode(NodeModel.SELF_MODEL, nav, Scope.ALL, null);
+ }
+ catch (Exception e)
+ {
+ AssertionFailedError afe = new AssertionFailedError();
+ afe.initCause(e);
+ throw afe;
+ }
+ }
}
Added:
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/content/ContentRegistryTestCase.java
===================================================================
---
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/content/ContentRegistryTestCase.java
(rev 0)
+++
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/content/ContentRegistryTestCase.java 2011-08-31
22:32:32 UTC (rev 7269)
@@ -0,0 +1,23 @@
+package org.gatein.portal.api.impl.content;
+
+import org.exoplatform.portal.mop.SiteType;
+import org.gatein.api.content.ContentRegistry;
+import org.gatein.portal.api.impl.AbstractAPITestCase;
+
+/** @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a> */
+public class ContentRegistryTestCase extends AbstractAPITestCase
+{
+
+ public void testFoo()
+ {
+ createSite(SiteType.PORTAL, "classic");
+
+ //
+ ContentRegistry registry = gatein.getDefaultPortal().getContentRegistry();
+
+ //
+ registry.getCategoryNames();
+
+ }
+
+}
Modified:
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/id/ComplexApplicationContextTestCase.java
===================================================================
---
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/id/ComplexApplicationContextTestCase.java 2011-08-31
22:02:22 UTC (rev 7268)
+++
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/id/ComplexApplicationContextTestCase.java 2011-08-31
22:32:32 UTC (rev 7269)
@@ -22,15 +22,9 @@
package org.gatein.portal.api.impl.id;
-import org.gatein.api.content.Portlet;
-import org.gatein.api.id.Id;
-import org.gatein.portal.api.impl.GateInImpl;
-import org.testng.annotations.Test;
-
/** @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a> */
public class ComplexApplicationContextTestCase
{
- @Test
public void checkParsing()
{
/*
Modified:
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/portal/NavigationTestCase.java
===================================================================
---
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/portal/NavigationTestCase.java 2011-08-31
22:02:22 UTC (rev 7268)
+++
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/portal/NavigationTestCase.java 2011-08-31
22:32:32 UTC (rev 7269)
@@ -1,70 +1,19 @@
package org.gatein.portal.api.impl.portal;
-import junit.framework.AssertionFailedError;
-import org.exoplatform.component.test.ConfigurationUnit;
-import org.exoplatform.component.test.ConfiguredBy;
-import org.exoplatform.component.test.ContainerScope;
-import org.exoplatform.container.PortalContainer;
-import org.exoplatform.portal.AbstractPortalTest;
-import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.mop.SiteKey;
import org.exoplatform.portal.mop.SiteType;
-import org.exoplatform.portal.mop.navigation.NavigationContext;
-import org.exoplatform.portal.mop.navigation.NavigationService;
-import org.exoplatform.portal.mop.navigation.NavigationState;
import org.exoplatform.portal.mop.navigation.NodeContext;
-import org.exoplatform.portal.mop.navigation.NodeModel;
-import org.exoplatform.portal.mop.navigation.Scope;
-import org.exoplatform.portal.pom.config.POMSessionManager;
-import org.exoplatform.portal.pom.data.ModelDataStorage;
-import org.exoplatform.web.application.RequestContext;
-import org.gatein.api.GateIn;
import org.gatein.api.portal.Navigation;
import org.gatein.api.portal.Page;
import org.gatein.api.portal.Site;
import org.gatein.portal.api.impl.AbstractAPITestCase;
-import org.gatein.portal.api.impl.GateInImpl;
-import org.gatein.portal.api.impl.SimpleRequestContext;
import java.net.URI;
import java.util.Iterator;
/** @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a> */
-@ConfiguredBy({
- @ConfigurationUnit(scope = ContainerScope.PORTAL, path =
"conf/exo.portal.component.test.jcr-configuration.xml"),
- @ConfigurationUnit(scope = ContainerScope.PORTAL, path =
"conf/exo.portal.component.identity-configuration.xml"),
- @ConfigurationUnit(scope = ContainerScope.PORTAL, path =
"conf/exo.portal.component.portal-configuration.xml")
-})
public class NavigationTestCase extends AbstractAPITestCase
{
- private NodeContext createSite(SiteType type, String name)
- {
- try
- {
- storage.create(new PortalConfig(type.getName(), name).build());
- NavigationContext nav = new NavigationContext(new SiteKey(type, name), new
NavigationState(0));
- navService.saveNavigation(nav);
- //
- storage.create(new org.exoplatform.portal.config.model.Page(type.getName(),
name, "homepage").build());
-
- //
- return navService.loadNode(NodeModel.SELF_MODEL, nav, Scope.ALL, null);
- }
- catch (Exception e)
- {
- AssertionFailedError afe = new AssertionFailedError();
- afe.initCause(e);
- throw afe;
- }
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- end(false);
- }
-
public void testEmptyNavigation()
{
createSite(SiteType.PORTAL, "classic");
Modified:
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/portal/SiteTestCase.java
===================================================================
---
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/portal/SiteTestCase.java 2011-08-31
22:02:22 UTC (rev 7268)
+++
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/portal/SiteTestCase.java 2011-08-31
22:32:32 UTC (rev 7269)
@@ -22,26 +22,24 @@
package org.gatein.portal.api.impl.portal;
+import junit.framework.TestCase;
import org.exoplatform.portal.mop.SiteType;
import org.exoplatform.portal.pom.data.PageKey;
import org.exoplatform.portal.pom.data.PortalKey;
import org.gatein.api.portal.Site;
import org.gatein.api.util.Type;
import org.gatein.portal.api.impl.util.GateInTypesResolver;
-import org.testng.annotations.Test;
/** @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a> */
-public class SiteTestCase
+public class SiteTestCase extends TestCase
{
- @Test
- public void checkThatTypesAreProperlyResolvedEvenIfClassIsNotLoaded()
+ public void testCheckThatTypesAreProperlyResolvedEvenIfClassIsNotLoaded()
{
Type portal = GateInTypesResolver.forName("portal", Site.class);
assert portal != null;
}
- @Test
- public void getAPITypeShouldProperlyResolve()
+ public void testGetAPITypeShouldProperlyResolve()
{
assert Site.DASHBOARD.equals(SiteImpl.getAPITypeFrom(new
PageKey(SiteType.USER.getName(), "foo", "foo")));
assert Site.GROUP.equals(SiteImpl.getAPITypeFrom(new
PageKey(SiteType.GROUP.getName(), "foo", "foo")));
Modified:
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/util/AggregatedIterableIdentifiableCollectionTestCase.java
===================================================================
---
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/util/AggregatedIterableIdentifiableCollectionTestCase.java 2011-08-31
22:02:22 UTC (rev 7268)
+++
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/util/AggregatedIterableIdentifiableCollectionTestCase.java 2011-08-31
22:32:32 UTC (rev 7269)
@@ -22,18 +22,6 @@
package org.gatein.portal.api.impl.util;
-import org.gatein.api.id.Id;
-import org.gatein.api.id.Identifiable;
-import org.gatein.api.util.IterableIdentifiableCollection;
-import org.gatein.portal.api.impl.GateInImpl;
-import org.gatein.portal.api.impl.IdentifiableImpl;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.NoSuchElementException;
-
/** @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a> */
public class AggregatedIterableIdentifiableCollectionTestCase
{