endTransaction();
startNewTransaction();
// create a new store
DataStoreInfo store = catalog.getFactory().createDataStore();
store.setWorkspace(ws);
store.setName("dataStore");
store.setDescription("store description");
store.setEnabled(true);
store.getConnectionParameters().put("param1", "value1");
store.getConnectionParameters().put("param2", new Integer(2));
store.getMetadata().put("1", "one");
store.getMetadata().put("2", "two");
assertEquals("one", store.getMetadata().get("1"));
catalog.add(store);
assertEquals("one", store.getMetadata().get("1"));
endTransaction();
assertEquals("one", store.getMetadata().get("1"));
startNewTransaction();
Iterator<DataStoreInfo> stores = catalog.getDataStores().iterator();
assertTrue("Datastore not properly stored.", stores.hasNext());
store = catalog.getDataStore(store.getId());
assertEquals("dataStore", store.getName());
assertEquals("store description", store.getDescription());
assertTrue(store.isEnabled());
assertEquals("value1", store.getConnectionParameters().get("param1"));
assertEquals(new Integer(2), store.getConnectionParameters().get("param2"));
assertEquals("one", store.getMetadata().get("1"));
assertEquals("two", store.getMetadata().get("2"));
}