use of org.sonatype.nexus.repository.content.store.example.TestContentRepositoryDAO in project nexus-public by sonatype.
the class SearchIndexUpgradeTest method testMigration.
@Test
public void testMigration() throws Exception {
try (Connection conn = store.openConnection()) {
underTest.migrate(conn);
}
try (DataSession<?> session = sessionRule.openSession(DEFAULT_DATASTORE_NAME)) {
TestContentRepositoryDAO dao = session.access(TestContentRepositoryDAO.class);
Optional<ContentRepository> foundHosted = dao.readContentRepository(hosted1Config.getId());
Optional<ContentRepository> foundProxy = dao.readContentRepository(proxyConfig.getId());
Optional<ContentRepository> foundGroup = dao.readContentRepository(groupConfig.getId());
assertTrue(isRepositoryMarked(foundHosted.get()));
assertTrue(isRepositoryMarked(foundProxy.get()));
assertFalse(isRepositoryMarked(foundGroup.get()));
// test that existing attributes are still there
Map<String, Object> fooAttrs = (Map<String, Object>) foundProxy.get().attributes().get("test");
assertEquals("3", fooAttrs.get("value"));
}
}
Aggregations