Skip to content

Commit

Permalink
2.1.0 Sprint
Browse files Browse the repository at this point in the history
  • Loading branch information
dxa-team committed Jun 15, 2018
2 parents ab6de6f + 520c172 commit 2a7803e
Show file tree
Hide file tree
Showing 149 changed files with 5,009 additions and 147 deletions.
3 changes: 2 additions & 1 deletion webapp-java/build.gradle
Expand Up @@ -35,7 +35,8 @@ task buildModules(type: MavenBuildTask) {
"dxa-module-googleanalytics",
"dxa-module-mediamanager",
"dxa-module-search",
"dxa-module-51degrees"
"dxa-module-51degrees",
"dxa-module-ugc"
],
["dxa-module-test"]
]
Expand Down
2 changes: 1 addition & 1 deletion webapp-java/dxa-module-51degrees/pom.xml
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.sdl.dxa</groupId>
<artifactId>dxa-oss-parent</artifactId>
<version>2.0.0</version>
<version>2.1.0-SNAPSHOT</version>
</parent>

<groupId>com.sdl.dxa.modules</groupId>
Expand Down
2 changes: 1 addition & 1 deletion webapp-java/dxa-module-audience-manager/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.sdl.dxa</groupId>
<artifactId>dxa-oss-parent</artifactId>
<version>2.0.0</version>
<version>2.1.0-SNAPSHOT</version>
</parent>

<groupId>com.sdl.dxa.modules</groupId>
Expand Down
2 changes: 1 addition & 1 deletion webapp-java/dxa-module-cid/pom.xml
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.sdl.dxa</groupId>
<artifactId>dxa-oss-parent</artifactId>
<version>2.0.0</version>
<version>2.1.0-SNAPSHOT</version>
</parent>

<groupId>com.sdl.dxa.modules</groupId>
Expand Down
Expand Up @@ -7,13 +7,12 @@
import javax.servlet.Filter;
import javax.servlet.Servlet;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import java.util.Properties;

