Skip to content

Commit 1610c7b

Browse files
committed
2.0 Sprint 5.4
2 parents 51b8cde + c639dd8 commit 1610c7b

File tree

248 files changed

+3853
-1457
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

248 files changed

+3853
-1457
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The SDL Digital Experience Accelerator (DXA) is a reference implementation of SD
99
It is available for .NET and Java Web Applications and has a modular architecture consisting of a Framework and example web application providing core functionality and separate Modules for additional, optional functionality.
1010

1111
This repository contains the source code of the DXA Framework, example web application and Maven archetype for Java.
12-
The full DXA distribution (including CM-side items and installation support) is downloadable from the [SDL Community site](https://community.sdl.com/developers/tridion_developer/m/mediagallery/1241) (latest version)
12+
The full DXA distribution (including CM-side items and installation support) is downloadable from the [SDL Appstore site](https://appstore.sdl.com/web-content-management/app/sdl-digital-experience-accelerator-java/737/) (latest version)
1313
or the [Releases in GitHub](https://github.com/sdl/dxa-web-application-java/releases) (all versions)
1414

1515
Furthermore, the compiled DXA artifacts are available on [Maven Central](http://search.maven.org/#search%7Cga%7C1%7Cdxa).

build.gradle

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ task help(type: MavenHelpTask)
3232
task buildFramework(type: MavenBuildTask) {
3333
configurations = [
3434
["dxa-oss-parent"],
35-
["dxa-model-service-client"],
35+
["dxa-model-service-client", "dxa-javadoc-tools"],
3636
["dxa-framework", "dxa-dd4t-ms-provider"],
3737
["> dxa-webapp > clean org.apache.maven.plugins:maven-archetype-plugin:2.4:create-from-project -Darchetype.properties=archetype.properties"]
3838
]
@@ -73,7 +73,14 @@ task buildArchetype(type: MavenBuildTask, dependsOn: prepareArchetype) {
7373
configurations = [["dxa-webapp/target/generated-sources/archetype"]]
7474
}
7575

76-
task buildDxa(type: MavenBuildTask, dependsOn: [buildFramework, buildArchetype])
76+
task buildPublicApiDocs(type: MavenBuildTask, dependsOn: buildFramework) {
77+
configurations = [
78+
//[ "> dxa-framework/dxa-common-api > javadoc:javadoc@publicApi" ],
79+
//[ "> dxa-framework/dxa-tridion-provider > javadoc:javadoc@publicApi" ]
80+
]
81+
}
82+
83+
task buildDxa(type: MavenBuildTask, dependsOn: [buildFramework, buildArchetype, buildPublicApiDocs])
7784

7885
def mavenSettings = {
7986
if (project.hasProperty('command')) {

dxa-builder/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,9 @@ dependencies {
203203
compile gradleApi()
204204
compile localGroovy()
205205
compile 'org.jdom:jdom2:2.0.5'
206-
compile 'jaxen:jaxen:1.1.4'
206+
compile 'jaxen:jaxen:1.1.6'
207+
compile group: 'commons-configuration', name: 'commons-configuration', version: '1.10'
207208
compile group: 'commons-validator', name: 'commons-validator', version: '1.5.1'
208209
testCompile group: 'junit', name: 'junit', version: '4.11'
210+
testCompile group: 'org.mockito', name: 'mockito-all', version: '1.10.19'
209211
}

dxa-builder/src/main/groovy/com/sdl/dxa/builder/configuration/parameters/Parameter.groovy

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class Parameter {
8989
println ''
9090

9191
if (this.properties) {
92-
def param = this;
92+
def param = this
9393
this.properties.each {
9494
it.caseSensitive = param.isValueCaseSensitive
9595
props[it] = this.get()
@@ -101,7 +101,9 @@ class Parameter {
101101

102102
String request() {
103103
println "\n :: ${description}\n :: Default value: '${value ?: 'no default'}'" +
104+
(this.isValueCaseSensitive ? "\n :: This value is case-sensitive" : '') +
104105
"\n\nPress <Enter> to choose default value or type 'halt' to stop"
106+
105107
validator?.describe()
106108

107109
def userValue
@@ -127,6 +129,9 @@ class Parameter {
127129

128130
String get() {
129131
if (!isValid(value)) {
132+
if (this.isValueCaseSensitive) {
133+
println "This value is case-sensitive"
134+
}
130135
validator?.describe()
131136
throw new IllegalArgumentException("Invalid value '${value}' for '${description}'")
132137
}
Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package com.sdl.dxa.builder.configuration.parameters
22

3+
import org.apache.commons.configuration.PropertiesConfiguration
4+
import org.apache.commons.configuration.PropertiesConfigurationLayout
5+
36
/**
47
* Property that is capable to work with {@code *.properties} files.
58
*/
@@ -11,18 +14,22 @@ class PropertiesFileProperty extends Property {
1114
}
1215

1316
def file = new File(filename)
14-
def properties = new Properties()
15-
properties.load(file.newDataInputStream())
17+
18+
PropertiesConfiguration config = new PropertiesConfiguration()
19+
PropertiesConfigurationLayout layout = new PropertiesConfigurationLayout(config)
20+
21+
layout.load(new InputStreamReader(new FileInputStream(file)))
1622

1723
if (this.append) {
18-
def old = properties.get(this.name)
19-
if (old == null || !(old as String).contains(value)) {
20-
properties.setProperty(this.name, "${(old == null || old == '' ? '' : old + ', ')}${value}")
24+
def list = config.getList(this.name)
25+
if (!list.contains(value)) {
26+
list.add(value)
27+
config.setProperty(this.name, list)
2128
}
2229
} else {
23-
properties.setProperty(this.name, value)
30+
config.setProperty(this.name, value)
2431
}
2532
println "Modified $filename, set ${name == null ? 'property to' : (name + ' =')} $value"
26-
properties.store(file.newWriter(), 'UTF-8')
33+
layout.save(new FileWriter(filename, false))
2734
}
2835
}

dxa-builder/src/main/groovy/com/sdl/dxa/builder/configuration/parameters/Property.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ abstract class Property {
6464
def result
6565

6666
if (this.valueMapping) {
67-
if (this.caseSensitive) {
67+
if (!this.caseSensitive) {
6868
value = value.toLowerCase()
6969
}
7070

dxa-builder/src/main/groovy/com/sdl/dxa/builder/maven/MavenBuildTask.groovy

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,26 @@ class MavenBuildTask extends DefaultTask {
2525

2626
def customCommandDelimiter = /\s*>\s*/
2727

28+
static String mvnVersion() {
29+
def mvnVersion = BuildTask.determineShell() + "mvn --version"
30+
return mvnVersion.execute().text
31+
}
32+
33+
static boolean isMvnInstalled() {
34+
try {
35+
return mvnVersion().contains("Maven")
36+
} catch (Exception ignored) {
37+
return false
38+
}
39+
}
40+
2841
@TaskAction
2942
def run() {
43+
if (!configurations) {
44+
println "Nothing to do with Maven"
45+
return
46+
}
47+
3048
printMvnVersion()
3149

3250
def pool = Executors.newFixedThreadPool(numberThreads)
@@ -49,7 +67,7 @@ class MavenBuildTask extends DefaultTask {
4967
System.in.read()
5068
}
5169
println "Error building ${output.command}"
52-
System.exit(output.code);
70+
System.exit(output.code)
5371
} else {
5472
outputPool.submit {
5573
println "= SUCCESS (in ${output.timeSeconds}s): ${output.command}"
@@ -77,7 +95,7 @@ class MavenBuildTask extends DefaultTask {
7795

7896
}
7997

80-
def BuildTask buildTask(String task, Closure callback, boolean verbose) {
98+
BuildTask buildTask(String task, Closure callback, boolean verbose) {
8199
task = task.trim()
82100

83101
if (task =~ customCommandDelimiter) {
@@ -111,13 +129,10 @@ class MavenBuildTask extends DefaultTask {
111129
}
112130

113131
private static void printMvnVersion() {
114-
if (!isVersionShown) {
132+
if (!isVersionShown && isMvnInstalled()) {
115133
isVersionShown = true
116134

117-
def mvnVersion = BuildTask.determineShell() + "mvn --version"
118-
println mvnVersion
119-
mvnVersion.execute().in.eachLine { println it }
120-
println ""
135+
println mvnVersion()
121136
}
122137
}
123138
}

dxa-builder/src/test/groovy/com/sdl/dxa/builder/configuration/writers/XmlWriterTest.groovy

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class XmlWriterTest {
3030
'/element/outerTag/innerTag/text()' : 'new value',
3131
]).save()
3232

33-
Assert.assertEquals(new File(example).text, new File(pathTo).text)
33+
Assert.assertEquals(new File(example).text.normalize(), new File(pathTo).text.normalize())
3434
}
3535

3636
@Test
@@ -50,7 +50,7 @@ class XmlWriterTest {
5050
.modifyByXPath([:])
5151
.save()
5252

53-
Assert.assertEquals(new File(example).text, new File(pathTo).text)
53+
Assert.assertEquals(new File(example).text.normalize(), new File(pathTo).text.normalize())
5454

5555
writer = new XmlWriter()
5656
.from(fromPath)
@@ -63,7 +63,7 @@ class XmlWriterTest {
6363
.modifyByXPath([:])
6464
.save()
6565

66-
Assert.assertEquals(new File(example).text, new File(pathTo).text)
66+
Assert.assertEquals(new File(example).text.normalize(), new File(pathTo).text.normalize())
6767
}
6868

6969
@Test
@@ -93,7 +93,7 @@ class XmlWriterTest {
9393
.save()
9494

9595
//then
96-
Assert.assertEquals(new File(example).text, new File(pathTo).text)
96+
Assert.assertEquals(new File(example).text.normalize(), new File(pathTo).text.normalize())
9797
}
9898

9999
String path(String path) {
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.sdl.dxa.caching;
2+
3+
import com.sdl.webapp.common.api.WebRequestContext;
4+
import org.springframework.beans.factory.annotation.Autowired;
5+
import org.springframework.stereotype.Component;
6+
7+
@Component
8+
public class WebRequestContextLocalizationIdProvider implements LocalizationIdProvider {
9+
10+
@Autowired
11+
private WebRequestContext webRequestContext;
12+
13+
@Override
14+
public String getId() {
15+
return webRequestContext.getLocalization().getId();
16+
}
17+
}

dxa-framework/dxa-common-api/src/main/java/com/sdl/dxa/caching/wrapper/EntitiesCache.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
import com.sdl.webapp.common.api.model.EntityModel;
66
import org.springframework.stereotype.Component;
77

8+
/**
9+
* Default implementation of entities cache for manual access.
10+
*
11+
* @dxa.publicApi
12+
*/
813
@Component
914
public class EntitiesCache extends SimpleCacheWrapper<EntityModelData, EntityModel> {
1015

0 commit comments

Comments
 (0)