use of org.sonatype.nexus.repository.storage.Component in project nexus-repository-r by sonatype-nexus-community.
the class RHostedIT method testDeletingComponentDeletesAllAssociatedAssets.
@Test
public void testDeletingComponentDeletesAllAssociatedAssets() {
final Asset asset = findAsset(repository, AGRICOLAE_121_TARGZ.fullPath);
assertNotNull(asset);
assertNotNull(asset.componentId());
final Component component = findComponentById(repository, asset.componentId());
assertNotNull(component);
ComponentMaintenance maintenanceFacet = repository.facet(ComponentMaintenance.class);
maintenanceFacet.deleteComponent(component.getEntityMetadata().getId(), true);
assertThat(componentAssetTestHelper.assetExists(repository, AGRICOLAE_121_TARGZ.fullPath), is(false));
assertNull(findComponentById(repository, asset.componentId()));
}
use of org.sonatype.nexus.repository.storage.Component in project nexus-repository-r by sonatype-nexus-community.
the class RFacetUtilsTest method findNoComponents.
@Test
public void findNoComponents() throws Exception {
components.clear();
Component component = findComponent(tx, repository, "name", "version");
assertThat(component, is(equalTo(component)));
}
use of org.sonatype.nexus.repository.storage.Component in project nexus-repository-r by sonatype-nexus-community.
the class RFacetUtilsTest method returnFirstComponent.
@Test
public void returnFirstComponent() throws Exception {
Component component = findComponent(tx, repository, "name", "version", "group");
assertThat(component, is(notNullValue()));
}
use of org.sonatype.nexus.repository.storage.Component in project nexus-repository-r by sonatype-nexus-community.
the class RFacetUtilsTest method findNoComponents.
@Test
public void findNoComponents() throws Exception {
components.clear();
Component component = findComponent(tx, repository, "name", "version", "group");
assertThat(component, is(equalTo(component)));
}
use of org.sonatype.nexus.repository.storage.Component in project nexus-repository-r by sonatype-nexus-community.
the class RHostedFacetImpl method doPutArchive.
@TransactionalStoreBlob
protected Asset doPutArchive(final String path, final TempBlob archiveContent, final Payload payload) throws IOException {
StorageTx tx = UnitOfWork.currentTx();
RFacet rFacet = facet(RFacet.class);
Map<String, String> attributes;
try (InputStream is = archiveContent.get()) {
attributes = extractDescriptionFromArchive(path, is);
}
Component component = rFacet.findOrCreateComponent(tx, path, attributes);
Asset asset = rFacet.findOrCreateAsset(tx, component, path, attributes);
saveAsset(tx, asset, archiveContent, payload);
return asset;
}
Aggregations