Skip to content

Commit 16648af

Browse files
author
Vasile Baluta
committed
fix ObjectHandlerTest
1 parent 33d80bb commit 16648af

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

src/main/java/com/ericsson/ei/subscriptionhandler/SubscriptionHandler.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import com.fasterxml.jackson.databind.ObjectMapper;
2020
import com.fasterxml.jackson.databind.node.ArrayNode;
2121
import lombok.Getter;
22+
import lombok.Setter;
23+
2224
import org.slf4j.Logger;
2325
import org.slf4j.LoggerFactory;
2426
import org.springframework.beans.factory.annotation.Autowired;
@@ -32,7 +34,8 @@
3234
/**
3335
* This class is responsible to take a aggregatedObject and match it with all
3436
* the Subscription Object, to check ALL Conditions/requirement for
35-
* notification. (AND between conditions in requirements, "OR" between requirements with conditions)
37+
* notification. (AND between conditions in requirements, "OR" between
38+
* requirements with conditions)
3639
*
3740
* @author xjibbal
3841
*/
@@ -53,8 +56,9 @@ public class SubscriptionHandler {
5356
@Autowired
5457
private InformSubscription informSubscription;
5558

59+
@Setter
5660
@Autowired
57-
private MongoDBHandler handler;
61+
private MongoDBHandler mongoDBHandler;
5862

5963
@Autowired
6064
private RunSubscription runSubscription;
@@ -71,7 +75,8 @@ public class SubscriptionHandler {
7175
*/
7276
public void checkSubscriptionForObject(final String aggregatedObject) {
7377
Thread subscriptionThread = new Thread(() -> {
74-
List<String> subscriptions = handler.getAllDocuments(subscriptionDataBaseName, subscriptionCollectionName);
78+
List<String> subscriptions = mongoDBHandler.getAllDocuments(subscriptionDataBaseName,
79+
subscriptionCollectionName);
7580
subscriptions.forEach(subscription -> extractConditions(aggregatedObject, subscription));
7681
});
7782
subscriptionThread.setName("SubscriptionHandler");
@@ -113,7 +118,7 @@ private void extractConditions(String aggregatedObject, String subscriptionData)
113118
public void print() {
114119
LOGGER.debug("SubscriptionDataBaseName : " + subscriptionDataBaseName);
115120
LOGGER.debug("SubscriptionCollectionName : " + subscriptionCollectionName);
116-
LOGGER.debug("MongoDBHandler object : " + handler);
121+
LOGGER.debug("MongoDBHandler object : " + mongoDBHandler);
117122
LOGGER.debug("JmesPathInterface : " + jmespath);
118123

119124
}

src/main/resources/application.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ server.port: 8090
77

88
rules.path: /ArtifactRules_new.json
99

10-
logging.level.root: INFO
10+
logging.level.root: OFF
1111
logging.level.org.springframework.web: INFO
1212
logging.level.com.ericsson.ei: INFO
1313

src/test/java/com/ericsson/ei/handlers/test/ObjectHandlerTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public void setUpEmbeddedMongo() throws Exception {
8383
public void init() throws Exception {
8484
setUpEmbeddedMongo();
8585
mongoDBHandler.setMongoClient(mongoClient);
86+
subscriptionHandler.setMongoDBHandler(mongoDBHandler);
8687
EventToObjectMapHandler eventToObjectMapHandler = mock(EventToObjectMapHandler.class);
8788
objHandler.setEventToObjectMap(eventToObjectMapHandler);
8889
objHandler.setMongoDbHandler(mongoDBHandler);

0 commit comments

Comments
 (0)