@Override public void tearDownRepository() throws Exception { server.stop(); super.tearDownRepository(); }
repo = createRepository(); try { Subject s1 = repo.lookup("sub1");
@Test public void testWriteCloseRead() throws Exception { try { repo.register("sub1", null).register("sc1"); repo.register("sub2", null).register("sc2"); repo.register("sub2", null).register("sc3"); } finally { repo.close(); } // Calling close() and createRepository() is like bouncing the repo, to ensure its state persists. repo = createRepository(); try { Subject s1 = repo.lookup("sub1"); Assert.assertNotNull(s1); Subject s2 = repo.lookup("sub2"); Assert.assertNotNull(s2); SchemaEntry e1 = s1.lookupBySchema("sc1"); Assert.assertNotNull(e1); Assert.assertEquals("sc1", e1.getSchema()); SchemaEntry e2 = s2.lookupBySchema("sc2"); Assert.assertNotNull(e2); Assert.assertEquals("sc2", e2.getSchema()); SchemaEntry e3 = s2.lookupBySchema("sc3"); Assert.assertNotNull(e3); Assert.assertEquals("sc3", e3.getSchema()); } finally { repo.close(); } }