use of org.apache.qpid.server.store.preferences.PreferenceRecordImpl in project qpid-broker-j by apache.
the class BDBPreferenceStoreTest method testUpdateOrCreate.
public void testUpdateOrCreate() throws Exception {
_preferenceStore.openAndLoad(_updater);
PreferenceRecord oldRecord = _testInitialRecords.get(0);
Collection<PreferenceRecord> records = Arrays.<PreferenceRecord>asList(new PreferenceRecordImpl(oldRecord.getId(), Collections.<String, Object>singletonMap("name", "test2")), new PreferenceRecordImpl(UUID.randomUUID(), Collections.<String, Object>singletonMap("name", "test3")));
_preferenceStore.updateOrCreate(records);
_preferenceStore.close();
Collection<PreferenceRecord> recovered = _preferenceStore.openAndLoad(_updater);
List<PreferenceRecord> expected = new ArrayList<>(records);
expected.add(_testInitialRecords.get(1));
PreferenceTestHelper.assertRecords(expected, recovered);
}
use of org.apache.qpid.server.store.preferences.PreferenceRecordImpl in project qpid-broker-j by apache.
the class DerbyPreferenceStoreTest method testReplace.
public void testReplace() throws Exception {
populateTestData();
_preferenceStore.openAndLoad(_updater);
Collection<PreferenceRecord> testRecords = new ArrayList<>();
testRecords.add(new PreferenceRecordImpl(UUID.randomUUID(), Collections.<String, Object>singletonMap("name", "newOne")));
_preferenceStore.replace(Collections.singleton(_testRecords.get(0).getId()), testRecords);
testRecords.add(_testRecords.get(1));
_testConnection = DriverManager.getConnection(_connectionUrl);
List<PreferenceRecord> records = getPreferenceRecords();
assertRecords(testRecords, records);
}
Aggregations