Supporting hybrid local + remote config

Change-Id: I2da729503fcbcaa2ae3e1ec99bc13bb046ef4f13
diff --git a/app/src/test/java/org/opencord/sadis/impl/SubscriberAndDeviceManagerTest.java b/app/src/test/java/org/opencord/sadis/impl/SubscriberAndDeviceManagerTest.java
index fa68966..1fbfbcd 100644
--- a/app/src/test/java/org/opencord/sadis/impl/SubscriberAndDeviceManagerTest.java
+++ b/app/src/test/java/org/opencord/sadis/impl/SubscriberAndDeviceManagerTest.java
@@ -86,6 +86,7 @@
 
     @Test
     public void testRemoteMode() throws Exception {
+
         BaseInformationService<SubscriberAndDeviceInformation> subscriberService = sadis.getSubscriberInfoService();
         config.init(subject, "sadis-remote-mode-test", node("/RemoteConfig.json"), mapper, delegate);
         configListener.event(event);
@@ -106,6 +107,8 @@
         config.init(subject, "sadis-remote-mode-test", node("/RemoteConfig.json"), mapper, delegate);
         configListener.event(event);
 
+        service.clearLocalData();
+
         checkGetForExisting(ID3, null, service);
         checkGetForNonExist(ID1, service);
 
@@ -116,6 +119,23 @@
         checkGetForNonExist(ID3, service);
     }
 
+    // test the hybrid mode (both local and remote data in the config)
+    // ids 1 and 2 are local, others are remote
+    @Test
+    public void testHybridMode() throws Exception {
+        BaseInformationService<SubscriberAndDeviceInformation> subscriberService = sadis.getSubscriberInfoService();
+        config.init(subject, "sadis-hybrid-mode-test", node("/HybridSubConfig.json"), mapper, delegate);
+        configListener.event(event);
+
+        // check that I can fetch from remote
+        checkGetForExisting(ID3, entry3, subscriberService);
+        checkGetForExisting(ID4, entry4, subscriberService);
+
+        // check that I can fetch from local
+        checkGetForExisting(ID1, entry1, subscriberService);
+        checkGetForExisting(ID2, entry2, subscriberService);
+    }
+
     public boolean checkEquality(BaseInformation localEntry, BaseInformation entry) {
         SubscriberAndDeviceInformation sub = (SubscriberAndDeviceInformation) localEntry;
         SubscriberAndDeviceInformation other = (SubscriberAndDeviceInformation) localEntry;
diff --git a/app/src/test/resources/HybridSubConfig.json b/app/src/test/resources/HybridSubConfig.json
new file mode 100644
index 0000000..e88a414
--- /dev/null
+++ b/app/src/test/resources/HybridSubConfig.json
@@ -0,0 +1,84 @@
+{
+	"integration":
+	{
+		"url": "file:src/test/resources/%s",
+		"cache":
+		{
+			"maxsize": 50,
+			"ttl": "PT1m"
+		}
+	},
+
+	"entries":
+	[
+		{
+			"id": "1",
+			"nasPortId": "1/1/2",
+			"uplinkPort": 125,
+			"slot": 3,
+			"hardwareIdentifier": "aa:bb:cc:dd:ee:ff",
+			"ipAddress":"10.10.10.10",
+			"nasId":"XXX-NASID",
+			"circuitId":"circuit123",
+			"remoteId":"remote123",
+			"uniTagList": [
+				{
+					"uniTagMatch":100,
+					"ponCTag":"2,",
+					"ponSTag":"2",
+					"usPonCTagPriority":0,
+					"usPonSTagPriority":1,
+					"dsPonCTagPriority":0,
+					"dsPonSTagPriority":1,
+					"technologyProfileId":64,
+					"upstreamBandwidthProfile":"HSA",
+					"downstreamBandwidthProfile":"HSA",
+					"serviceName":"HSIA"
+				}
+			]
+		},
+
+		{
+			"id": "2",
+			"nasPortId": "1/1/2",
+			"uplinkPort": 129,
+			"slot": 4,
+			"hardwareIdentifier": "aa:bb:cc:dd:ee:ff",
+			"ipAddress":"1.1.1.1",
+			"nasId":"YYY-NASID",
+			"circuitId":"circuit234",
+			"remoteId":"remote234",
+			"uniTagList": [
+				{
+					"uniTagMatch":100,
+					"ponCTag":"2,",
+					"ponSTag":"2",
+					"usPonCTagPriority":0,
+					"usPonSTagPriority":1,
+					"dsPonCTagPriority":0,
+					"dsPonSTagPriority":1,
+					"technologyProfileId":64,
+					"upstreamBandwidthProfile":"HSA",
+					"downstreamBandwidthProfile":"HSA",
+					"serviceName":"HSIA"
+				},
+				{
+					"uniTagMatch":200,
+					"ponCTag":3,
+					"ponSTag":2,
+					"usPonCTagPriority":0,
+					"usPonSTagPriority":1,
+					"dsPonCTagPriority": 0,
+					"dsPonSTagPriority": 1,
+					"technologyProfileId":65,
+					"upstreamBandwidthProfile":"IPTV",
+					"downstreamBandwidthProfile":"IPTV",
+					"serviceName":"IPTV",
+					"isIgmpRequired": "true",
+					"isDhcpRequired": "true",
+					"configuredMacAddress": "\"ff:aa:dd:cc:bb:ee\""
+				}
+			]
+		}
+	]
+}