Skip to content

Commit 77627fb

Browse files
author
Vasile Baluta
committed
Merge branch 'Ericsson-master'
2 parents 9431bd2 + 39c21aa commit 77627fb

File tree

115 files changed

+5844
-2292
lines changed

Some content is hidden

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

115 files changed

+5844
-2292
lines changed

.travis.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,4 @@ before_install:
1313
- chmod +x pom.xml
1414

1515
script:
16-
- mvn -DsomeModule.test.excludes="**/FlowTest.java, **/FlowTest2.java, **/TrafficGeneratedTest.java, **/FlowTestExternalComposition.java, **/FlowTestTestExecution.java, **/FlowSourceChangeObject.java" test
17-
- mvn -DsomeModule.test.includes="**/FlowTest.java" test
18-
- mvn -DsomeModule.test.includes="**/FlowTest2.java" test
19-
- mvn -DsomeModule.test.includes="**/TrafficGeneratedTest.java" test
20-
- mvn -DsomeModule.test.includes="**/FlowTestExternalComposition.java" test
21-
- mvn -DsomeModule.test.includes="**/FlowSourceChangeObject.java" test
22-
- mvn -DsomeModule.test.includes="**/FlowTestTestExecution.java" test
16+
- mvn clean install

pom.xml

Lines changed: 8 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
<dependency>
8282
<groupId>org.springframework.boot</groupId>
8383
<artifactId>spring-boot-starter-tomcat</artifactId>
84-
<scope>provided</scope>
84+
<scope>compile</scope>
8585
</dependency>
8686

8787
<dependency>
@@ -185,73 +185,25 @@
185185
<version>1.16.16</version>
186186
<scope>provided</scope>
187187
</dependency>
188+
<dependency>
189+
<groupId>org.jongo</groupId>
190+
<artifactId>jongo</artifactId>
191+
<version>1.3.0</version>
192+
</dependency>
188193
</dependencies>
189194
<build>
190195
<plugins>
191196
<plugin>
192197
<groupId>org.springframework.boot</groupId>
193198
<artifactId>spring-boot-maven-plugin</artifactId>
194199
</plugin>
195-
196-
<!-- PhoenixNAP RAML Code Generator plugin used to generate sources
197-
from raml -->
198-
<plugin>
199-
<groupId>com.phoenixnap.oss</groupId>
200-
<artifactId>springmvc-raml-plugin</artifactId>
201-
<version>${plugin-version}</version>
202-
<configuration>
203-
<!-- path to raml file -->
204-
<ramlPath>${raml-path}</ramlPath>
205-
<!-- output of generated code -->
206-
<outputRelativePath>${output-relative-path}</outputRelativePath>
207-
<addTimestampFolder>false</addTimestampFolder>
208-
<!-- package for generated sources -->
209-
<basePackage>${base-package}</basePackage>
210-
<baseUri>/</baseUri>
211-
<seperateMethodsByContentType>false</seperateMethodsByContentType>
212-
<useJackson1xCompatibility>false</useJackson1xCompatibility>
213-
<rule>com.phoenixnap.oss.ramlapisync.generation.rules.Spring4ControllerInterfaceRule</rule>
214-
<generationConfig>
215-
<useCommonsLang3>true</useCommonsLang3>
216-
</generationConfig>
217-
</configuration>
218-
<executions>
219-
<execution>
220-
<id>generate-springmvc-controllers</id>
221-
<phase>generate-sources</phase>
222-
<goals>
223-
<goal>generate-springmvc-endpoints</goal>
224-
</goals>
225-
</execution>
226-
</executions>
227-
</plugin>
228-
229-
<!-- required for adding generated sources -->
230-
<plugin>
231-
<groupId>org.codehaus.mojo</groupId>
232-
<artifactId>build-helper-maven-plugin</artifactId>
233-
<executions>
234-
<execution>
235-
<phase>generate-sources</phase>
236-
<goals>
237-
<goal>add-source</goal>
238-
</goals>
239-
<configuration>
240-
<sources>
241-
<!-- where to find the generated sources -->
242-
<source>${output-relative-path}</source>
243-
</sources>
244-
</configuration>
245-
</execution>
246-
</executions>
247-
</plugin>
248-
200+
249201
<plugin>
250202
<groupId>org.apache.maven.plugins</groupId>
251203
<artifactId>maven-surefire-plugin</artifactId>
252204
<version>2.20</version>
253205
<configuration>
254-
<forkCount>1</forkCount>
206+
<forkCount>2C</forkCount>
255207
<reuseForks>false</reuseForks>
256208
<excludes>
257209
<exclude>${someModule.test.excludes}</exclude>

