Search in sources :

Example 51 with StoreType

use of org.commonjava.indy.model.core.StoreType in project indy by Commonjava.

the class AffectedStoreRecordTest method dontRecordNullUpload.

@Test
public void dontRecordNullUpload() throws Exception {
    final StoreType type = StoreType.group;
    final String name = "test-group";
    final AffectedStoreRecord record = new AffectedStoreRecord(new StoreKey(type, name));
    record.add(null, StoreEffect.UPLOAD);
    assertThat(record.getUploadedPaths(), nullValue());
}
Also used : StoreType(org.commonjava.indy.model.core.StoreType) StoreKey(org.commonjava.indy.model.core.StoreKey) Test(org.junit.Test)

Example 52 with StoreType

use of org.commonjava.indy.model.core.StoreType in project indy by Commonjava.

the class AffectedStoreRecordTest method dontRecordNullDownload.

@Test
public void dontRecordNullDownload() throws Exception {
    final StoreType type = StoreType.group;
    final String name = "test-group";
    final AffectedStoreRecord record = new AffectedStoreRecord(new StoreKey(type, name));
    record.add(null, StoreEffect.DOWNLOAD);
    assertThat(record.getDownloadedPaths(), nullValue());
}
Also used : StoreType(org.commonjava.indy.model.core.StoreType) StoreKey(org.commonjava.indy.model.core.StoreKey) Test(org.junit.Test)

Example 53 with StoreType

use of org.commonjava.indy.model.core.StoreType in project indy by Commonjava.

the class MemoryArtifactStoreQuery method recurseGroup.

private void recurseGroup(final Group master, final Map<StoreKey, ArtifactStore> stores, final List<ArtifactStore> result, final Set<StoreKey> seen, final boolean includeGroups, final boolean recurseGroups) {
    if (master == null || master.isDisabled() && enabled) {
        return;
    }
    List<StoreKey> members = new ArrayList<>(master.getConstituents());
    if (includeGroups) {
        result.add(master);
    }
    members.forEach((key) -> {
        if (!seen.contains(key)) {
            seen.add(key);
            final StoreType type = key.getType();
            if (recurseGroups && type == StoreType.group) {
                // if we're here, we're definitely recursing groups...
                recurseGroup((Group) stores.get(key), stores, result, seen, includeGroups, true);
            } else {
                final ArtifactStore store = stores.get(key);
                if (store != null && !(store.isDisabled() && enabled)) {
                    result.add(store);
                }
            }
        }
    });
}
Also used : StoreType(org.commonjava.indy.model.core.StoreType) ArtifactStore(org.commonjava.indy.model.core.ArtifactStore) ArrayList(java.util.ArrayList) StoreKey(org.commonjava.indy.model.core.StoreKey)

Aggregations

StoreType (org.commonjava.indy.model.core.StoreType)53 StoreKey (org.commonjava.indy.model.core.StoreKey)43 Response (javax.ws.rs.core.Response)25 IndyWorkflowException (org.commonjava.indy.IndyWorkflowException)25 ResponseUtils.formatResponse (org.commonjava.indy.bind.jaxrs.util.ResponseUtils.formatResponse)22 ApiOperation (io.swagger.annotations.ApiOperation)21 ApiResponse (io.swagger.annotations.ApiResponse)21 Path (javax.ws.rs.Path)19 ApiResponses (io.swagger.annotations.ApiResponses)18 ArtifactStore (org.commonjava.indy.model.core.ArtifactStore)18 IOException (java.io.IOException)13 GET (javax.ws.rs.GET)12 Produces (javax.ws.rs.Produces)12 List (java.util.List)10 Inject (javax.inject.Inject)10 DELETE (javax.ws.rs.DELETE)10 JoinString (org.commonjava.maven.atlas.ident.util.JoinString)10 ResponseUtils.markDeprecated (org.commonjava.indy.bind.jaxrs.util.ResponseUtils.markDeprecated)9 IndyDataException (org.commonjava.indy.data.IndyDataException)8 Transfer (org.commonjava.maven.galley.model.Transfer)8