Skip to content

Commit

Permalink
LRQA-33560 Manual SF
Browse files Browse the repository at this point in the history
  • Loading branch information
shuyangzhou authored and brianchandotcom committed Apr 5, 2019
1 parent 88ae7fe commit 5367f3a
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 31 deletions.
16 changes: 8 additions & 8 deletions build-test-tck.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@

<fail message="Please set the property ${tck.home}." unless="tck.home" />

<target name="cleanup-tck">
<exec dir="${tck.home}/.." executable="git" failonerror="false">
<arg value="apply" />
<arg value="--reverse" />
<arg value="${project.dir}/tck/pluto-patch.diff" />
</exec>
</target>

<target name="prepare-tck">

<!-- Prepare TCK target is expected by CI. -->
Expand Down Expand Up @@ -174,12 +182,4 @@
</else>
</if>
</target>

<target name="cleanup-tck">
<exec dir="${tck.home}/.." executable="git" failonerror="false">
<arg value="apply" />
<arg value="--reverse" />
<arg value="${project.dir}/tck/pluto-patch.diff" />
</exec>
</target>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,12 @@ protected void activate(ComponentContext componentContext) {
BundleContext bundleContext = componentContext.getBundleContext();

Bundle[] bundles = bundleContext.getBundles();

Setup.setupPortletTCKSite(tckDeployFilesDir, bundles);
_log.info("Portlet TCK Bridge is ready");

if (_log.isInfoEnabled()) {
_log.info("Portlet TCK Bridge is ready");
}
}
catch (Exception e) {
_log.error(e, e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

package com.liferay.portlet.tck.bridge.setup;

import com.liferay.petra.string.CharPool;
import com.liferay.portal.kernel.model.Group;
import com.liferay.portal.kernel.model.GroupConstants;
import com.liferay.portal.kernel.model.Layout;
Expand All @@ -33,11 +34,9 @@ public static Group addActiveOpenGroup(long userId, String name)
boolean active = true;
String friendlyURL =
"/" +
StringUtil.toLowerCase(
name
).replaceAll(
" ", "-"
);
StringUtil.replace(
StringUtil.toLowerCase(name), CharPool.SPACE,
CharPool.DASH);
boolean siteFlag = true;
int type = GroupConstants.TYPE_SITE_OPEN;
boolean manualMembership = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@

import java.io.File;

import java.net.URI;
import java.net.URL;

import java.util.ArrayList;
Expand Down Expand Up @@ -74,8 +75,10 @@ public static void setupPortletTCKSite(

if ("Liferay".equals(company.getName())) {
companyId = id;
userId = company.getDefaultUser(
).getUserId();

User user = company.getDefaultUser();

userId = user.getUserId();
}
}

Expand All @@ -85,10 +88,12 @@ public static void setupPortletTCKSite(

_addAllUsersToSite(groupId);

URL configFileURL = new File(
tckDeployFilesDir + "/pluto-portal-driver-config.xml"
).toURI(
).toURL();
File configFile = new File(
tckDeployFilesDir + "/pluto-portal-driver-config.xml");

URI configFileURI = configFile.toURI();

URL configFileURL = configFileURI.toURL();

if (_log.isDebugEnabled()) {
_log.debug(
Expand Down Expand Up @@ -181,11 +186,10 @@ private static void _addPortlet(
private static Portlet _createPortlet(
Element element, String context, String pageName) {

context = context.replaceFirst(
"^/", ""
).replaceFirst(
"(-[0-9.]+)?(-SNAPSHOT)?$", ""
);
context = context.replaceFirst("^/", "");

context = context.replaceFirst("(-[0-9.]+)?(-SNAPSHOT)?$", "");

Attribute nameAttribute = element.attribute("name");

String portletName = nameAttribute.getValue();
Expand Down Expand Up @@ -224,7 +228,9 @@ private static Layout _getPortalPageLayout(
List<Layout> layouts = LayoutLocalServiceUtil.getLayouts(groupId, true);

for (Layout layout : layouts) {
if (layout.getName(Locale.US).equals(portalPageName)) {
String layoutName = layout.getName(Locale.US);

if (layoutName.equals(portalPageName)) {
portalPageLayout = layout;
}
}
Expand Down Expand Up @@ -361,11 +367,10 @@ private static void _setupPermissionChecker(long companyId)
Role administratorRole = RoleLocalServiceUtil.getRole(
companyId, RoleConstants.ADMINISTRATOR);

User administratorUser = UserLocalServiceUtil.getRoleUsers(
administratorRole.getRoleId()
).get(
0
);
List<User> users = UserLocalServiceUtil.getRoleUsers(
administratorRole.getRoleId());

User administratorUser = users.get(0);

try {
permissionChecker = PermissionCheckerFactoryUtil.create(
Expand Down

0 comments on commit 5367f3a

Please sign in to comment.