@@ -0,0 +1,3216 @@
+package com.yahoo.omid.notifications;%0A%0Aimport static com.yahoo.omid.examples.Constants.COLUMN_1;%0Aimport static com.yahoo.omid.examples.Constants.COLUMN_FAMILY_1;%0Aimport static com.yahoo.omid.examples.Constants.TABLE_1;%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertTrue;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.when;%0A%0Aimport java.io.IOException;%0Aimport java.util.concurrent.CountDownLatch;%0Aimport java.util.concurrent.ExecutorService;%0Aimport java.util.concurrent.Executors;%0Aimport java.util.concurrent.TimeUnit;%0A%0Aimport org.apache.hadoop.hbase.client.Put;%0Aimport org.apache.hadoop.hbase.client.Result;%0Aimport org.apache.hadoop.hbase.util.Bytes;%0Aimport org.junit.After;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0Aimport com.netflix.curator.test.TestingServer;%0Aimport com.yahoo.omid.notifications.client.DeltaOmid;%0Aimport com.yahoo.omid.notifications.client.IncrementalApplication;%0Aimport com.yahoo.omid.notifications.client.Observer;%0Aimport com.yahoo.omid.notifications.conf.ClientConfiguration;%0Aimport com.yahoo.omid.transaction.TTable;%0Aimport com.yahoo.omid.transaction.Transaction;%0Aimport com.yahoo.omid.transaction.TransactionManager;%0A%0Apublic class TestMultipleInstances extends TestInfrastructure %7B%0A    private static Logger logger = LoggerFactory.getLogger(TestDeltaOmid.class);%0A    %0A    private class ObserverLatch implements Observer %7B%0A        CountDownLatch latch;%0A        ObserverLatch (CountDownLatch latch) %7B%0A            this.latch = latch;%0A        %7D%0A        @Override%0A        public void onInterestChanged(Result rowData, Transaction tx) throws IOException %7B%0A            latch.countDown();%0A        %7D%0A        @Override%0A        public String getName() %7B%0A            return %22obs%22;%0A        %7D%0A        @Override%0A        public Interest getInterest() %7B%0A            return new Interest(TABLE_1, COLUMN_FAMILY_1, COLUMN_1);%0A        %7D%0A        %0A    %7D%0A%0A    @Test%0A    public void testTwoInstances() throws Exception %7B%0A        byte%5B%5D value = Bytes.toBytes(%22value%22);%0A        CountDownLatch latch1 = new CountDownLatch(1);%0A        CountDownLatch latch2 = new CountDownLatch(1);%0A        final IncrementalApplication app1 = new DeltaOmid.AppBuilder(%22TestApp%22, 6666)%0A                .addObserver(new ObserverLatch(latch1)).build();%0A        final IncrementalApplication app2 = new DeltaOmid.AppBuilder(%22TestApp%22, 6667)%0A                .addObserver(new ObserverLatch(latch2)).build();%0A%0A        Thread.sleep(5000);%0A%0A        TransactionManager tm = new TransactionManager(hbaseConf);%0A        TTable tt = new TTable(hbaseConf, TestConstants.TABLE);%0A%0A        for (int i = 0; i %3C 200; ++i) %7B%0A            Transaction tx = tm.begin();%0A%0A            Put row = new Put(Bytes.toBytes(i));%0A            row.add(Bytes.toBytes(COLUMN_FAMILY_1), Bytes.toBytes(COLUMN_1), value);%0A            tt.put(tx, row);%0A%0A            tm.commit(tx);%0A        %7D%0A%0A        tt.close();%0A%0A        assertTrue(%22App1 didn't receive notifications%22, latch1.await(15, TimeUnit.SECONDS));%0A        assertTrue(%22App2 didn't receive notifications%22, latch2.await(15, TimeUnit.SECONDS));%0A%0A        app1.close();%0A        app2.close();%0A    %7D%0A%0A%7D%0A

Add test for multiple app instances