Skip to content

Commit 2d2f992

Browse files
authored
Apply Google Code Formatting (#590)
Enforce Google Code Formatting
1 parent a7b7049 commit 2d2f992

32 files changed

+2784
-2343
lines changed

integration-tests/pom.xml

Lines changed: 120 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -1,135 +1,134 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0"
2-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4-
<modelVersion>4.0.0</modelVersion>
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
54

6-
<parent>
7-
<groupId>my</groupId>
8-
<artifactId>bookshop-parent</artifactId>
9-
<version>${revision}</version>
10-
</parent>
5+
<parent>
6+
<groupId>my</groupId>
7+
<artifactId>bookshop-parent</artifactId>
8+
<version>${revision}</version>
9+
</parent>
1110

12-
<artifactId>bookshop-integration-tests</artifactId>
11+
<artifactId>bookshop-integration-tests</artifactId>
1312

14-
<name>bookshop-integration-tests</name>
13+
<name>bookshop-integration-tests</name>
1514

16-
<properties>
17-
<sidecar.dir>../mtx/sidecar</sidecar.dir>
18-
</properties>
15+
<properties>
16+
<sidecar.dir>../mtx/sidecar</sidecar.dir>
17+
</properties>
1918

20-
<dependencies>
21-
<dependency>
22-
<groupId>my</groupId>
23-
<artifactId>bookshop</artifactId>
24-
<version>${revision}</version>
25-
<scope>test</scope>
26-
<exclusions>
27-
<exclusion>
28-
<groupId>ch.qos.logback</groupId>
29-
<artifactId>logback-classic</artifactId>
30-
</exclusion>
31-
</exclusions>
32-
</dependency>
19+
<dependencies>
20+
<dependency>
21+
<groupId>my</groupId>
22+
<artifactId>bookshop</artifactId>
23+
<version>${revision}</version>
24+
<scope>test</scope>
25+
<exclusions>
26+
<exclusion>
27+
<groupId>ch.qos.logback</groupId>
28+
<artifactId>logback-classic</artifactId>
29+
</exclusion>
30+
</exclusions>
31+
</dependency>
3332

34-
<dependency>
35-
<groupId>org.springframework.boot</groupId>
36-
<artifactId>spring-boot-starter-test</artifactId>
37-
<scope>test</scope>
38-
</dependency>
33+
<dependency>
34+
<groupId>org.springframework.boot</groupId>
35+
<artifactId>spring-boot-starter-test</artifactId>
36+
<scope>test</scope>
37+
</dependency>
3938

40-
<dependency>
41-
<groupId>org.springframework.security</groupId>
42-
<artifactId>spring-security-test</artifactId>
43-
<scope>test</scope>
44-
</dependency>
45-
</dependencies>
39+
<dependency>
40+
<groupId>org.springframework.security</groupId>
41+
<artifactId>spring-security-test</artifactId>
42+
<scope>test</scope>
43+
</dependency>
44+
</dependencies>
4645

47-
<build>
48-
<plugins>
49-
<plugin>
50-
<groupId>org.apache.maven.plugins</groupId>
51-
<artifactId>maven-surefire-plugin</artifactId>
52-
<version>3.5.4</version>
53-
<configuration>
54-
<failIfNoTests>false</failIfNoTests>
55-
</configuration>
56-
</plugin>
46+
<build>
47+
<plugins>
48+
<plugin>
49+
<groupId>org.apache.maven.plugins</groupId>
50+
<artifactId>maven-surefire-plugin</artifactId>
51+
<version>3.5.4</version>
52+
<configuration>
53+
<failIfNoTests>false</failIfNoTests>
54+
</configuration>
55+
</plugin>
5756

58-
<plugin>
59-
<groupId>org.graalvm.buildtools</groupId>
60-
<artifactId>native-maven-plugin</artifactId>
61-
<configuration>
62-
<skipNativeTests>true</skipNativeTests>
63-
</configuration>
64-
</plugin>
57+
<plugin>
58+
<groupId>org.graalvm.buildtools</groupId>
59+
<artifactId>native-maven-plugin</artifactId>
60+
<configuration>
61+
<skipNativeTests>true</skipNativeTests>
62+
</configuration>
63+
</plugin>
6564

66-
<plugin>
67-
<!-- Tests ending with *IT.java will be executed here -->
68-
<groupId>org.apache.maven.plugins</groupId>
69-
<artifactId>maven-failsafe-plugin</artifactId>
70-
<version>3.5.4</version>
71-
<executions>
72-
<execution>
73-
<goals>
74-
<goal>integration-test</goal>
75-
<goal>verify</goal>
76-
</goals>
77-
</execution>
78-
</executions>
79-
</plugin>
65+
<plugin>
66+
<!-- Tests ending with *IT.java will be executed here -->
67+
<groupId>org.apache.maven.plugins</groupId>
68+
<artifactId>maven-failsafe-plugin</artifactId>
69+
<version>3.5.4</version>
70+
<executions>
71+
<execution>
72+
<goals>
73+
<goal>integration-test</goal>
74+
<goal>verify</goal>
75+
</goals>
76+
</execution>
77+
</executions>
78+
</plugin>
8079

81-
<plugin>
82-
<groupId>com.sap.cds</groupId>
83-
<artifactId>cds-maven-plugin</artifactId>
84-
<version>${cds.services.version}</version>
85-
<executions>
86-
<execution>
87-
<id>cds.install-node</id>
88-
<goals>
89-
<goal>install-node</goal>
90-
</goals>
91-
</execution>
80+
<plugin>
81+
<groupId>com.sap.cds</groupId>
82+
<artifactId>cds-maven-plugin</artifactId>
83+
<version>${cds.services.version}</version>
84+
<executions>
85+
<execution>
86+
<id>cds.install-node</id>
87+
<goals>
88+
<goal>install-node</goal>
89+
</goals>
90+
</execution>
9291

93-
<execution>
94-
<id>install-sidecar</id>
95-
<goals>
96-
<goal>npm</goal>
97-
</goals>
98-
<phase>pre-integration-test</phase>
99-
<configuration>
100-
<arguments>ci</arguments>
101-
<skip>${skipTests}</skip>
102-
<workingDirectory>${sidecar.dir}</workingDirectory>
103-
</configuration>
104-
</execution>
105-
</executions>
106-
</plugin>
92+
<execution>
93+
<id>install-sidecar</id>
94+
<goals>
95+
<goal>npm</goal>
96+
</goals>
97+
<phase>pre-integration-test</phase>
98+
<configuration>
99+
<arguments>ci</arguments>
100+
<skip>${skipTests}</skip>
101+
<workingDirectory>${sidecar.dir}</workingDirectory>
102+
</configuration>
103+
</execution>
104+
</executions>
105+
</plugin>
107106

108-
<plugin>
109-
<groupId>org.codehaus.mojo</groupId>
110-
<artifactId>exec-maven-plugin</artifactId>
111-
<version>3.6.3</version>
112-
<executions>
113-
<execution>
114-
<phase>pre-integration-test</phase>
115-
<id>start-sidecar</id>
116-
<goals>
117-
<goal>exec</goal>
118-
</goals>
119-
</execution>
120-
</executions>
121-
<configuration>
122-
<executable>${cds.npm.executable}</executable>
123-
<environmentVariables>
124-
<PATH>${cds.node.directory}${path.separator}${env.PATH}</PATH>
125-
</environmentVariables>
126-
<skip>${skipTests}</skip>
127-
<workingDirectory>${sidecar.dir}</workingDirectory>
128-
<async>true</async>
129-
<useMavenLogger>true</useMavenLogger>
130-
<commandlineArgs>run start</commandlineArgs>
131-
</configuration>
132-
</plugin>
133-
</plugins>
134-
</build>
107+
<plugin>
108+
<groupId>org.codehaus.mojo</groupId>
109+
<artifactId>exec-maven-plugin</artifactId>
110+
<version>3.6.3</version>
111+
<configuration>
112+
<executable>${cds.npm.executable}</executable>
113+
<environmentVariables>
114+
<PATH>${cds.node.directory}${path.separator}${env.PATH}</PATH>
115+
</environmentVariables>
116+
<skip>${skipTests}</skip>
117+
<workingDirectory>${sidecar.dir}</workingDirectory>
118+
<async>true</async>
119+
<useMavenLogger>true</useMavenLogger>
120+
<commandlineArgs>run start</commandlineArgs>
121+
</configuration>
122+
<executions>
123+
<execution>
124+
<id>start-sidecar</id>
125+
<goals>
126+
<goal>exec</goal>
127+
</goals>
128+
<phase>pre-integration-test</phase>
129+
</execution>
130+
</executions>
131+
</plugin>
132+
</plugins>
133+
</build>
135134
</project>

integration-tests/src/test/java/my/bookshop/it/FeatureTogglesIT.java

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -19,40 +19,40 @@
1919
@SpringBootTest
2020
class FeatureTogglesIT {
2121

22-
private static final String ENDPOINT = "/api/browse/Books(aebdfc8a-0dfa-4468-bd36-48aabd65e663)";
23-
24-
@Autowired
25-
private MockMvc client;
26-
27-
@Test
28-
@WithMockUser("authenticated") // This user has all feature toggles disabled
29-
void withoutToggles_basicModelVisible() throws Exception {
30-
// Elements are not visible and not changed by the event handler
31-
client.perform(get(ENDPOINT))
32-
.andExpect(status().isOk())
33-
.andExpect(jsonPath("$.isbn").doesNotExist())
34-
.andExpect(jsonPath("$.title").value(containsString("11%")));
35-
}
36-
37-
@Test
38-
@WithMockUser("admin") // This user has all feature toggles enabled
39-
void togglesOn_extensionsAndChangesAreVisible() throws Exception {
40-
// Elements are visible and changed by the event handler
41-
client.perform(get(ENDPOINT))
42-
.andExpect(status().isOk())
43-
.andExpect(jsonPath("$.isbn").value("979-8669820985"))
44-
.andExpect(jsonPath("$.title").value(containsString("14%")));
45-
}
46-
47-
@Test
48-
@WithMockUser("user") // This user has only 'isbn' toggle enabled
49-
void toggleIsbnOn_extensionsAndChangesAreVisible() throws Exception {
50-
// Elements are visible
51-
client.perform(get(ENDPOINT))
52-
.andExpect(status().isOk())
53-
.andExpect(jsonPath("$.isbn").value("979-8669820985"))
54-
.andExpect(jsonPath("$.title").value(containsString("11%")));
55-
}
56-
22+
private static final String ENDPOINT = "/api/browse/Books(aebdfc8a-0dfa-4468-bd36-48aabd65e663)";
23+
24+
@Autowired private MockMvc client;
25+
26+
@Test
27+
@WithMockUser("authenticated") // This user has all feature toggles disabled
28+
void withoutToggles_basicModelVisible() throws Exception {
29+
// Elements are not visible and not changed by the event handler
30+
client
31+
.perform(get(ENDPOINT))
32+
.andExpect(status().isOk())
33+
.andExpect(jsonPath("$.isbn").doesNotExist())
34+
.andExpect(jsonPath("$.title").value(containsString("11%")));
35+
}
36+
37+
@Test
38+
@WithMockUser("admin") // This user has all feature toggles enabled
39+
void togglesOn_extensionsAndChangesAreVisible() throws Exception {
40+
// Elements are visible and changed by the event handler
41+
client
42+
.perform(get(ENDPOINT))
43+
.andExpect(status().isOk())
44+
.andExpect(jsonPath("$.isbn").value("979-8669820985"))
45+
.andExpect(jsonPath("$.title").value(containsString("14%")));
46+
}
47+
48+
@Test
49+
@WithMockUser("user") // This user has only 'isbn' toggle enabled
50+
void toggleIsbnOn_extensionsAndChangesAreVisible() throws Exception {
51+
// Elements are visible
52+
client
53+
.perform(get(ENDPOINT))
54+
.andExpect(status().isOk())
55+
.andExpect(jsonPath("$.isbn").value("979-8669820985"))
56+
.andExpect(jsonPath("$.title").value(containsString("11%")));
57+
}
5758
}
58-

0 commit comments

Comments
 (0)