Author: theute
Date: 2011-10-03 19:16:27 -0400 (Mon, 03 Oct 2011)
New Revision: 7636
Added:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/AbstractDataImportTest.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/AbstractSiteDataImportTest.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportConserve.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportInsert.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportMerge.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportOverwrite.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/user/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/user/root/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/user/root/navigation.xml
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/user/root/pages.xml
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/user/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/user/root/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/user/root/navigation.xml
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/user/root/pages.xml
Removed:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImport.java
Modified:
epp/portal/branches/EPP_5_2_Branch/component/portal/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/conf/gatein-nodetypes.xml
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfig.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/importer/Imported.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/importer/NavigationImporter.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportFragmentTest.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportNavigationTest.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportTest.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImportFragmentConserve.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImportFragmentInsert.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImportFragmentOverwrite.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationConserve.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationInsert.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationMerge.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationOverwrite.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport0-configuration.xml
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport1-configuration.xml
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport2-configuration.xml
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/portal/classic/pages.xml
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/portal/classic/pages.xml
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml
Log:
JBEPP-1250: Import Mode for Portal Config and Page data import
Property changes on: epp/portal/branches/EPP_5_2_Branch/component/portal
___________________________________________________________________
Added: svn:mergeinfo
+ /portal/trunk:7451
/portal/trunk/component/portal:7451
Modified:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/conf/gatein-nodetypes.xml
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/conf/gatein-nodetypes.xml 2011-10-03
22:45:45 UTC (rev 7635)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/conf/gatein-nodetypes.xml 2011-10-03
23:16:27 UTC (rev 7636)
@@ -22,6 +22,9 @@
<supertypes>
</supertypes>
<propertyDefinitions>
+ <propertyDefinition name="gtn:status" requiredType="int"
autoCreated="false" mandatory="false" onParentVersion="COPY"
protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
<propertyDefinition name="gtn:creationdate"
requiredType="Date" autoCreated="false" mandatory="false"
onParentVersion="COPY" protected="false"
multiple="false">
<valueConstraints/>
</propertyDefinition>
Property changes on:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org
___________________________________________________________________
Modified: svn:mergeinfo
- /epp/portal/branches/EPP_5_1_0_GA_JBEPP-795/component/portal/src/main/java/org:5868
/portal/branches/branch-GTNPORTAL-1592/component/portal/src/main/java/org:4894
/portal/branches/branch-GTNPORTAL-1643/component/portal/src/main/java/org:5002,5063,5167
/portal/branches/branch-GTNPORTAL-1700/component/portal/src/main/java/org:5348,5363,5402,5445
/portal/branches/branch-GTNPORTAL-1731/component/portal/src/main/java/org:5622,5644,5668
/portal/branches/branch-GTNPORTAL-1745/component/portal/src/main/java/org:5765
/portal/branches/branch-GTNPORTAL-1790/component/portal/src/main/java/org:5871
/portal/branches/branch-GTNPORTAL-1822/component/portal/src/main/java/org:5943,5952
/portal/branches/branch-GTNPORTAL-1832/component/portal/src/main/java/org:6030,6063
/portal/branches/branch-GTNPORTAL-1872/component/portal/src/main/java/org:6400,6551
/portal/branches/branch-GTNPORTAL-1921/component/portal/src/main/java/org:6603,6771-6772,6774
/portal/branches/branch-GTNPORTAL-1963/component/portal/src/main/java/org:6904,6915-6916
/portal/trunk/component/portal/src/main/java/org:4876,4891,5269,5744,5822,5943,6031,6033,6168,6196,6201-6203,6205-6206,6223,6292,6323,6437,6440,6449,6452,6573,6741,6783-6784,6912-6913,6960,7042,7061,7095,7117,7120,7125,7132-7134,7186,7198,7239,7262,7308,7326,7330-7334,7359,7367,7433,7450,7452,7454,7478,7497,7500,7552,7554-7555,7598
+ /epp/portal/branches/EPP_5_1_0_GA_JBEPP-795/component/portal/src/main/java/org:5868
/portal/branches/branch-GTNPORTAL-1592/component/portal/src/main/java/org:4894
/portal/branches/branch-GTNPORTAL-1643/component/portal/src/main/java/org:5002,5063,5167
/portal/branches/branch-GTNPORTAL-1700/component/portal/src/main/java/org:5348,5363,5402,5445
/portal/branches/branch-GTNPORTAL-1731/component/portal/src/main/java/org:5622,5644,5668
/portal/branches/branch-GTNPORTAL-1745/component/portal/src/main/java/org:5765
/portal/branches/branch-GTNPORTAL-1790/component/portal/src/main/java/org:5871
/portal/branches/branch-GTNPORTAL-1822/component/portal/src/main/java/org:5943,5952
/portal/branches/branch-GTNPORTAL-1832/component/portal/src/main/java/org:6030,6063
/portal/branches/branch-GTNPORTAL-1872/component/portal/src/main/java/org:6400,6551
/portal/branches/branch-GTNPORTAL-1921/component/portal/src/main/java/org:6603,6771-6772,6774
/portal/branches/branch-GTNPORTAL-1963/component/portal/src/main/java/org:6904,6915-6916
/portal/trunk/component/portal/src/main/java/org:4876,4891,5269,5744,5822,5943,6031,6033,6168,6196,6201-6203,6205-6206,6223,6292,6323,6437,6440,6449,6452,6573,6741,6783-6784,6912-6913,6960,7042,7061,7095,7117,7120,7125,7132-7134,7186,7198,7239,7262,7308,7326,7330-7334,7359,7367,7433,7450-7452,7454,7478,7497,7500,7552,7554-7555,7598
/portal/trunk/src/main/java/org:7451
Modified:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfig.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfig.java 2011-10-03
22:45:45 UTC (rev 7635)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfig.java 2011-10-03
23:16:27 UTC (rev 7636)
@@ -45,8 +45,6 @@
private String importMode;
- final Set<String> createdOwners = new HashSet<String>();
-
/**
* @deprecated use the location instead
*/
Modified:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2011-10-03
22:45:45 UTC (rev 7635)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2011-10-03
23:16:27 UTC (rev 7636)
@@ -31,7 +31,10 @@
import org.exoplatform.portal.config.model.NavigationFragment;
import org.exoplatform.portal.mop.importer.ImportMode;
import org.exoplatform.portal.mop.importer.Imported;
+import org.exoplatform.portal.mop.importer.Imported.Status;
import org.exoplatform.portal.mop.importer.NavigationImporter;
+import org.exoplatform.portal.mop.importer.PageImporter;
+import org.exoplatform.portal.mop.importer.PortalConfigImporter;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.ModelUnmarshaller;
import org.exoplatform.portal.config.model.Page;
@@ -49,7 +52,6 @@
import org.gatein.mop.api.workspace.Workspace;
import org.jibx.runtime.*;
-import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
@@ -116,6 +118,10 @@
/** . */
private DescriptionService descriptionService_;
+ final Set<String> createdOwners = new HashSet<String>();
+
+ private boolean isFirstStartup = false;
+
public NewPortalConfigListener(
UserPortalConfigService owner,
POMSessionManager pomMgr,
@@ -189,6 +195,7 @@
Workspace workspace = session.getWorkspace();
Imported imported = workspace.adapt(Imported.class);
imported.setLastModificationDate(new Date());
+ imported.setStatus(Status.DONE.status());
session.save();
}
finally
@@ -197,34 +204,50 @@
}
}
- private boolean performImport()
+ private boolean performImport() throws Exception
{
RequestLifeCycle.begin(PortalContainer.getInstance());
try
{
+
+ POMSession session = pomMgr.getSession();
+
+ // Obtain the status
+ Workspace workspace = session.getWorkspace();
+ boolean perform = !workspace.isAdapted(Imported.class);
+
+
+ // We mark it
+ if (perform)
+ {
+ Imported imported = workspace.adapt(Imported.class);
+ imported.setCreationDate(new Date());
+ session.save();
+
+ // for legacy checking
+ if (dataStorage_.getPortalConfig(defaultPortal) != null)
+ {
+ perform = false;
+ }
+ else
+ {
+ isFirstStartup = true;
+ }
+ }
+ else
+ {
+ Imported imported = workspace.adapt(Imported.class);
+ Status status = Status.getStatus(imported.getStatus());
+ perform = (Status.WANT_REIMPORT == status);
+ }
+
if (overrideExistingData)
{
return true;
}
- else
- {
- POMSession session = pomMgr.getSession();
- // Obtain the status
- Workspace workspace = session.getWorkspace();
- boolean perform = !workspace.isAdapted(Imported.class);
-
- // We mark it
- if (perform)
- {
- Imported imported = workspace.adapt(Imported.class);
- imported.setCreationDate(new Date());
- session.save();
- }
-
- //
- return perform;
- }
+ //
+ return perform;
}
finally
{
@@ -249,7 +272,7 @@
{
try
{
- initPortletPreferencesDB(ele);
+ initPortalConfigDB(ele);
}
catch (Exception e)
{
@@ -260,7 +283,7 @@
{
try
{
- initPortalConfigDB(ele);
+ initPortletPreferencesDB(ele);
}
catch (Exception e)
{
@@ -313,9 +336,6 @@
log.error("NewPortalConfig error: " + e.getMessage(), e);
}
}
-
- //
- touchImport();
}
else
{
@@ -324,11 +344,11 @@
{
for (NewPortalConfig ele : configs)
{
- initPortletPreferencesDB(ele);
+ initPortalConfigDB(ele);
}
for (NewPortalConfig ele : configs)
{
- initPortalConfigDB(ele);
+ initPortletPreferencesDB(ele);
}
}
finally
@@ -355,10 +375,10 @@
{
ele.getPredefinedOwner().clear();
}
-
- //
- touchImport();
}
+
+ //
+ touchImport();
}
String getDefaultPortal()
@@ -435,7 +455,7 @@
{
if (createPortalConfig(config, owner))
{
- config.createdOwners.add(owner);
+ this.createdOwners.add(owner);
}
}
}
@@ -444,7 +464,7 @@
{
for (String owner : config.getPredefinedOwner())
{
- if (config.createdOwners.contains(owner))
+ if (this.createdOwners.contains(owner))
{
createPage(config, owner);
}
@@ -473,45 +493,28 @@
public boolean createPortalConfig(NewPortalConfig config, String owner) throws
Exception
{
String type = config.getOwnerType();
- PortalConfig currentPortalConfig = dataStorage_.getPortalConfig(type, owner);
- if (currentPortalConfig == null)
+ UnmarshalledObject<PortalConfig> obj = getConfig(config, owner, type,
PortalConfig.class);
+
+ ImportMode importMode = getRightMode(config.getImportMode());
+
+ PortalConfig pConfig = (obj != null) ? obj.getObject() : null;
+ if (pConfig == null)
{
- try
- {
- UnmarshalledObject<PortalConfig> obj = getConfig(config, owner, type,
PortalConfig.class);
-
- if (obj == null)
- {
- // Ensure that the PortalConfig has been defined
- // The PortalConfig could be empty if the related PortalConfigListener
- // has been launched after starting this service
- PortalConfig cfg = dataStorage_.getPortalConfig(type, owner);
- if (cfg == null)
- {
- cfg = new PortalConfig(type);
- cfg.setPortalLayout(new Container());
- cfg.setName(owner);
- dataStorage_.create(cfg);
- return true;
- }
- }
- else
- {
- PortalConfig pconfig = obj.getObject();
- // We use that owner value because it may have been fixed for group names
- owner = pconfig.getName();
- dataStorage_.create(pconfig);
- return true;
- }
- }
- catch (IOException e)
- {
- log.error("Could not load portal configuration", e);
- }
+ pConfig = new PortalConfig(type);
+ pConfig.setPortalLayout(new Container());
+ pConfig.setName(owner);
}
-
- //
- return false;
+
+ PortalConfigImporter portalImporter = new PortalConfigImporter(importMode, pConfig,
dataStorage_);
+ try
+ {
+ portalImporter.perform();
+ return true;
+ }
+ catch (Exception ex)
+ {
+ return false;
+ }
}
public void createPage(NewPortalConfig config, String owner) throws Exception
@@ -526,8 +529,11 @@
{
RequestLifeCycle.begin(PortalContainer.getInstance());
try
- {
- dataStorage_.create(page);
+ { //
+ ImportMode importMode = getRightMode(config.getImportMode());
+
+ PageImporter importer = new PageImporter(importMode, page, dataStorage_);
+ importer.perform();
}
finally
{
@@ -548,15 +554,7 @@
PageNavigation navigation = obj.getObject();
//
- ImportMode importMode;
- if (config.getImportMode() != null)
- {
- importMode = ImportMode.valueOf(config.getImportMode().trim().toUpperCase());
- }
- else
- {
- importMode = owner_.getDefaultImportMode();
- }
+ ImportMode importMode = getRightMode(config.getImportMode());
//
Locale locale;
@@ -885,4 +883,24 @@
page.setOwnerId(fixOwnerName(page.getOwnerType(), page.getOwnerId()));
fixOwnerName((Container)page);
}
+
+ private ImportMode getRightMode(String mode)
+ {
+ ImportMode importMode;
+ if (mode != null)
+ {
+ importMode = ImportMode.valueOf(mode.trim().toUpperCase());
+ }
+ else
+ {
+ importMode = owner_.getDefaultImportMode();
+ }
+
+ if (isFirstStartup && (importMode == ImportMode.CONSERVE || importMode ==
ImportMode.INSERT))
+ {
+ return ImportMode.MERGE;
+ }
+
+ return importMode;
+ }
}
Modified:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/importer/Imported.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/importer/Imported.java 2011-10-03
22:45:45 UTC (rev 7635)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/importer/Imported.java 2011-10-03
23:16:27 UTC (rev 7636)
@@ -32,7 +32,47 @@
@MixinType(name = "gtn:imported")
public abstract class Imported
{
+ public enum Status {
+ UNKNOWN(-1),
+
+ FAILED(0),
+
+ DONE(1),
+
+ WANT_REIMPORT(2);
+
+ private final int status;
+
+ Status(int status)
+ {
+ this.status = status;
+ }
+
+ public int status()
+ {
+ return this.status;
+ }
+
+ public static Status getStatus(int status)
+ {
+ for (Status type : Status.values())
+ {
+ if (type.status() == status)
+ {
+ return type;
+ }
+ }
+
+ return UNKNOWN;
+ }
+ }
+
+ @Property(name = "gtn:status")
+ public abstract int getStatus();
+
+ public abstract void setStatus(int status);
+
@Property(name = "gtn:creationdate")
public abstract Date getCreationDate();
Modified:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/importer/NavigationImporter.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/importer/NavigationImporter.java 2011-10-03
22:45:45 UTC (rev 7635)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/importer/NavigationImporter.java 2011-10-03
23:16:27 UTC (rev 7636)
@@ -53,7 +53,7 @@
/** . */
private final DescriptionService descriptionService;
-
+
public NavigationImporter(
Locale portalLocale,
ImportMode mode,
Added:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/AbstractDataImportTest.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/AbstractDataImportTest.java
(rev 0)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/AbstractDataImportTest.java 2011-10-03
23:16:27 UTC (rev 7636)
@@ -0,0 +1,273 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * 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.exoplatform.portal.config;
+
+import org.exoplatform.component.test.AbstractGateInTest;
+import org.exoplatform.component.test.ContainerScope;
+import org.exoplatform.component.test.KernelBootstrap;
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.container.component.RequestLifeCycle;
+import org.exoplatform.portal.mop.importer.ImportMode;
+import org.exoplatform.portal.mop.importer.Imported;
+import org.exoplatform.portal.mop.importer.Imported.Status;
+import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.gatein.mop.api.workspace.Workspace;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author <a href="trongtt(a)gmail.com">Trong Tran</a>
+ * @version $Revision$
+ */
+public abstract class AbstractDataImportTest extends AbstractGateInTest
+{
+ private Set<String> clearProperties = new HashSet<String>();
+
+ protected abstract ImportMode getMode();
+
+ protected abstract String getConfig2();
+
+ protected abstract String getConfig1();
+
+ protected abstract void afterOneBootWithExtention(PortalContainer container) throws
Exception;
+
+ protected abstract void afterFirstBoot(PortalContainer container) throws Exception;
+
+ protected abstract void afterSecondBoot(PortalContainer container) throws Exception;
+
+ protected abstract void afterSecondBootWithOverride(PortalContainer container) throws
Exception;
+
+ protected abstract void afterSecondBootWithWantReimport(PortalContainer container)
throws Exception;
+
+ protected abstract void afterSecondBootWithNoMixin(PortalContainer container) throws
Exception;
+
+ protected void setSystemProperty(String key, String value)
+ {
+ clearProperties.add(key);
+ System.setProperty(key, value);
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ for (String key : clearProperties)
+ {
+ System.clearProperty(key);
+ }
+ clearProperties.clear();
+ }
+
+ public void testOneBootWithExtension() throws Exception
+ {
+ KernelBootstrap bootstrap = new KernelBootstrap();
+ bootstrap.addConfiguration(ContainerScope.PORTAL,
"conf/exo.portal.component.test.jcr-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL,
"conf/exo.portal.component.identity-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL,
"conf/exo.portal.component.portal-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL,
"org/exoplatform/portal/config/TestImport1-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL,
"org/exoplatform/portal/config/TestImport2-configuration.xml");
+
+ //
+ setSystemProperty("override.1", "false");
+ setSystemProperty("import.mode.1", getMode().toString());
+ setSystemProperty("import.portal.1", getConfig1());
+ setSystemProperty("override_2", "false");
+ setSystemProperty("import.mode_2", getMode().toString());
+ setSystemProperty("import.portal_2", getConfig2());
+
+ //
+ bootstrap.boot();
+ PortalContainer container = bootstrap.getContainer();
+ afterOneBootWithExtention(container);
+ bootstrap.dispose();
+ }
+
+ public void testOneBoot() throws Exception
+ {
+ KernelBootstrap bootstrap = new KernelBootstrap();
+ bootstrap.addConfiguration(ContainerScope.PORTAL,
"conf/exo.portal.component.test.jcr-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL,
"conf/exo.portal.component.identity-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL,
"conf/exo.portal.component.portal-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL,
"org/exoplatform/portal/config/TestImport1-configuration.xml");
+
+ //
+ setSystemProperty("override.1", "false");
+ setSystemProperty("import.mode.1", getMode().toString());
+ setSystemProperty("import.portal.1", getConfig1());
+
+ //
+ bootstrap.boot();
+ PortalContainer container = bootstrap.getContainer();
+ afterFirstBoot(container);
+ bootstrap.dispose();
+ }
+
+ public void testTwoBoots() throws Exception
+ {
+ KernelBootstrap bootstrap = new KernelBootstrap();
+ bootstrap.addConfiguration(ContainerScope.PORTAL,
"conf/exo.portal.component.test.jcr-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL,
"conf/exo.portal.component.identity-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL,
"conf/exo.portal.component.portal-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL,
"org/exoplatform/portal/config/TestImport1-configuration.xml");
+
+ //
+ setSystemProperty("override.1", "false");
+ setSystemProperty("import.mode.1", getMode().toString());
+ setSystemProperty("import.portal.1", getConfig1());
+
+ bootstrap.boot();
+ PortalContainer container = bootstrap.getContainer();
+ afterFirstBoot(container);
+ bootstrap.dispose();
+
+ //
+ setSystemProperty("import.portal.1", getConfig2());
+
+ bootstrap.boot();
+ container = bootstrap.getContainer();
+ afterSecondBoot(container);
+ bootstrap.dispose();
+ }
+
+ public void testTwoBootsWithOverride() throws Exception
+ {
+ KernelBootstrap bootstrap = new KernelBootstrap();
+ bootstrap.addConfiguration(ContainerScope.PORTAL,
"conf/exo.portal.component.test.jcr-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL,
"conf/exo.portal.component.identity-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL,
"conf/exo.portal.component.portal-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL,
"org/exoplatform/portal/config/TestImport1-configuration.xml");
+
+ //
+ setSystemProperty("override.1", "true");
+ setSystemProperty("import.mode.1", getMode().toString());
+ setSystemProperty("import.portal.1", getConfig1());
+
+ bootstrap.boot();
+ PortalContainer container = bootstrap.getContainer();
+ afterFirstBoot(container);
+ bootstrap.dispose();
+
+ //
+ setSystemProperty("import.portal.1", getConfig2());
+
+ bootstrap.boot();
+ container = bootstrap.getContainer();
+ afterSecondBootWithOverride(container);
+ bootstrap.dispose();
+ }
+
+ public void testTwoBootsWithWantReimport() throws Exception
+ {
+ KernelBootstrap bootstrap = new KernelBootstrap();
+ bootstrap.addConfiguration(ContainerScope.PORTAL,
"conf/exo.portal.component.test.jcr-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL,
"conf/exo.portal.component.identity-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL,
"conf/exo.portal.component.portal-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL,
"org/exoplatform/portal/config/TestImport1-configuration.xml");
+
+ //
+ setSystemProperty("override.1", "false");
+ setSystemProperty("import.mode.1", getMode().toString());
+ setSystemProperty("import.portal.1", getConfig1());
+
+ bootstrap.boot();
+ PortalContainer container = bootstrap.getContainer();
+ afterFirstBoot(container);
+
+ RequestLifeCycle.begin(container);
+ POMSessionManager mgr =
(POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+ Workspace workspace = mgr.getSession().getWorkspace();
+ assertTrue(workspace.isAdapted(Imported.class));
+ workspace.adapt(Imported.class).setStatus(Status.WANT_REIMPORT.status());
+ long creationTime1 = workspace.adapt(Imported.class).getCreationDate().getTime();
+ long lastModificationTime1 =
workspace.adapt(Imported.class).getLastModificationDate().getTime();
+ mgr.getSession().save();
+ RequestLifeCycle.end();
+
+ bootstrap.dispose();
+
+ //
+ setSystemProperty("import.portal.1", getConfig2());
+
+ bootstrap.boot();
+ container = bootstrap.getContainer();
+ afterSecondBootWithWantReimport(container);
+
+ RequestLifeCycle.begin(container);
+ mgr =
(POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+ workspace = mgr.getSession().getWorkspace();
+ assertTrue(workspace.isAdapted(Imported.class));
+ long creationTime2 = workspace.adapt(Imported.class).getCreationDate().getTime();
+ assertEquals(creationTime1, creationTime2);
+ long lastModificationTime2 =
workspace.adapt(Imported.class).getLastModificationDate().getTime();
+ assertTrue(lastModificationTime2 > lastModificationTime1);
+ mgr.getSession().save();
+ RequestLifeCycle.end();
+ bootstrap.dispose();
+ }
+
+ public void testTwoBootsWithNoMixin() throws Exception
+ {
+ KernelBootstrap bootstrap = new KernelBootstrap();
+ bootstrap.addConfiguration(ContainerScope.PORTAL,
"conf/exo.portal.component.test.jcr-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL,
"conf/exo.portal.component.identity-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL,
"conf/exo.portal.component.portal-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL,
"org/exoplatform/portal/config/TestImport1-configuration.xml");
+
+ //
+ setSystemProperty("override.1", "false");
+ setSystemProperty("import.mode.1", getMode().toString());
+ setSystemProperty("import.portal.1", getConfig1());
+
+ bootstrap.boot();
+ PortalContainer container = bootstrap.getContainer();
+ afterFirstBoot(container);
+
+ RequestLifeCycle.begin(container);
+ POMSessionManager mgr =
(POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+ Workspace workspace = mgr.getSession().getWorkspace();
+ assertTrue(workspace.isAdapted(Imported.class));
+ Imported imported = workspace.adapt(Imported.class);
+ long creationTime1 = imported.getCreationDate().getTime();
+ workspace.removeAdapter(Imported.class);
+ mgr.getSession().save();
+ RequestLifeCycle.end();
+
+ bootstrap.dispose();
+
+ //
+ setSystemProperty("import.portal.1", getConfig2());
+
+ bootstrap.boot();
+ container = bootstrap.getContainer();
+ afterSecondBootWithNoMixin(container);
+
+ RequestLifeCycle.begin(container);
+ mgr =
(POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+ workspace = mgr.getSession().getWorkspace();
+ assertTrue(workspace.isAdapted(Imported.class));
+ imported = workspace.adapt(Imported.class);
+ long creationTime2 = imported.getCreationDate().getTime();
+ assertTrue(creationTime2 > creationTime1);
+ mgr.getSession().save();
+ RequestLifeCycle.end();
+ bootstrap.dispose();
+ }
+}
Modified:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportFragmentTest.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportFragmentTest.java 2011-10-03
22:45:45 UTC (rev 7635)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportFragmentTest.java 2011-10-03
23:16:27 UTC (rev 7636)
@@ -62,12 +62,6 @@
}
@Override
- protected final void afterOnePhaseBoot(NodeContext<?> root)
- {
- assertState(root);
- }
-
- @Override
protected final void afterTwoPhaseOverrideReboot(NodeContext<?> root)
{
assertState(root);
Modified:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportNavigationTest.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportNavigationTest.java 2011-10-03
22:45:45 UTC (rev 7635)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportNavigationTest.java 2011-10-03
23:16:27 UTC (rev 7636)
@@ -39,39 +39,11 @@
return "navigation2";
}
- protected abstract void assertState(NodeContext<?> root);
-
@Override
- protected final void afterTwoPhasesBoot(NodeContext<?> root)
- {
- assertEquals(2, root.getNodeCount());
- assertNotNull(root.get("foo"));
- assertNotNull(root.get("daa"));
- }
-
- @Override
protected final void afterTwoPhaseNoOverrideReboot(NodeContext<?> root)
{
assertEquals(2, root.getNodeCount());
assertNotNull(root.get("foo"));
assertNotNull(root.get("daa"));
}
-
- @Override
- protected final void afterOnePhaseBoot(NodeContext<?> root)
- {
- assertState(root);
- }
-
- @Override
- protected final void afterTwoPhaseOverrideReboot(NodeContext<?> root)
- {
- assertState(root);
- }
-
- @Override
- protected final void afterTwoPhaseNoOverrideReconfigure(NodeContext<?> root)
- {
- assertState(root);
- }
}
Modified:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportTest.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportTest.java 2011-10-03
22:45:45 UTC (rev 7635)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportTest.java 2011-10-03
23:16:27 UTC (rev 7636)
@@ -27,6 +27,7 @@
import org.exoplatform.portal.mop.SiteKey;
import org.exoplatform.portal.mop.importer.ImportMode;
import org.exoplatform.portal.mop.importer.Imported;
+import org.exoplatform.portal.mop.importer.Imported.Status;
import org.exoplatform.portal.mop.navigation.NavigationContext;
import org.exoplatform.portal.mop.navigation.NavigationService;
import org.exoplatform.portal.mop.navigation.Node;
@@ -160,8 +161,7 @@
afterTwoPhaseNoOverrideReboot(root);
Workspace workspace = mgr.getSession().getWorkspace();
assertTrue(workspace.isAdapted(Imported.class));
- workspace.removeAdapter(Imported.class);
- assertFalse(workspace.isAdapted(Imported.class));
+ workspace.adapt(Imported.class).setStatus(Status.WANT_REIMPORT.status());
mgr.getSession().save();
RequestLifeCycle.end();
bootstrap.dispose();
Added:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/AbstractSiteDataImportTest.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/AbstractSiteDataImportTest.java
(rev 0)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/AbstractSiteDataImportTest.java 2011-10-03
23:16:27 UTC (rev 7636)
@@ -0,0 +1,122 @@
+package org.exoplatform.portal.config;
+
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.container.component.RequestLifeCycle;
+import org.exoplatform.portal.config.model.Application;
+import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.importer.Imported;
+import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
+import org.gatein.mop.api.workspace.Workspace;
+
+/**
+ * @author <a href="trongtt(a)gmail.com">Trong Tran</a>
+ * @version $Revision$
+ */
+public abstract class AbstractSiteDataImportTest extends AbstractDataImportTest
+{
+
+ @Override
+ protected final String getConfig1()
+ {
+ return "site1";
+ }
+
+ @Override
+ protected final String getConfig2()
+ {
+ return "site2";
+ }
+
+ @Override
+ protected final void afterOneBootWithExtention(PortalContainer container) throws
Exception
+ {
+ RequestLifeCycle.begin(container);
+
+ POMSessionManager mgr =
(POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+ Workspace workspace = mgr.getSession().getWorkspace();
+ assertTrue(workspace.isAdapted(Imported.class));
+
+ //
+ DataStorage dataStorage =
(DataStorage)container.getComponentInstanceOfType(DataStorage.class);
+ PortalConfig portal = dataStorage.getPortalConfig("classic");
+ Container layout = portal.getPortalLayout();
+ assertEquals(1, layout.getChildren().size());
+ Application<Portlet> layoutPortlet =
(Application<Portlet>)layout.getChildren().get(0);
+ assertEquals("site2/layout",
dataStorage.getId(layoutPortlet.getState()));
+
+ //
+ Page home = dataStorage.getPage("portal::classic::home");
+ assertNotNull(home);
+ assertEquals("site 1", home.getTitle());
+
+ Page page1 = dataStorage.getPage("portal::classic::page1");
+ assertNotNull(page1);
+ assertEquals("site 2", page1.getTitle());
+
+ Page page2 = dataStorage.getPage("portal::classic::page2");
+ assertNotNull(page2);
+ assertEquals("site 2", page2.getTitle());
+
+ Page dashboard1 = dataStorage.getPage("user::root::dashboard1");
+ assertNotNull(dashboard1);
+ assertEquals("site 2", dashboard1.getTitle());
+
+ RequestLifeCycle.end();
+ }
+
+ @Override
+ protected final void afterFirstBoot(PortalContainer container) throws Exception
+ {
+ RequestLifeCycle.begin(container);
+
+ POMSessionManager mgr =
(POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+ Workspace workspace = mgr.getSession().getWorkspace();
+ assertTrue(workspace.isAdapted(Imported.class));
+
+ //
+ DataStorage dataStorage =
(DataStorage)container.getComponentInstanceOfType(DataStorage.class);
+ PortalConfig portal = dataStorage.getPortalConfig("classic");
+ Container layout = portal.getPortalLayout();
+ assertEquals(1, layout.getChildren().size());
+ Application<Portlet> layoutPortlet =
(Application<Portlet>)layout.getChildren().get(0);
+ assertEquals("site1/layout",
dataStorage.getId(layoutPortlet.getState()));
+
+ //
+ Page home = dataStorage.getPage("portal::classic::home");
+ assertNotNull(home);
+ assertEquals("site 1", home.getTitle());
+
+ Page page1 = dataStorage.getPage("portal::classic::page1");
+ assertNotNull(page1);
+ assertEquals("site 1", page1.getTitle());
+
+ Page page2 = dataStorage.getPage("portal::classic::page2");
+ assertNull(page2);
+
+ Page dashboard1 = dataStorage.getPage("user::root::dashboard1");
+ assertNull(dashboard1);
+
+ RequestLifeCycle.end();
+ }
+
+ @Override
+ protected final void afterSecondBoot(PortalContainer container) throws Exception
+ {
+ afterFirstBoot(container);
+ }
+
+ @Override
+ protected void afterSecondBootWithWantReimport(PortalContainer container) throws
Exception
+ {
+ afterSecondBootWithOverride(container);
+ }
+
+ @Override
+ protected final void afterSecondBootWithNoMixin(PortalContainer container) throws
Exception
+ {
+ afterSecondBoot(container);
+ }
+}
Deleted:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImport.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImport.java 2011-10-03
22:45:45 UTC (rev 7635)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImport.java 2011-10-03
23:16:27 UTC (rev 7636)
@@ -1,174 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * 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.exoplatform.portal.config;
-
-import org.exoplatform.component.test.AbstractGateInTest;
-import org.exoplatform.component.test.ContainerScope;
-import org.exoplatform.component.test.KernelBootstrap;
-import org.exoplatform.container.PortalContainer;
-import org.exoplatform.container.component.RequestLifeCycle;
-import org.exoplatform.portal.config.model.Application;
-import org.exoplatform.portal.config.model.ApplicationState;
-import org.exoplatform.portal.config.model.Container;
-import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.mop.importer.Imported;
-import org.exoplatform.portal.mop.navigation.NavigationContext;
-import org.exoplatform.portal.mop.navigation.NavigationService;
-import org.exoplatform.portal.mop.navigation.Node;
-import org.exoplatform.portal.mop.navigation.NodeContext;
-import org.exoplatform.portal.mop.navigation.Scope;
-import org.exoplatform.portal.pom.config.POMSessionManager;
-import org.exoplatform.portal.pom.spi.portlet.Portlet;
-import org.gatein.mop.api.workspace.Workspace;
-
-import java.io.File;
-import java.util.Collection;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
- */
-public class TestImport extends AbstractGateInTest
-{
-
- public void testMixin() throws Exception
- {
- KernelBootstrap bootstrap = new KernelBootstrap();
- bootstrap.addConfiguration(ContainerScope.PORTAL,
"conf/exo.portal.component.test.jcr-configuration.xml");
- bootstrap.addConfiguration(ContainerScope.PORTAL,
"conf/exo.portal.component.identity-configuration.xml");
- bootstrap.addConfiguration(ContainerScope.PORTAL,
"conf/exo.portal.component.portal-configuration.xml");
- bootstrap.addConfiguration(ContainerScope.PORTAL,
"org/exoplatform/portal/config/TestImport1-configuration.xml");
-
- //
- System.setProperty("override.1", "false");
- System.setProperty("import.mode.1", "conserve");
- System.setProperty("import.portal.1", "navigation1");
-
- //
- bootstrap.boot();
- PortalContainer container = bootstrap.getContainer();
- POMSessionManager mgr =
(POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
-
- //
- RequestLifeCycle.begin(container);
- Workspace workspace = mgr.getSession().getWorkspace();
- assertTrue(workspace.isAdapted(Imported.class));
- RequestLifeCycle.end();
- bootstrap.dispose();
- }
-
- public void testDefaultMode() throws Exception
- {
- KernelBootstrap bootstrap = new KernelBootstrap();
- bootstrap.addConfiguration(ContainerScope.PORTAL,
"conf/exo.portal.component.test.jcr-configuration.xml");
- bootstrap.addConfiguration(ContainerScope.PORTAL,
"conf/exo.portal.component.identity-configuration.xml");
- bootstrap.addConfiguration(ContainerScope.PORTAL,
"conf/exo.portal.component.portal-configuration.xml");
- bootstrap.addConfiguration(ContainerScope.PORTAL,
"org/exoplatform/portal/config/TestImport0-configuration.xml");
- bootstrap.addConfiguration(ContainerScope.PORTAL,
"org/exoplatform/portal/config/TestImport1-configuration.xml");
- System.setProperty("import.portal.0", "navigation2");
- System.setProperty("override.1", "false");
- System.setProperty("import.mode.1", "merge");
- System.setProperty("import.portal.1", "navigation1");
-
- //
- bootstrap.boot();
-
- //
- PortalContainer container = bootstrap.getContainer();
- NavigationService service =
(NavigationService)container.getComponentInstanceOfType(NavigationService.class);
- RequestLifeCycle.begin(container);
- NavigationContext nav =
service.loadNavigation(SiteKey.portal("classic"));
- NodeContext<Node> root = service.loadNode(Node.MODEL, nav, Scope.ALL, null);
- Collection<Node> c = root.getNodes();
- assertEquals(3, c.size());
- assertNotNull(root.get("foo"));
- assertNotNull(root.get("daa"));
- assertNotNull(root.get("bar"));
- RequestLifeCycle.end();
- bootstrap.dispose();
- }
-
- public void testNoMixin() throws Exception
- {
- KernelBootstrap bootstrap = new KernelBootstrap();
- bootstrap.addConfiguration(ContainerScope.PORTAL,
"conf/exo.portal.component.test.jcr-configuration.xml");
- bootstrap.addConfiguration(ContainerScope.PORTAL,
"conf/exo.portal.component.identity-configuration.xml");
- bootstrap.addConfiguration(ContainerScope.PORTAL,
"conf/exo.portal.component.portal-configuration.xml");
- bootstrap.addConfiguration(ContainerScope.PORTAL,
"org/exoplatform/portal/config/TestImport1-configuration.xml");
-
- //
- System.setProperty("override.1", "false");
- System.setProperty("import.mode.1", "conserve");
- System.setProperty("import.portal.1", "site1");
-
- //
- bootstrap.boot();
- PortalContainer container = bootstrap.getContainer();
- DataStorage service =
(DataStorage)container.getComponentInstanceOfType(DataStorage.class);
- RequestLifeCycle.begin(container);
- POMSessionManager mgr =
(POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
- Workspace workspace = mgr.getSession().getWorkspace();
- assertTrue(workspace.isAdapted(Imported.class));
- long when1 = workspace.adapt(Imported.class).getCreationDate().getTime();
- PortalConfig portal = service.getPortalConfig("classic");
- Container layout = portal.getPortalLayout();
- assertEquals(1, layout.getChildren().size());
- Application<Portlet> layoutPortlet =
(Application<Portlet>)layout.getChildren().get(0);
- assertEquals("site1/layout", service.getId(layoutPortlet.getState()));
- Page page1 = service.getPage("portal::classic::page1");
- assertEquals(1, page1.getChildren().size());
- Application<Portlet> page1Portlet =
(Application<Portlet>)page1.getChildren().get(0);
- assertEquals("site1/page1", service.getId(page1Portlet.getState()));
- workspace.removeAdapter(Imported.class);
- mgr.getSession().save();
- RequestLifeCycle.end();
- bootstrap.dispose();
-
- //
- System.setProperty("override.1", "false");
- System.setProperty("import.mode.1", "conserve");
- System.setProperty("import.portal.1", "site2");
-
- //
- bootstrap.boot();
- container = bootstrap.getContainer();
- service = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
- RequestLifeCycle.begin(container);
- mgr =
(POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
- workspace = mgr.getSession().getWorkspace();
- assertTrue(workspace.isAdapted(Imported.class));
- long when2 = workspace.adapt(Imported.class).getCreationDate().getTime();
- assertTrue(when2 > when1);
- portal = service.getPortalConfig("classic");
- layout = portal.getPortalLayout();
- assertEquals(1, layout.getChildren().size());
- layoutPortlet = (Application<Portlet>)layout.getChildren().get(0);
- assertEquals("site1/layout", service.getId(layoutPortlet.getState()));
- page1 = service.getPage("portal::classic::page1");
- assertEquals(1, page1.getChildren().size());
- page1Portlet = (Application<Portlet>)page1.getChildren().get(0);
- assertEquals("site1/page1", service.getId(page1Portlet.getState()));
- Page page2 = service.getPage("portal::classic::page2");
- assertNull(page2);
- RequestLifeCycle.end();
- bootstrap.dispose();
- }
-}
Modified:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImportFragmentConserve.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImportFragmentConserve.java 2011-10-03
22:45:45 UTC (rev 7635)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImportFragmentConserve.java 2011-10-03
23:16:27 UTC (rev 7636)
@@ -35,6 +35,16 @@
}
@Override
+ protected final void afterOnePhaseBoot(NodeContext<?> root)
+ {
+ assertEquals(1, root.getNodeSize());
+ NodeContext<?> foo = root.get("foo");
+ assertNotNull(foo);
+ assertEquals("foo_icon", foo.getState().getIcon());
+ assertEquals(1, foo.getNodeSize());
+ }
+
+ @Override
protected void assertState(NodeContext<?> root)
{
assertEquals(1, root.getNodeSize());
Modified:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImportFragmentInsert.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImportFragmentInsert.java 2011-10-03
22:45:45 UTC (rev 7635)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImportFragmentInsert.java 2011-10-03
23:16:27 UTC (rev 7636)
@@ -35,6 +35,12 @@
}
@Override
+ protected final void afterOnePhaseBoot(NodeContext<?> root)
+ {
+ assertState(root);
+ }
+
+ @Override
protected void assertState(NodeContext<?> root)
{
assertEquals(1, root.getNodeSize());
Modified:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImportFragmentOverwrite.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImportFragmentOverwrite.java 2011-10-03
22:45:45 UTC (rev 7635)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImportFragmentOverwrite.java 2011-10-03
23:16:27 UTC (rev 7636)
@@ -35,6 +35,12 @@
}
@Override
+ protected final void afterOnePhaseBoot(NodeContext<?> root)
+ {
+ assertState(root);
+ }
+
+ @Override
protected void assertState(NodeContext<?> root)
{
assertEquals(1, root.getNodeSize());
Modified:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationConserve.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationConserve.java 2011-10-03
22:45:45 UTC (rev 7635)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationConserve.java 2011-10-03
23:16:27 UTC (rev 7636)
@@ -33,8 +33,49 @@
{
return ImportMode.CONSERVE;
}
+
+ @Override
+ protected final void afterOnePhaseBoot(NodeContext<?> root)
+ {
+ assertEquals(3, root.getNodeCount());
+ NodeContext<?> foo = root.get("foo");
+ assertNotNull(foo);
+ assertEquals("foo_icon_2", foo.getState().getIcon());
+ assertEquals(1, foo.getNodeCount());
+ NodeContext<?> juu = foo.get("juu");
+ assertNotNull(juu);
+ assertEquals("juu_icon", juu.getState().getIcon());
+ assertEquals(0, juu.getNodeCount());
+ NodeContext<?> bar = root.get("bar");
+ assertNotNull(bar);
+ assertEquals("bar_icon", bar.getState().getIcon());
+ assertEquals(0, bar.getNodeCount());
+ NodeContext<?> daa = root.get("daa");
+ assertNotNull(daa);
+ assertEquals("daa_icon", daa.getState().getIcon());
+ assertEquals(0, daa.getNodeCount());
+ }
@Override
+ protected final void afterTwoPhasesBoot(NodeContext<?> root)
+ {
+ assertEquals(2, root.getNodeCount());
+ assertNotNull(root.get("foo"));
+ assertNotNull(root.get("daa"));
+ }
+
+ @Override
+ protected final void afterTwoPhaseOverrideReboot(NodeContext<?> root)
+ {
+ assertState(root);
+ }
+
+ @Override
+ protected final void afterTwoPhaseNoOverrideReconfigure(NodeContext<?> root)
+ {
+ assertState(root);
+ }
+
protected void assertState(NodeContext<?> root)
{
assertEquals(2, root.getNodeCount());
Modified:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationInsert.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationInsert.java 2011-10-03
22:45:45 UTC (rev 7635)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationInsert.java 2011-10-03
23:16:27 UTC (rev 7636)
@@ -33,8 +33,49 @@
{
return ImportMode.INSERT;
}
+
+ @Override
+ protected final void afterOnePhaseBoot(NodeContext<?> root)
+ {
+ assertEquals(3, root.getNodeCount());
+ NodeContext<?> foo = root.get("foo");
+ assertNotNull(foo);
+ assertEquals("foo_icon_2", foo.getState().getIcon());
+ assertEquals(1, foo.getNodeCount());
+ NodeContext<?> juu = foo.get("juu");
+ assertNotNull(juu);
+ assertEquals("juu_icon", juu.getState().getIcon());
+ assertEquals(0, juu.getNodeCount());
+ NodeContext<?> bar = root.get("bar");
+ assertNotNull(bar);
+ assertEquals("bar_icon", bar.getState().getIcon());
+ assertEquals(0, bar.getNodeCount());
+ NodeContext<?> daa = root.get("daa");
+ assertNotNull(daa);
+ assertEquals("daa_icon", daa.getState().getIcon());
+ assertEquals(0, daa.getNodeCount());
+ }
@Override
+ protected final void afterTwoPhasesBoot(NodeContext<?> root)
+ {
+ assertEquals(2, root.getNodeCount());
+ assertNotNull(root.get("foo"));
+ assertNotNull(root.get("daa"));
+ }
+
+ @Override
+ protected final void afterTwoPhaseOverrideReboot(NodeContext<?> root)
+ {
+ assertState(root);
+ }
+
+ @Override
+ protected final void afterTwoPhaseNoOverrideReconfigure(NodeContext<?> root)
+ {
+ assertState(root);
+ }
+
protected void assertState(NodeContext<?> root)
{
assertEquals(3, root.getNodeCount());
Modified:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationMerge.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationMerge.java 2011-10-03
22:45:45 UTC (rev 7635)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationMerge.java 2011-10-03
23:16:27 UTC (rev 7636)
@@ -33,8 +33,33 @@
{
return ImportMode.MERGE;
}
+
+ @Override
+ protected final void afterOnePhaseBoot(NodeContext<?> root)
+ {
+ assertState(root);
+ }
@Override
+ protected final void afterTwoPhasesBoot(NodeContext<?> root)
+ {
+ assertEquals(2, root.getNodeCount());
+ assertNotNull(root.get("foo"));
+ assertNotNull(root.get("daa"));
+ }
+
+ @Override
+ protected final void afterTwoPhaseOverrideReboot(NodeContext<?> root)
+ {
+ assertState(root);
+ }
+
+ @Override
+ protected final void afterTwoPhaseNoOverrideReconfigure(NodeContext<?> root)
+ {
+ assertState(root);
+ }
+
protected void assertState(NodeContext<?> root)
{
assertEquals(3, root.getNodeCount());
Modified:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationOverwrite.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationOverwrite.java 2011-10-03
22:45:45 UTC (rev 7635)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationOverwrite.java 2011-10-03
23:16:27 UTC (rev 7636)
@@ -33,8 +33,39 @@
{
return ImportMode.OVERWRITE;
}
+
+ @Override
+ protected final void afterOnePhaseBoot(NodeContext<?> root)
+ {
+ assertState(root);
+ }
@Override
+ protected final void afterTwoPhasesBoot(NodeContext<?> root)
+ {
+ assertEquals(2, root.getNodeCount());
+ NodeContext<?> foo = root.get("foo");
+ assertNotNull(foo);
+ assertEquals("foo_icon_1", foo.getState().getIcon());
+ assertEquals(1, foo.getNodeCount());
+ NodeContext<?> bar = root.get("daa");
+ assertNotNull(bar);
+ assertEquals("daa_icon", bar.getState().getIcon());
+ assertEquals(0, bar.getNodeCount());
+ }
+
+ @Override
+ protected final void afterTwoPhaseOverrideReboot(NodeContext<?> root)
+ {
+ assertState(root);
+ }
+
+ @Override
+ protected final void afterTwoPhaseNoOverrideReconfigure(NodeContext<?> root)
+ {
+ assertState(root);
+ }
+
protected void assertState(NodeContext<?> root)
{
assertEquals(2, root.getNodeCount());
Added:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportConserve.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportConserve.java
(rev 0)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportConserve.java 2011-10-03
23:16:27 UTC (rev 7636)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * 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.exoplatform.portal.config;
+
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.portal.mop.importer.ImportMode;
+
+/**
+ * @author <a href="trongtt(a)gmail.com">Trong Tran</a>
+ * @version $Revision$
+ */
+public class TestSiteDataImportConserve extends AbstractSiteDataImportTest
+{
+
+ @Override
+ protected ImportMode getMode()
+ {
+ return ImportMode.CONSERVE;
+ }
+
+ @Override
+ protected void afterSecondBootWithOverride(PortalContainer container) throws
Exception
+ {
+ afterSecondBoot(container);
+ }
+}
Added:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportInsert.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportInsert.java
(rev 0)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportInsert.java 2011-10-03
23:16:27 UTC (rev 7636)
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * 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.exoplatform.portal.config;
+
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.container.component.RequestLifeCycle;
+import org.exoplatform.portal.config.model.Application;
+import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.importer.ImportMode;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
+
+/**
+ * @author <a href="trongtt(a)gmail.com">Trong Tran</a>
+ * @version $Revision$
+ */
+public class TestSiteDataImportInsert extends AbstractSiteDataImportTest
+{
+
+ @Override
+ protected ImportMode getMode()
+ {
+ return ImportMode.INSERT;
+ }
+
+ @Override
+ protected void afterSecondBootWithOverride(PortalContainer container) throws
Exception
+ {
+ //
+ RequestLifeCycle.begin(container);
+
+ DataStorage dataStorage =
(DataStorage)container.getComponentInstanceOfType(DataStorage.class);
+ PortalConfig portal = dataStorage.getPortalConfig("classic");
+ Container layout = portal.getPortalLayout();
+ assertEquals(1, layout.getChildren().size());
+ Application<Portlet> layoutPortlet =
(Application<Portlet>)layout.getChildren().get(0);
+ assertEquals("site1/layout",
dataStorage.getId(layoutPortlet.getState()));
+
+ //
+ Page home = dataStorage.getPage("portal::classic::home");
+ assertNotNull(home);
+ assertEquals("site 1", home.getTitle());
+
+ Page page1 = dataStorage.getPage("portal::classic::page1");
+ assertNotNull(page1);
+ assertEquals("site 1", page1.getTitle());
+
+ Page page2 = dataStorage.getPage("portal::classic::page2");
+ assertNotNull(page2);
+ assertEquals("site 2", page2.getTitle());
+
+ Page dashboard1 = dataStorage.getPage("user::root::dashboard1");
+ assertNotNull(dashboard1);
+ assertEquals("site 2", dashboard1.getTitle());
+
+ RequestLifeCycle.end();
+ }
+}
Added:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportMerge.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportMerge.java
(rev 0)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportMerge.java 2011-10-03
23:16:27 UTC (rev 7636)
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * 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.exoplatform.portal.config;
+
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.container.component.RequestLifeCycle;
+import org.exoplatform.portal.config.model.Application;
+import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.importer.ImportMode;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
+
+/**
+ * @author <a href="trongtt(a)gmail.com">Trong Tran</a>
+ * @version $Revision$
+ */
+public class TestSiteDataImportMerge extends AbstractSiteDataImportTest
+{
+
+ @Override
+ protected ImportMode getMode()
+ {
+ return ImportMode.MERGE;
+ }
+
+ @Override
+ protected void afterSecondBootWithOverride(PortalContainer container) throws
Exception
+ {
+ RequestLifeCycle.begin(container);
+
+ DataStorage dataStorage =
(DataStorage)container.getComponentInstanceOfType(DataStorage.class);
+
+ PortalConfig portal = dataStorage.getPortalConfig("classic");
+ Container layout = portal.getPortalLayout();
+ assertEquals(1, layout.getChildren().size());
+ Application<Portlet> layoutPortlet =
(Application<Portlet>)layout.getChildren().get(0);
+ assertEquals("site2/layout",
dataStorage.getId(layoutPortlet.getState()));
+
+ //
+ Page home = dataStorage.getPage("portal::classic::home");
+ assertNotNull(home);
+ assertEquals("site 1", home.getTitle());
+
+ Page page1 = dataStorage.getPage("portal::classic::page1");
+ assertNotNull(page1);
+ assertEquals("site 2", page1.getTitle());
+
+ Page page2 = dataStorage.getPage("portal::classic::page2");
+ assertNotNull(page2);
+ assertEquals("site 2", page2.getTitle());
+
+ Page dashboard1 = dataStorage.getPage("user::root::dashboard1");
+ assertNotNull(dashboard1);
+ assertEquals("site 2", dashboard1.getTitle());
+
+ RequestLifeCycle.end();
+ }
+}
Added:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportOverwrite.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportOverwrite.java
(rev 0)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportOverwrite.java 2011-10-03
23:16:27 UTC (rev 7636)
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * 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.exoplatform.portal.config;
+
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.container.component.RequestLifeCycle;
+import org.exoplatform.portal.config.model.Application;
+import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.importer.ImportMode;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
+
+/**
+ * @author <a href="trongtt(a)gmail.com">Trong Tran</a>
+ * @version $Revision$
+ */
+public class TestSiteDataImportOverwrite extends AbstractSiteDataImportTest
+{
+
+ @Override
+ protected ImportMode getMode()
+ {
+ return ImportMode.OVERWRITE;
+ }
+
+ @Override
+ protected void afterSecondBootWithOverride(PortalContainer container) throws
Exception
+ {
+ RequestLifeCycle.begin(container);
+
+ DataStorage dataStorage =
(DataStorage)container.getComponentInstanceOfType(DataStorage.class);
+
+ PortalConfig portal = dataStorage.getPortalConfig("classic");
+ Container layout = portal.getPortalLayout();
+ assertEquals(1, layout.getChildren().size());
+ Application<Portlet> layoutPortlet =
(Application<Portlet>)layout.getChildren().get(0);
+ assertEquals("site2/layout",
dataStorage.getId(layoutPortlet.getState()));
+
+ //
+ Page home = dataStorage.getPage("portal::classic::home");
+ assertNotNull(home);
+ assertEquals("site 1", home.getTitle());
+
+ Page page1 = dataStorage.getPage("portal::classic::page1");
+ assertNotNull(page1);
+ assertEquals("site 2", page1.getTitle());
+
+ Page page2 = dataStorage.getPage("portal::classic::page2");
+ assertNotNull(page2);
+ assertEquals("site 2", page2.getTitle());
+
+ Page dashboard1 = dataStorage.getPage("user::root::dashboard1");
+ assertNotNull(dashboard1);
+ assertEquals("site 2", dashboard1.getTitle());
+
+ RequestLifeCycle.end();
+ }
+}
Modified:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport0-configuration.xml
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport0-configuration.xml 2011-10-03
22:45:45 UTC (rev 7635)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport0-configuration.xml 2011-10-03
23:16:27 UTC (rev 7636)
@@ -28,7 +28,6 @@
<name>new.portal.config.user.listener</name>
<set-method>initListener</set-method>
<type>org.exoplatform.portal.config.NewPortalConfigListener</type>
- <priority>1</priority>
<init-params>
<value-param>
<name>default.portal</name>
Modified:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport1-configuration.xml
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport1-configuration.xml 2011-10-03
22:45:45 UTC (rev 7635)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport1-configuration.xml 2011-10-03
23:16:27 UTC (rev 7636)
@@ -18,48 +18,70 @@
~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-->
-<configuration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd
http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
-
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+<configuration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd
http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
- <external-component-plugins>
-
<target-component>org.exoplatform.portal.config.UserPortalConfigService</target-component>
- <component-plugin>
- <name>new.portal.config.user.listener</name>
- <set-method>initListener</set-method>
- <type>org.exoplatform.portal.config.NewPortalConfigListener</type>
- <init-params>
- <value-param>
- <name>default.portal</name>
- <value>classic</value>
- </value-param>
- <value-param>
- <name>override</name>
- <value>${override.1}</value>
- </value-param>
- <object-param>
- <name>portal.configuration</name>
- <object type="org.exoplatform.portal.config.NewPortalConfig">
- <field name="predefinedOwner">
- <collection type="java.util.HashSet">
- <value>
- <string>classic</string>
- </value>
- </collection>
- </field>
- <field name="ownerType">
- <string>portal</string>
- </field>
- <field name="templateLocation">
-
<string>classpath:/org/exoplatform/portal/config/${import.portal.1}-conf</string>
- </field>
- <field name="importMode">
- <string>${import.mode.1}</string>
- </field>
- </object>
- </object-param>
- </init-params>
- </component-plugin>
- </external-component-plugins>
+ <external-component-plugins>
+
<target-component>org.exoplatform.portal.config.UserPortalConfigService</target-component>
+ <component-plugin>
+ <name>new.portal.config.user.listener</name>
+ <set-method>initListener</set-method>
+ <type>org.exoplatform.portal.config.NewPortalConfigListener</type>
+ <priority>1</priority>
+ <init-params>
+ <value-param>
+ <name>default.portal</name>
+ <value>classic</value>
+ </value-param>
+ <value-param>
+ <name>override</name>
+ <value>${override.1}</value>
+ </value-param>
+ <object-param>
+ <name>portal.configuration</name>
+ <object
type="org.exoplatform.portal.config.NewPortalConfig">
+ <field name="predefinedOwner">
+ <collection type="java.util.HashSet">
+ <value>
+ <string>classic</string>
+ </value>
+ </collection>
+ </field>
+ <field name="ownerType">
+ <string>portal</string>
+ </field>
+ <field name="templateLocation">
+
<string>classpath:/org/exoplatform/portal/config/${import.portal.1}-conf</string>
+ </field>
+ <field name="importMode">
+ <string>${import.mode.1}</string>
+ </field>
+ </object>
+ </object-param>
+ <object-param>
+ <name>user.configuration</name>
+ <description>description</description>
+ <object
type="org.exoplatform.portal.config.NewPortalConfig">
+ <field name="predefinedOwner">
+ <collection type="java.util.HashSet">
+ <value>
+ <string>root</string>
+ </value>
+ </collection>
+ </field>
+ <field name="ownerType">
+ <string>user</string>
+ </field>
+ <field name="templateLocation">
+
<string>classpath:/org/exoplatform/portal/config/${import.portal.1}-conf</string>
+ </field>
+ <field name="importMode">
+ <string>${import.mode.1}</string>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
</configuration>
Modified:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport2-configuration.xml
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport2-configuration.xml 2011-10-03
22:45:45 UTC (rev 7635)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport2-configuration.xml 2011-10-03
23:16:27 UTC (rev 7636)
@@ -22,45 +22,67 @@
xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_2.xsd
http://www.exoplaform.org/xml/ns/kernel_1_2.xsd"
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_2.xsd">
- <external-component-plugins>
-
<target-component>org.exoplatform.portal.config.UserPortalConfigService</target-component>
- <component-plugin>
- <name>new.portal.config.user.listener</name>
- <set-method>initListener</set-method>
- <type>org.exoplatform.portal.config.NewPortalConfigListener</type>
- <priority>1</priority>
- <init-params>
- <value-param>
- <name>default.portal</name>
- <value>classic</value>
- </value-param>
- <value-param>
- <name>override</name>
- <value>${override_2}</value>
- </value-param>
- <object-param>
- <name>portal.configuration</name>
- <object type="org.exoplatform.portal.config.NewPortalConfig">
- <field name="predefinedOwner">
- <collection type="java.util.HashSet">
- <value>
- <string>classic</string>
- </value>
- </collection>
- </field>
- <field name="ownerType">
- <string>portal</string>
- </field>
- <field name="templateLocation">
-
<string>classpath:/org/exoplatform/portal/config/${import.portal_2}-conf</string>
- </field>
- <field name="importMode">
- <string>${import.mode_2}</string>
- </field>
- </object>
- </object-param>
- </init-params>
- </component-plugin>
- </external-component-plugins>
+ <external-component-plugins>
+
<target-component>org.exoplatform.portal.config.UserPortalConfigService</target-component>
+ <component-plugin>
+ <name>new.portal.config.user.listener</name>
+ <set-method>initListener</set-method>
+ <type>org.exoplatform.portal.config.NewPortalConfigListener</type>
+ <priority>2</priority>
+ <init-params>
+ <value-param>
+ <name>default.portal</name>
+ <value>classic</value>
+ </value-param>
+ <value-param>
+ <name>override</name>
+ <value>${override_2}</value>
+ </value-param>
+ <object-param>
+ <name>portal.configuration</name>
+ <object
type="org.exoplatform.portal.config.NewPortalConfig">
+ <field name="predefinedOwner">
+ <collection type="java.util.HashSet">
+ <value>
+ <string>classic</string>
+ </value>
+ </collection>
+ </field>
+ <field name="ownerType">
+ <string>portal</string>
+ </field>
+ <field name="templateLocation">
+
<string>classpath:/org/exoplatform/portal/config/${import.portal_2}-conf</string>
+ </field>
+ <field name="importMode">
+ <string>${import.mode_2}</string>
+ </field>
+ </object>
+ </object-param>
+ <object-param>
+ <name>user.configuration</name>
+ <description>description</description>
+ <object
type="org.exoplatform.portal.config.NewPortalConfig">
+ <field name="predefinedOwner">
+ <collection type="java.util.HashSet">
+ <value>
+ <string>root</string>
+ </value>
+ </collection>
+ </field>
+ <field name="ownerType">
+ <string>user</string>
+ </field>
+ <field name="templateLocation">
+
<string>classpath:/org/exoplatform/portal/config/${import.portal_2}-conf</string>
+ </field>
+ <field name="importMode">
+ <string>${import.mode_2}</string>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
</configuration>
Modified:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/portal/classic/pages.xml
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/portal/classic/pages.xml 2011-10-03
22:45:45 UTC (rev 7635)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/portal/classic/pages.xml 2011-10-03
23:16:27 UTC (rev 7636)
@@ -25,16 +25,30 @@
xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2
http://www.gatein.org/xml/ns/gatein_objects_1_2"
xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2">
- <page>
- <name>page1</name>
- <portlet-application>
- <portlet>
- <application-ref>site1</application-ref>
- <portlet-ref>page1</portlet-ref>
- </portlet>
- <access-permissions>Everyone</access-permissions>
- <show-info-bar>true</show-info-bar>
- </portlet-application>
- </page>
+ <page>
+ <name>home</name>
+ <title>site 1</title>
+ <portlet-application>
+ <portlet>
+ <application-ref>site1</application-ref>
+ <portlet-ref>home</portlet-ref>
+ </portlet>
+ <access-permissions>Everyone</access-permissions>
+ <show-info-bar>true</show-info-bar>
+ </portlet-application>
+ </page>
+
+ <page>
+ <name>page1</name>
+ <title>site 1</title>
+ <portlet-application>
+ <portlet>
+ <application-ref>site1</application-ref>
+ <portlet-ref>page1</portlet-ref>
+ </portlet>
+ <access-permissions>Everyone</access-permissions>
+ <show-info-bar>true</show-info-bar>
+ </portlet-application>
+ </page>
</page-set>
Added:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/user/root/navigation.xml
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/user/root/navigation.xml
(rev 0)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/user/root/navigation.xml 2011-10-03
23:16:27 UTC (rev 7636)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ 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.
+
+-->
+
+<node-navigation
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2
http://www.gatein.org/xml/ns/gatein_objects_1_2"
+
xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2">
+ <priority>3</priority>
+</node-navigation>
Added:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/user/root/pages.xml
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/user/root/pages.xml
(rev 0)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/user/root/pages.xml 2011-10-03
23:16:27 UTC (rev 7636)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ 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.
+
+-->
+
+<page-set
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_0
http://www.gatein.org/xml/ns/gatein_objects_1_0"
+
xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_0">
+ </page-set>
+
Modified:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/portal/classic/pages.xml
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/portal/classic/pages.xml 2011-10-03
22:45:45 UTC (rev 7635)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/portal/classic/pages.xml 2011-10-03
23:16:27 UTC (rev 7636)
@@ -25,28 +25,30 @@
xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2
http://www.gatein.org/xml/ns/gatein_objects_1_2"
xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2">
- <page>
- <name>page1</name>
- <portlet-application>
- <portlet>
- <application-ref>site2</application-ref>
- <portlet-ref>page1</portlet-ref>
- </portlet>
- <access-permissions>Everyone</access-permissions>
- <show-info-bar>true</show-info-bar>
- </portlet-application>
- </page>
-
<page>
- <name>page2</name>
- <portlet-application>
- <portlet>
- <application-ref>site2</application-ref>
- <portlet-ref>page2</portlet-ref>
- </portlet>
- <access-permissions>Everyone</access-permissions>
- <show-info-bar>true</show-info-bar>
+ <name>page1</name>
+ <title>site 2</title>
+ <portlet-application>
+ <portlet>
+ <application-ref>site2</application-ref>
+ <portlet-ref>page1</portlet-ref>
+ </portlet>
+ <access-permissions>Everyone</access-permissions>
+ <show-info-bar>true</show-info-bar>
</portlet-application>
</page>
+ <page>
+ <name>page2</name>
+ <title>site 2</title>
+ <portlet-application>
+ <portlet>
+ <application-ref>site2</application-ref>
+ <portlet-ref>page2</portlet-ref>
+ </portlet>
+ <access-permissions>Everyone</access-permissions>
+ <show-info-bar>true</show-info-bar>
+ </portlet-application>
+ </page>
+
</page-set>
Added:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/user/root/navigation.xml
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/user/root/navigation.xml
(rev 0)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/user/root/navigation.xml 2011-10-03
23:16:27 UTC (rev 7636)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ 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.
+
+-->
+
+<node-navigation
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2
http://www.gatein.org/xml/ns/gatein_objects_1_2"
+
xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2">
+ <priority>3</priority>
+
+ <page-nodes>
+ <node>
+ <name>Default_Tab</name>
+ <icon>Default_Tab_icon</icon>
+ </node>
+ </page-nodes>
+</node-navigation>
Added:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/user/root/pages.xml
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/user/root/pages.xml
(rev 0)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/user/root/pages.xml 2011-10-03
23:16:27 UTC (rev 7636)
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ 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.
+
+-->
+
+<page-set
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_0
http://www.gatein.org/xml/ns/gatein_objects_1_0"
+
xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_0">
+
+ <page>
+ <name>dashboard1</name>
+ <title>site 2</title>
+ <portlet-application>
+ <portlet>
+ <application-ref>site2</application-ref>
+ <portlet-ref>dashboard1</portlet-ref>
+ </portlet>
+ <access-permissions>Everyone</access-permissions>
+ <show-info-bar>true</show-info-bar>
+ </portlet-application>
+ </page>
+</page-set>
+
Modified:
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml 2011-10-03
22:45:45 UTC (rev 7635)
+++
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml 2011-10-03
23:16:27 UTC (rev 7636)
@@ -180,7 +180,6 @@
</field>
<field
name="ownerType"><string>portal</string></field>
<field
name="templateLocation"><string>war:/conf/portal/</string></field>
- <field
name="importMode"><string>conserve</string></field>
</object>
</object-param>
<object-param>
@@ -197,7 +196,6 @@
</field>
<field
name="ownerType"><string>group</string></field>
<field
name="templateLocation"><string>war:/conf/portal</string></field>
- <field
name="importMode"><string>conserve</string></field>
</object>
</object-param>
<object-param>
@@ -211,7 +209,6 @@
</field>
<field
name="ownerType"><string>user</string></field>
<field
name="templateLocation"><string>war:/conf/portal</string></field>
- <field
name="importMode"><string>conserve</string></field>
</object>
</object-param>
</init-params>