src/main/java/com/ericsson/ei/App.java

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,43 +16,51 @@
1616
*/
1717
package com.ericsson.ei;
1818

19+
import java.util.ArrayList;
20+
import java.util.Collections;
21+
import java.util.List;
22+
23+
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
24+
import org.springframework.beans.factory.config.Scope;
25+
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
1926
import org.springframework.boot.SpringApplication;
2027
import org.springframework.boot.autoconfigure.SpringBootApplication;
2128
import org.springframework.boot.builder.SpringApplicationBuilder;
2229
import org.springframework.boot.web.support.SpringBootServletInitializer;
30+
import org.springframework.context.support.SimpleThreadScope;
2331
import org.springframework.scheduling.annotation.EnableAsync;
2432
import org.springframework.scheduling.annotation.EnableScheduling;
2533

26-
import java.util.ArrayList;
27-
import java.util.Collections;
28-
import java.util.List;
29-
3034
@SpringBootApplication
3135
@EnableAsync
3236
@EnableScheduling
3337
public class App extends SpringBootServletInitializer {
3438

35-
@Override
36-
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
37-
return application.sources(App.class);
38-
}
39+
@Override
40+
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
41+
return application.sources(App.class);
42+
}
43+
44+
public static void main(String[] args) {
3945

40-
public static void main(String[] args) {
46+
List<String> logLevels = new ArrayList<>();
47+
Collections.addAll(logLevels, "ALL", "DEBUG", "ERROR", "FATAL", "INFO", "TRACE", "WARN");
4148

42-
List<String> logLevels = new ArrayList<>();
43-
Collections.addAll(logLevels, "ALL", "DEBUG", "ERROR", "FATAL", "INFO", "TRACE", "WARN");
49+
if (args != null && args.length > 0 && logLevels.contains(args[0])) {
50+
System.setProperty("logging.level.root", args[0]);
51+
System.setProperty("logging.level.org.springframework.web", args[0]);
52+
System.setProperty("logging.level.com.ericsson.ei", args[0]);
53+
} else {
54+
System.setProperty("logging.level.root", "OFF");
55+
System.setProperty("logging.level.org.springframework.web", "OFF");
56+
System.setProperty("logging.level.com.ericsson.ei", "OFF");
57+
}
4458

45-
if (args != null && args.length > 0 && logLevels.contains(args[0])) {
46-
System.setProperty("logging.level.root", args[0]);
47-
System.setProperty("logging.level.org.springframework.web", args[0]);
48-
System.setProperty("logging.level.com.ericsson.ei", args[0]);
49-
} else {
50-
System.setProperty("logging.level.root", "OFF");
51-
System.setProperty("logging.level.org.springframework.web", "OFF");
52-
System.setProperty("logging.level.com.ericsson.ei", "OFF");
53-
}
59+
ConfigurableBeanFactory beanFactory = new DefaultListableBeanFactory();
60+
Scope threadScope = new SimpleThreadScope();
61+
beanFactory.registerScope("thread", threadScope);
5462

55-
SpringApplication.run(App.class, args);
56-
}
63+
SpringApplication.run(App.class, args);
64+
}
5765

5866
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.ericsson.ei.config.scope.register;
2+
3+
import org.springframework.beans.BeansException;
4+
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
5+
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
6+
import org.springframework.context.support.SimpleThreadScope;
7+
8+
/**
9+
* This class for the extend the "request" bean scope to thread level
10+
* This "thread" scope is implemented to EventHandler and RuleHandler
11+
* The spring provided "request" bean scope will work only request level, threads are not access the request bean scope without request
12+
* Using the SimpleThreadScope custom scope(scope name "thread") extend the request scope to threads.
13+
*
14+
*/
15+
public class CustomScopeRegisteringBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
16+
@Override
17+
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
18+
beanFactory.registerScope("thread", new SimpleThreadScope());
19+
}
20+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.ericsson.ei.config.scope.register;
2+
3+
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
4+
import org.springframework.context.annotation.Bean;
5+
import org.springframework.context.annotation.Configuration;
6+
7+
/**
8+
* Register the SimpleThreadScope
9+
*
10+
*/
11+
@Configuration
12+
public class SpringBeanScopeRegisterConfig {
13+
14+
@Bean
15+
public static BeanFactoryPostProcessor beanFactoryPostProcessor() {
16+
return new CustomScopeRegisteringBeanFactoryPostProcessor();
17+
}
18+
19+
}

src/main/java/com/ericsson/ei/controller/AggregatedObjectController.java renamed to src/main/java/com/ericsson/ei/controller/QueryAggregatedObjectController.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
package com.ericsson.ei.controller;
33

