use of org.sonatype.nexus.repository.storage.BucketEntityAdapter in project nexus-public by sonatype.
the class RebuildBrowseNodesManagerTest method initializeDatabase.
private void initializeDatabase() throws Exception {
bucketEntityAdapter = new BucketEntityAdapter();
componentEntityAdapter = new ComponentEntityAdapter(bucketEntityAdapter, componentFactory, emptySet());
assetEntityAdapter = new AssetEntityAdapter(bucketEntityAdapter, componentEntityAdapter);
when(packageUrlService.getPackageUrl(anyString(), anyString(), anyString(), anyString())).thenReturn(Optional.empty());
browseNodeEntityAdapter = new BrowseNodeEntityAdapter(componentEntityAdapter, assetEntityAdapter, packageUrlService);
underTest = new RebuildBrowseNodesManager(databaseInstanceRule.getInstanceProvider(), taskScheduler, configuration, bucketEntityAdapter);
bucketEntityAdapter.register(databaseInstanceRule.getInstance().acquire());
componentEntityAdapter.register(databaseInstanceRule.getInstance().acquire());
assetEntityAdapter.register(databaseInstanceRule.getInstance().acquire());
browseNodeEntityAdapter.register(databaseInstanceRule.getInstance().acquire());
bucketEntityAdapter.enableObfuscation(new HexRecordIdObfuscator());
componentEntityAdapter.enableObfuscation(new HexRecordIdObfuscator());
assetEntityAdapter.enableObfuscation(new HexRecordIdObfuscator());
browseNodeEntityAdapter.enableObfuscation(new HexRecordIdObfuscator());
}
use of org.sonatype.nexus.repository.storage.BucketEntityAdapter in project nexus-public by sonatype.
the class OrientBrowseNodeStoreLoadTest method setUp.
@Before
public void setUp() throws Exception {
BrowseNodeConfiguration configuration = new BrowseNodeConfiguration(true, 1000, DELETE_PAGE_SIZE, 10_000, 10_000);
BucketEntityAdapter bucketEntityAdapter = new BucketEntityAdapter();
ComponentFactory componentFactory = new ComponentFactory(emptySet());
ComponentEntityAdapter componentEntityAdapter = new ComponentEntityAdapter(bucketEntityAdapter, componentFactory, emptySet());
AssetEntityAdapter assetEntityAdapter = new AssetEntityAdapter(bucketEntityAdapter, componentEntityAdapter);
when(packageUrlService.getPackageUrl(anyString(), anyString(), anyString(), anyString())).thenReturn(Optional.empty());
BrowseNodeEntityAdapter browseNodeEntityAdapter = new BrowseNodeEntityAdapter(componentEntityAdapter, assetEntityAdapter, packageUrlService);
try (ODatabaseDocumentTx db = database.getInstance().connect()) {
bucketEntityAdapter.register(db);
bucket = new Bucket();
bucket.setRepositoryName(REPOSITORY_NAME);
bucket.attributes(new NestedAttributesMap(P_ATTRIBUTES, new HashMap<>()));
bucketEntityAdapter.addEntity(db, bucket);
componentEntityAdapter.register(db);
component = new DefaultComponent().bucketId(EntityHelper.id(bucket)).format("test").group("test-group").name("test-component").version("1.0").attributes(new NestedAttributesMap(P_ATTRIBUTES, new HashMap<>()));
componentEntityAdapter.addEntity(db, component);
assetEntityAdapter.register(db);
for (int i = 0; i < ASSET_COUNT; i++) {
assets.add(new Asset().bucketId(EntityHelper.id(bucket)).format("test").name("test-asset-" + i).attributes(new NestedAttributesMap(P_ATTRIBUTES, new HashMap<>())));
assetEntityAdapter.addEntity(db, assets.get(i));
}
// registration of the schema is now done outside of the store
browseNodeEntityAdapter.register(db);
bucketEntityAdapter.register(db);
}
underTest = new OrientBrowseNodeStore(database.getInstanceProvider(), browseNodeEntityAdapter, securityHelper, selectorManager, configuration, new HashMap<>(), new HashMap<>(), ImmutableMap.of(DefaultBrowseNodeComparator.NAME, new DefaultBrowseNodeComparator(new VersionComparator())));
underTest.start();
}
use of org.sonatype.nexus.repository.storage.BucketEntityAdapter in project nexus-public by sonatype.
the class BrowseNodeEntityAdapterTest method setUp.
@Before
public void setUp() throws Exception {
bucketEntityAdapter = new BucketEntityAdapter();
ComponentFactory componentFactory = new ComponentFactory(emptySet());
componentEntityAdapter = new ComponentEntityAdapter(bucketEntityAdapter, componentFactory, emptySet());
assetEntityAdapter = new AssetEntityAdapter(bucketEntityAdapter, componentEntityAdapter);
packageUrlService = mock(PackageUrlService.class);
when(packageUrlService.getPackageUrl(anyString(), anyString(), anyString(), anyString())).thenReturn(Optional.empty());
underTest = new BrowseNodeEntityAdapter(componentEntityAdapter, assetEntityAdapter, packageUrlService);
try (ODatabaseDocumentTx db = database.getInstance().acquire()) {
bucketEntityAdapter.register(db);
componentEntityAdapter.register(db);
assetEntityAdapter.register(db);
underTest.register(db);
createEntities(db);
}
}
Aggregations