@Slf4j
public class CidWebInitializer implements WebApplicationInitializer {
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
public void onStartup(ServletContext servletContext) {
log.debug("Trying to initialize servlet for CID module");

Properties properties = InitializationUtils.loadDxaProperties();
Expand All @@ -34,8 +33,6 @@ public void onStartup(ServletContext servletContext) throws ServletException {
log.warn("Class {} for CID module is expected to be either Filter of Servlet but is", className);
}

String sessionIdName = InitializationUtils.loadDxaProperties().getProperty("dxa.modules.cid.sessionid.name");
servletContext.getSessionCookieConfig().setName(sessionIdName);
log.info("Set default SESSIONID to {}", sessionIdName);
// session id rename has moved to DXA Web Initialization
}
}
@@ -1,4 +1,5 @@
dxa.modules.cid.mapping=/cid/*
dxa.modules.cid.sessionid.name=DXA-SESSIONID
# need to rename it in DXA because of CID bug
dxa.web.sessionid.name=DXA-SESSIONID
#dxa.modules.cid.className=should be configured it in dxa.properties file because if version-specific
#dxa.modules.cid.appHostMapping=external path to the server which runs DXA for back-mapping for CID Service
2 changes: 1 addition & 1 deletion webapp-java/dxa-module-context-expressions/pom.xml
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.sdl.dxa</groupId>
<artifactId>dxa-oss-parent</artifactId>
<version>2.0.0</version>
<version>2.1.0-SNAPSHOT</version>
</parent>

<groupId>com.sdl.dxa.modules</groupId>
Expand Down
2 changes: 1 addition & 1 deletion webapp-java/dxa-module-core/pom.xml
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.sdl.dxa</groupId>
<artifactId>dxa-oss-parent</artifactId>
<version>2.0.0</version>
<version>2.1.0-SNAPSHOT</version>
</parent>

<groupId>com.sdl.dxa.modules</groupId>
Expand Down
2 changes: 1 addition & 1 deletion webapp-java/dxa-module-googleanalytics/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.sdl.dxa</groupId>
<artifactId>dxa-oss-parent</artifactId>
<version>2.0.0</version>
<version>2.1.0-SNAPSHOT</version>
</parent>

<groupId>com.sdl.dxa.modules</groupId>
Expand Down
2 changes: 1 addition & 1 deletion webapp-java/dxa-module-mediamanager/pom.xml
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.sdl.dxa</groupId>
<artifactId>dxa-oss-parent</artifactId>
<version>2.0.0</version>
<version>2.1.0-SNAPSHOT</version>
</parent>

<groupId>com.sdl.dxa.modules</groupId>
Expand Down
2 changes: 1 addition & 1 deletion webapp-java/dxa-module-search/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.sdl.dxa</groupId>
<artifactId>dxa-oss-parent</artifactId>
<version>2.0.0</version>
<version>2.1.0-SNAPSHOT</version>
</parent>

<groupId>com.sdl.dxa.modules</groupId>
Expand Down
2 changes: 1 addition & 1 deletion webapp-java/dxa-module-smarttarget/pom.xml
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.sdl.dxa</groupId>
<artifactId>dxa-oss-parent</artifactId>
<version>2.0.0</version>
<version>2.1.0-SNAPSHOT</version>
</parent>

<groupId>com.sdl.dxa.modules</groupId>
Expand Down
Expand Up @@ -101,7 +101,7 @@ public void shouldHavePositiveePriority() {
public void shouldReturnNullIfPageModelIsNull() {
//when, then
//noinspection ConstantConditions
assertNull(pageBuilder.buildPageModel(null, new PageModelData("", null, null, null, null, null, null)));
assertNull(pageBuilder.buildPageModel(null, new PageModelData("", "tcm", null, null, null, null, null, null)));
}

@Test
Expand All @@ -112,7 +112,7 @@ public void shouldNotChangePageModelWithoutSTRegionsOnPage() throws DxaException
PageModel expected = createPageModel(new RegionModelImpl("test"));

//when
PageModel page2 = pageBuilder.buildPageModel(pageModel, new PageModelData("", null, null, null, null, null, null));
PageModel page2 = pageBuilder.buildPageModel(pageModel, new PageModelData("", "tcm", null, null, null, null, null, null));

//then
Assert.assertEquals(expected, pageModel);
Expand All @@ -134,7 +134,7 @@ public void shouldNotChangePageModelWithoutRegionsMetadata() throws DxaException
PageModel expected = createPageModel(new SmartTargetRegion("test"));

//when
PageModel pageR2 = pageBuilder.buildPageModel(pageModel, new PageModelData("", null, null, null, null, null, ""));
PageModel pageR2 = pageBuilder.buildPageModel(pageModel, new PageModelData("", "tcm", null, null, null, null, null, ""));

//then
Assert.assertEquals(expected, pageModel);
Expand All @@ -148,7 +148,7 @@ private void shouldCallSubclassForSmartTargetAndProcessMetadata_R2(String maxIte
RegionModelData regionModelData = RegionModelData.builder().name("test").metadata(new ContentModelData() {{
put("maxItems", maxItemsValue);
}}).build();
PageModelData pageModelData = new PageModelData("id", null, Collections.emptyMap(), null, "title", Lists.newArrayList(regionModelData), "");
PageModelData pageModelData = new PageModelData("id", "tcm", null, Collections.emptyMap(), null, "title", Lists.newArrayList(regionModelData), "");

SmartTargetPageModel stPageModel = Mockito.mock(SmartTargetPageModel.class);
Mockito.when(stPageModel.setAllowDuplicates(Matchers.anyBoolean())).thenReturn(stPageModel);
Expand Down
2 changes: 1 addition & 1 deletion webapp-java/dxa-module-test/pom.xml
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.sdl.dxa</groupId>
<artifactId>dxa-oss-parent</artifactId>
<version>2.0.0</version>
<version>2.1.0-SNAPSHOT</version>
</parent>

<groupId>com.sdl.dxa.modules</groupId>
Expand Down
88 changes: 88 additions & 0 deletions webapp-java/dxa-module-ugc/pom.xml
@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.sdl.dxa</groupId>
<artifactId>dxa-oss-parent</artifactId>
<version>2.1.0-SNAPSHOT</version>
</parent>

<groupId>com.sdl.dxa.modules</groupId>
<artifactId>dxa-module-ugc</artifactId>

<name>DXA Modules - UGC</name>
<description>Implementation of DXA UGC module</description>

<scm>
<url>https://github.com/sdl/dxa-modules</url>
<connection>scm:git:git@github.com:sdl/dxa-modules.git</connection>
<developerConnection>scm:git:git@github.com:sdl/dxa-modules.git</developerConnection>
<tag>HEAD</tag>
</scm>
<properties>
<ugc-cil.version>11.0.0-SNAPSHOT</ugc-cil.version>
</properties>

<dependencies>
<dependency>
<groupId>com.sdl.dxa</groupId>
<artifactId>dxa-common-api</artifactId>
</dependency>
<dependency>
<groupId>com.sdl.dxa</groupId>
<artifactId>dxa-tridion-provider</artifactId>
</dependency>

<dependency>
<groupId>com.sdl.delivery</groupId>
<artifactId>udp-cil-api</artifactId>
<version>${ugc-cil.version}</version>
</dependency>
<dependency>
<groupId>com.sdl.delivery</groupId>
<artifactId>udp-ugc-cil-api</artifactId>
<version>${ugc-cil.version}</version>
</dependency>

<!-- Servlet API -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>

<!-- Spring Framework -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
@@ -0,0 +1,50 @@
package com.sdl.dxa.modules.ugc;

import com.sdl.delivery.ugc.client.comment.UgcCommentApi;
import com.sdl.delivery.ugc.client.comment.impl.DefaultUgcCommentApi;
import com.sdl.dxa.modules.ugc.model.entity.UgcComments;
import com.sdl.dxa.modules.ugc.model.entity.UgcPostCommentForm;
import com.sdl.dxa.modules.ugc.model.entity.UgcRegion;
import com.sdl.webapp.common.api.mapping.views.AbstractModuleInitializer;
import com.sdl.webapp.common.api.mapping.views.ModuleInfo;
import com.sdl.webapp.common.api.mapping.views.RegisteredViewModel;
import com.sdl.webapp.common.api.mapping.views.RegisteredViewModels;
import com.sdl.webapp.common.api.model.page.DefaultPageModel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

/**
* <p>Ugc Module initializer which initializes
* views registration in modules with {@link RegisteredViewModel} and {@link RegisteredViewModels}.
*</p>
*/
@Slf4j
@Configuration
@ComponentScan("com.sdl.dxa.modules.ugc")
public class UgcInitializer {

@Bean
public UgcCommentApi ugcCommentApi() {
return new DefaultUgcCommentApi();
}

//Todo: use UgcVoteCommentApi implementation when it becomes available

@Component
@RegisteredViewModels({
@RegisteredViewModel(viewName = "Comments", modelClass = UgcRegion.class),
@RegisteredViewModel(viewName = "UgcComments", modelClass = UgcComments.class),
@RegisteredViewModel(viewName = "UgcPostCommentForm", modelClass = UgcPostCommentForm.class, controllerName = "Ugc"),
@RegisteredViewModel(viewName = "GeneralPage", modelClass = DefaultPageModel.class)
})
@ModuleInfo(name = "UGC module", areaName = "Ugc", description = "Support for UGC views")
public static class UgcViewModuleInitializer extends AbstractModuleInitializer {
@Override
protected String getAreaName() {
return "Ugc";
}
}
}

0 comments on commit 2a7803e

Please sign in to comment.