4+
import com.ericsson.ei.controller.model.QueryResponse;
45
import org.springframework.http.ResponseEntity;
56
import org.springframework.web.bind.annotation.RequestMapping;
67
import org.springframework.web.bind.annotation.RequestMethod;
@@ -14,8 +15,8 @@
1415
*
1516
*/
1617
@RestController
17-
@RequestMapping(value = "/query/aggregatedObject", produces = "application/json")
18-
public interface AggregatedObjectController {
18+
@RequestMapping(value = "/queryAggregatedObject", produces = "application/json")
19+
public interface QueryAggregatedObjectController {
1920

2021

2122
/**

src/main/java/com/ericsson/ei/controller/AggregatedObjectControllerImpl.java renamed to src/main/java/com/ericsson/ei/controller/QueryAggregatedObjectControllerImpl.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
*/
1414
package com.ericsson.ei.controller;
1515

16-
import java.util.ArrayList;
17-
16+
import com.ericsson.ei.controller.model.QueryResponse;
17+
import com.ericsson.ei.queryservice.ProcessAggregatedObject;
1818
import org.slf4j.Logger;
1919
import org.slf4j.LoggerFactory;
2020
import org.springframework.beans.factory.annotation.Autowired;
@@ -24,34 +24,33 @@
2424
import org.springframework.web.bind.annotation.CrossOrigin;
2525
import org.springframework.web.bind.annotation.RequestParam;
2626

27-
import com.ericsson.ei.controller.model.QueryResponse;
28-
import com.ericsson.ei.queryservice.ProcessAggregatedObject;
27+
import java.util.ArrayList;
2928

3029
/**
3130
* This class represents the REST GET mechanism to extract the aggregated data
3231
* on the basis of the ID from the aggregatedObject.
33-
*
3432
*/
3533
@Component
3634
@CrossOrigin
37-
public class AggregatedObjectControllerImpl implements AggregatedObjectController {
35+
public class QueryAggregatedObjectControllerImpl implements QueryAggregatedObjectController {
3836

39-
static Logger log = (Logger) LoggerFactory.getLogger(AggregatedObjectControllerImpl.class);
37+
private static Logger LOGGER = (Logger) LoggerFactory.getLogger(QueryAggregatedObjectControllerImpl.class);
4038

4139
@Autowired
4240
private ProcessAggregatedObject processAggregatedObject;
4341

4442
/**
4543
* This method is responsible for the REST Get mechanism to extract the
4644
* aggregated data on the basis of the ID from the aggregatedObject.
47-
*
45+
*
4846
* @param id
4947
* @return ResponseEntity
5048
*/
5149
public ResponseEntity<QueryResponse> getQueryAggregatedObject(@RequestParam("ID") final String id) {
50+
QueryResponse queryResponse= new QueryResponse();
5251
ArrayList<String> response = processAggregatedObject.processQueryAggregatedObject(id);
53-
log.info("The response is : " + response.toString());
54-
return new ResponseEntity(response.toString(), HttpStatus.OK);
52+
queryResponse.setResponseEntity(response.toString());
53+
LOGGER.debug("The response is : " + response.toString());
54+
return new ResponseEntity(queryResponse, HttpStatus.OK);
5555
}
56-
57-
}
56+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2+
package com.ericsson.ei.controller;
3+
4+
import org.springframework.http.ResponseEntity;
5+
import org.springframework.web.bind.annotation.RequestMapping;
6+
import org.springframework.web.bind.annotation.RequestMethod;
7+
import org.springframework.web.bind.annotation.RequestParam;
8+
import org.springframework.web.bind.annotation.RestController;
9+
10+
11+
/**
12+
* No description
13+
* (Generated with springmvc-raml-parser v.0.10.11)
14+
*
15+
*/
16+
@RestController
17+
@RequestMapping(value = "/query", produces = "application/json")
18+
public interface QueryController {
19+
20+
21+
/**
22+
* The REST GET method is used to query Aggregated Objects with the criterias requested, which are present as query parameters in the request URL.
23+
*
24+
*/
25+
@RequestMapping(value = "", method = RequestMethod.GET)
26+
public ResponseEntity<?> getQuery(
27+
@RequestParam
28+
String request);
29+
30+
/**
31+
* The REST POST method is used to query Aggregated Objects with the criterias requested, which are present in the request body of the request URL.
32+
*
33+
*/
34+
@RequestMapping(value = "", method = RequestMethod.POST)
35+
public ResponseEntity<?> updateQuery(
36+
@RequestParam
37+
String request);
38+
39+
}

0 commit comments

Comments
 (0)