Skip to content

Commit

Permalink
PLUTO-715 TCK: Contesting AnnotationPortletApplicationConfigTests_SPE…
Browse files Browse the repository at this point in the history
…C1_28_PortletContainerRuntimeOptions
  • Loading branch information
ngriffin7a committed May 10, 2018
1 parent 4262b1d commit 460dd4a
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 14 deletions.
20 changes: 20 additions & 0 deletions portlet-tck_3.0/V3AnnotationPortletApplicationConfigTests/pom.xml
Expand Up @@ -129,6 +129,18 @@
<artifactId>weld-servlet</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/pluto/*.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>pluto</id>
Expand All @@ -151,6 +163,14 @@
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/liferay/*.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
Expand Down
Expand Up @@ -24,12 +24,10 @@

import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.Portlet;
import javax.portlet.PortletConfig;
import javax.portlet.PortletException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import javax.portlet.annotations.PortletConfiguration;
import javax.portlet.tck.beans.TestResult;
import javax.portlet.tck.util.ModuleTestCaseDetails;

Expand All @@ -43,25 +41,18 @@
*
*/

@PortletConfiguration(
portletName = "AnnotationPortletApplicationConfigTests_SPEC1_28_PortletContainerRuntimeOptions"
)
public class AnnotationPortletApplicationConfigTests_SPEC1_28_PortletContainerRuntimeOptions implements Portlet {
public abstract class AnnotationPortletApplicationConfigTests_SPEC1_28_PortletContainerRuntimeOptionsBase {

private PortletConfig portletConfig = null;

@Override
public void init(PortletConfig config) throws PortletException {
this.portletConfig = config;
}

@Override
public void destroy() {}

@Override
public void processAction(ActionRequest portletReq, ActionResponse portletResp) throws PortletException, IOException {}

@Override
public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException {

PrintWriter writer = portletResp.getWriter();
Expand All @@ -73,15 +64,13 @@ public void render(RenderRequest portletReq, RenderResponse portletResp) throws
{
TestResult result = tcd.getTestResultFailed(V3ANNOTATIONPORTLETAPPLICATIONCONFIGTESTS_SPEC1_28_PORTLETCONTAINERRUNTIMEOPTIONS_DECLARINGPCRO1);
Map<String, String[]> runtimeOptions = portletConfig.getContainerRuntimeOptions();
if(runtimeOptions.containsKey("javax.portlet.escapeXml")
&& runtimeOptions.containsKey("javax.portlet.actionScopedRequestAttributes")
&& runtimeOptions.get("javax.portlet.escapeXml")[0].equals("true")
&& runtimeOptions.get("javax.portlet.actionScopedRequestAttributes")[0].equals("true")){
if (isRuntimeOptionsCorrect(runtimeOptions)) {
result.setTcSuccess(true);
}
result.writeTo(writer);
}

}

public abstract boolean isRuntimeOptionsCorrect(Map<String, String[]> runtimeOptions);
}
@@ -0,0 +1,44 @@
/* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package javax.portlet.tck.portlets.liferay;

import javax.portlet.Portlet;
import javax.portlet.annotations.PortletConfiguration;
import javax.portlet.tck.portlets.AnnotationPortletApplicationConfigTests_SPEC1_28_PortletContainerRuntimeOptionsBase;
import java.util.Map;

@PortletConfiguration(
portletName = "AnnotationPortletApplicationConfigTests_SPEC1_28_PortletContainerRuntimeOptions"
)
public class AnnotationPortletApplicationConfigTests_SPEC1_28_PortletContainerRuntimeOptions extends
AnnotationPortletApplicationConfigTests_SPEC1_28_PortletContainerRuntimeOptionsBase implements
Portlet {

@Override
public boolean isRuntimeOptionsCorrect(
Map<String, String[]> runtimeOptions) {

if (runtimeOptions.containsKey("javax.portlet.escapeXml")
&& runtimeOptions.get("javax.portlet.escapeXml")[0].equals("true")) {
return true;
}

return false;
}
}
@@ -0,0 +1,45 @@
/* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package javax.portlet.tck.portlets.pluto;

import javax.portlet.Portlet;
import javax.portlet.annotations.PortletConfiguration;
import javax.portlet.tck.portlets.AnnotationPortletApplicationConfigTests_SPEC1_28_PortletContainerRuntimeOptionsBase;
import java.util.Map;

@PortletConfiguration(
portletName = "AnnotationPortletApplicationConfigTests_SPEC1_28_PortletContainerRuntimeOptions"
)
public class AnnotationPortletApplicationConfigTests_SPEC1_28_PortletContainerRuntimeOptions extends
AnnotationPortletApplicationConfigTests_SPEC1_28_PortletContainerRuntimeOptionsBase implements
Portlet {

@Override
public boolean isRuntimeOptionsCorrect(
Map<String, String[]> runtimeOptions) {

if (runtimeOptions.containsKey("javax.portlet.escapeXml")
&& runtimeOptions.containsKey("javax.portlet.actionScopedRequestAttributes")
&& runtimeOptions.get("javax.portlet.escapeXml")[0].equals("true")
&& runtimeOptions.get("javax.portlet.actionScopedRequestAttributes")[0].equals("true")) {
return true;
}
return false;
}
}

0 comments on commit 460dd4a

Please sign in to comment.