ConfigurationStore implements IvoryService { public synchronized void publish(EntityType type, Entity entity) throws IvoryException { try { if (get(type, entity.getName()) == null) { persist(type, entity); dictionary.get(type).put(entity.getName(), entity); onAdd(entity); } else { throw new EntityAlreadyExistsException(entity.toShortString() + " already registered with configuration store. " + "Can't be submitted again. Try removing before submitting."); } } catch (IOException e) { throw new StoreAccessException(e); } AUDIT.info(type + "/" + entity.getName() + " is published into config store"); } @SuppressWarnings("unchecked") private  ConfigurationStore(); static ConfigurationStore get(); @Override void init(); void registerListener(ConfigurationChangeListener listener); synchronized void publish(EntityType type, Entity entity); synchronized void rollbackUpdate(EntityType type, Entity entity); synchronized void update(EntityType type, Entity entity); synchronized void initiateUpdate(Entity entity); @SuppressWarnings("unchecked") T get(EntityType type, String name); Collection<String> getEntities(EntityType type); boolean remove(EntityType type, String name); Entity[] search(EntityType type, String... keywords); void cleanupUpdateInit(); @Override String getName(); @Override void destroy();  }
@Test public void testPublish() throws Exception { Process process = new Process(); process.setName("hello"); store.publish(EntityType.PROCESS, process); Process p = store.get(EntityType.PROCESS, "hello"); Assert.assertEquals(p, process); }