Skip to content

Commit db91233

Browse files
update fork (#4)
Update fork
1 parent 0af0193 commit db91233

30 files changed

+1166
-313
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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,11 @@
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>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
*
1616
*/
1717
@RestController
18-
@RequestMapping(value = "/query/aggregatedObject", produces = "application/json")
19-
public interface AggregatedObjectController {
18+
@RequestMapping(value = "/queryAggregatedObject", produces = "application/json")
19+
public interface QueryAggregatedObjectController {
2020

2121

2222
/**

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+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*
2+
Copyright 2018 Ericsson AB.
3+
For a full list of individual contributors, please see the commit history.
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
*/
17+
package com.ericsson.ei.controller;
18+
19+
import com.ericsson.ei.controller.model.QueryResponse;
20+
import com.ericsson.ei.queryservice.ProcessQueryParams;
21+
import com.fasterxml.jackson.databind.ObjectMapper;
22+
import io.swagger.annotations.Api;
23+
import io.swagger.annotations.ApiOperation;
24+
import org.json.JSONArray;
25+
import org.slf4j.Logger;
26+
import org.slf4j.LoggerFactory;
27+
import org.springframework.beans.factory.annotation.Autowired;
28+
import org.springframework.http.HttpStatus;
29+
import org.springframework.http.ResponseEntity;
30+
import org.springframework.stereotype.Component;
31+
import org.springframework.web.bind.annotation.CrossOrigin;
32+
import org.springframework.web.bind.annotation.RequestParam;
33+
34+
/**
35+
* This class represents the REST end-points for the query service. It can take
36+
* both query parameters and form parameters as criterias.
37+
*/
38+
@Component
39+
@CrossOrigin
40+
@Api(value = "query", description = "REST end-points for the freestyle query service")
41+
public class QueryControllerImpl implements QueryController {
42+
43+
private static final Logger LOGGER = (Logger) LoggerFactory.getLogger(QueryControllerImpl.class);
44+
45+
@Autowired
46+
private ProcessQueryParams processQueryParams;
47+
48+
private JSONArray result = null;
49+
50+
@Override
51+
@CrossOrigin
52+
@ApiOperation(value = "")
53+
public ResponseEntity<?> updateQuery(@RequestParam(value = "request") String request) {
54+
try {
55+
result = processQueryParams.filterFormParam(new ObjectMapper().readTree(request));
56+
} catch (Exception e) {
57+
LOGGER.error(e.getMessage());
58+
}
59+
return new ResponseEntity(result.toString(), HttpStatus.OK);
60+
}
61+
62+
@Override
63+
@CrossOrigin
64+
@ApiOperation(value = "")
65+
public ResponseEntity<?> getQuery(@RequestParam(value = "request") final String request) {
66+
try {
67+
result = processQueryParams.filterQueryParam(request);
68+
} catch (Exception e) {
69+
LOGGER.error(e.getMessage());
70+
}
71+
LOGGER.debug("Final Output : " + result.toString());
72+
return new ResponseEntity(result.toString(), HttpStatus.OK);
73+
}
74+
}

src/main/java/com/ericsson/ei/controller/MissedNotificationController.java renamed to src/main/java/com/ericsson/ei/controller/QueryMissedNotificationController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
*
1616
*/
1717
@RestController
18-
@RequestMapping(value = "/query/missedNotifications", produces = "application/json")
19-
public interface MissedNotificationController {
18+
@RequestMapping(value = "/queryMissedNotifications", produces = "application/json")
19+
public interface QueryMissedNotificationController {
2020

2121

2222
/**

src/main/java/com/ericsson/ei/controller/MissedNotificationControllerImpl.java renamed to src/main/java/com/ericsson/ei/controller/QueryMissedNotificationControllerImpl.java

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

16-
import java.util.ArrayList;
17-
import java.util.List;
18-
16+
import com.ericsson.ei.controller.model.QueryResponse;
17+
import com.ericsson.ei.queryservice.ProcessMissedNotification;
1918
import org.slf4j.Logger;
2019
import org.slf4j.LoggerFactory;
2120
import org.springframework.beans.factory.annotation.Autowired;
@@ -25,35 +24,34 @@
2524
import org.springframework.web.bind.annotation.CrossOrigin;
2625
import org.springframework.web.bind.annotation.RequestParam;
2726

28-
import com.ericsson.ei.controller.model.QueryResponse;
29-
import com.ericsson.ei.queryservice.ProcessMissedNotification;
27+
import java.util.List;
3028

3129
/**
3230
* This class represents the REST GET mechanism to extract the aggregated data
3331
* on the basis of the SubscriptionName from the Missed Notification Object.
34-
*
3532
*/
3633
@Component
3734
@CrossOrigin
38-
public class MissedNotificationControllerImpl implements MissedNotificationController {
35+
public class QueryMissedNotificationControllerImpl implements QueryMissedNotificationController {
3936

40-
static Logger log = (Logger) LoggerFactory.getLogger(MissedNotificationControllerImpl.class);
37+
private final static Logger LOGGER = (Logger) LoggerFactory.getLogger(QueryMissedNotificationControllerImpl.class);
4138

4239
@Autowired
4340
private ProcessMissedNotification processMissedNotification;
4441

4542
/**
4643
* This method is responsible for the REST GET mechanism to extract the data on
4744
* the basis of the SubscriptionName from the Missed Notification Object.
48-
*
45+
*
4946
* @param subscriptionName
5047
* @return ResponseEntity
5148
*/
52-
public ResponseEntity<QueryResponse> getQueryMissedNotifications(
53-
@RequestParam("SubscriptionName") final String subscriptionName) {
49+
public ResponseEntity<QueryResponse> getQueryMissedNotifications(@RequestParam("SubscriptionName") final String subscriptionName) {
50+
QueryResponse queryResponse = new QueryResponse();
5451
List<String> response = processMissedNotification.processQueryMissedNotification(subscriptionName);
55-
log.info("The response is : " + response.toString());
56-
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);
5755
}
5856

5957
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
2+
package com.ericsson.ei.controller.model;
3+
4+
import java.util.HashMap;
5+
import java.util.Map;
6+
import com.fasterxml.jackson.annotation.JsonAnyGetter;
7+
import com.fasterxml.jackson.annotation.JsonAnySetter;
8+
import com.fasterxml.jackson.annotation.JsonIgnore;
9+
import com.fasterxml.jackson.annotation.JsonInclude;
10+
import com.fasterxml.jackson.annotation.JsonProperty;
11+
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
12+
import org.apache.commons.lang3.builder.EqualsBuilder;
13+
import org.apache.commons.lang3.builder.HashCodeBuilder;
14+
import org.apache.commons.lang3.builder.ToStringBuilder;
15+
16+
@JsonInclude(JsonInclude.Include.NON_NULL)
17+
@JsonPropertyOrder({
18+
"formkey",
19+
"formvalue"
20+
})
21+
public class NotificationMessageKeyValue {
22+
23+
@JsonProperty("formkey")
24+
private String formkey;
25+
@JsonProperty("formvalue")
26+
private String formvalue;
27+
@JsonIgnore
28+
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
29+
30+
@JsonProperty("formkey")
31+
public String getFormkey() {
32+
return formkey;
33+
}
34+
35+
@JsonProperty("formkey")
36+
public void setFormkey(String formkey) {
37+
this.formkey = formkey;
38+
}
39+
40+
@JsonProperty("formvalue")
41+
public String getFormvalue() {
42+
return formvalue;
43+
}
44+
45+
@JsonProperty("formvalue")
46+
public void setFormvalue(String formvalue) {
47+
this.formvalue = formvalue;
48+
}
49+
50+
@Override
51+
public String toString() {
52+
return ToStringBuilder.reflectionToString(this);
53+
}
54+
55+
@JsonAnyGetter
56+
public Map<String, Object> getAdditionalProperties() {
57+
return this.additionalProperties;
58+
}
59+
60+
@JsonAnySetter
61+
public void setAdditionalProperty(String name, Object value) {
62+
this.additionalProperties.put(name, value);
63+
}
64+
65+
@Override
66+
public int hashCode() {
67+
return new HashCodeBuilder().append(formkey).append(formvalue).append(additionalProperties).toHashCode();
68+
}
69+
70+
@Override
71+
public boolean equals(Object other) {
72+
if (other == this) {
73+
return true;
74+
}
75+
if ((other instanceof NotificationMessageKeyValue) == false) {
76+
return false;
77+
}
78+
NotificationMessageKeyValue rhs = ((NotificationMessageKeyValue) other);
79+
return new EqualsBuilder().append(formkey, rhs.formkey).append(formvalue, rhs.formvalue).append(additionalProperties, rhs.additionalProperties).isEquals();
80+
}
81+
82+
}

0 commit comments

Comments
 (0)