Search in sources :

Example 46 with Group

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

the class HostedMetadataRemergedOnPathPromoteSnapshotTest method setupRepos.

@Before
public void setupRepos() throws IndyClientException {
    String message = "test setup";
    a = new HostedRepository(PKG_TYPE_MAVEN, HOSTED_A_NAME);
    a.setAllowSnapshots(true);
    a = client.stores().create(a, message, HostedRepository.class);
    b = new HostedRepository(PKG_TYPE_MAVEN, HOSTED_B_NAME);
    b.setAllowSnapshots(true);
    b = client.stores().create(b, message, HostedRepository.class);
    g = client.stores().create(new Group(PKG_TYPE_MAVEN, GROUP_G_NAME, a.getKey()), message, Group.class);
    aPomPath = POM_PATH_TEMPLATE.replaceAll("%version%", A_VERSION);
    aPomContent = POM_CONTENT_TEMPLATE.replaceAll("%version%", A_VERSION);
    client.content().store(a.getKey(), aPomPath, new ByteArrayInputStream(aPomContent.getBytes()));
    aPreContent = REPO_CONTENT_TEMPLATE.replaceAll("%version%", A_VERSION);
    client.content().store(a.getKey(), PATH, new ByteArrayInputStream(aPreContent.getBytes()));
    // 
    bPomPath = POM_PATH_TEMPLATE.replaceAll("%version%", B_VERSION);
    bPomContent = POM_CONTENT_TEMPLATE.replaceAll("%version%", B_VERSION);
    client.content().store(b.getKey(), bPomPath, new ByteArrayInputStream(bPomContent.getBytes()));
    bContent = REPO_CONTENT_TEMPLATE.replaceAll("%version%", B_VERSION);
    client.content().store(b.getKey(), PATH, new ByteArrayInputStream(bContent.getBytes()));
}
Also used : Group(org.commonjava.indy.model.core.Group) ByteArrayInputStream(java.io.ByteArrayInputStream) HostedRepository(org.commonjava.indy.model.core.HostedRepository) Before(org.junit.Before)

Example 47 with Group

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

the class PromoteWithExcludeFilterTest method setupRepos.

@Before
@Override
public void setupRepos() throws Exception {
    String changelog = "Setup " + name.getMethodName();
    // create b1
    b1 = new HostedRepository(MavenPackageTypeDescriptor.MAVEN_PKG_KEY, "b1");
    client.stores().create(b1, changelog, HostedRepository.class);
    // store pom 1.0 to b1
    client.content().store(b1.getKey(), POM_PATH_TEMPLATE.replace("%version%", "1.0"), new ByteArrayInputStream(POM_CONTENT_TEMPLATE.replace("%version%", "1.0").getBytes()));
    // create target
    target = new HostedRepository(MavenPackageTypeDescriptor.MAVEN_PKG_KEY, "target");
    client.stores().create(target, changelog, HostedRepository.class);
    // create g1
    g1 = new Group(MavenPackageTypeDescriptor.MAVEN_PKG_KEY, "build-1", b1.getKey(), target.getKey());
    client.stores().create(g1, changelog, Group.class);
    // create b2
    b2 = new HostedRepository(MavenPackageTypeDescriptor.MAVEN_PKG_KEY, "b2");
    client.stores().create(b2, changelog, HostedRepository.class);
    // store pom 2.0 to b2
    client.content().store(b2.getKey(), POM_PATH_TEMPLATE.replace("%version%", "2.0"), new ByteArrayInputStream(POM_CONTENT_TEMPLATE.replace("%version%", "2.0").getBytes()));
    gBuilds = new Group(MavenPackageTypeDescriptor.MAVEN_PKG_KEY, "g-builds", target.getKey());
    client.stores().create(gBuilds, changelog, Group.class);
}
Also used : Group(org.commonjava.indy.model.core.Group) ByteArrayInputStream(java.io.ByteArrayInputStream) HostedRepository(org.commonjava.indy.model.core.HostedRepository) Before(org.junit.Before)

Example 48 with Group

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

the class NoPreExistingPaths_RuleTest method start.

@Override
public void start() throws Throwable {
    super.start();
    otherSource = new HostedRepository("otherSource");
    otherSource = client.stores().create(otherSource, "Creating secondary content source", HostedRepository.class);
    other = new Group("other", otherSource.getKey());
    other = client.stores().create(other, "Creating secondary content group", Group.class);
    Logger logger = LoggerFactory.getLogger(getClass());
    logger.info("{} contains members: {}", other, other.getConstituents());
}
Also used : Group(org.commonjava.indy.model.core.Group) Logger(org.slf4j.Logger) HostedRepository(org.commonjava.indy.model.core.HostedRepository)

Example 49 with Group

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

the class CassandraStoreDataManager method toExtra.

private Map<String, String> toExtra(ArtifactStore store) {
    Map<String, String> extras = new HashMap<>();
    if (store instanceof AbstractRepository) {
        AbstractRepository repository = (AbstractRepository) store;
        putValueIntoExtra(CassandraStoreUtil.ALLOW_SNAPSHOTS, repository.isAllowSnapshots(), extras);
        putValueIntoExtra(CassandraStoreUtil.ALLOW_RELEASES, repository.isAllowReleases(), extras);
    }
    if (store instanceof HostedRepository) {
        HostedRepository hostedRepository = (HostedRepository) store;
        putValueIntoExtra(CassandraStoreUtil.STORAGE, hostedRepository.getStorage(), extras);
        putValueIntoExtra(CassandraStoreUtil.READONLY, hostedRepository.isReadonly(), extras);
        putValueIntoExtra(CassandraStoreUtil.SNAPSHOT_TIMEOUT_SECONDS, hostedRepository.getSnapshotTimeoutSeconds(), extras);
    }
    if (store instanceof RemoteRepository) {
        RemoteRepository remoteRepository = (RemoteRepository) store;
        putValueIntoExtra(CassandraStoreUtil.URL, remoteRepository.getUrl(), extras);
        putValueIntoExtra(CassandraStoreUtil.HOST, remoteRepository.getHost(), extras);
        putValueIntoExtra(CassandraStoreUtil.PORT, remoteRepository.getPort(), extras);
        putValueIntoExtra(CassandraStoreUtil.USER, remoteRepository.getUser(), extras);
        putValueIntoExtra(CassandraStoreUtil.PASSWORD, remoteRepository.getPassword(), extras);
        putValueIntoExtra(CassandraStoreUtil.PROXY_HOST, remoteRepository.getProxyHost(), extras);
        putValueIntoExtra(CassandraStoreUtil.PROXY_PORT, remoteRepository.getProxyPort(), extras);
        putValueIntoExtra(CassandraStoreUtil.PROXY_USER, remoteRepository.getProxyUser(), extras);
        putValueIntoExtra(CassandraStoreUtil.PROXY_PASSWORD, remoteRepository.getProxyPassword(), extras);
        putValueIntoExtra(CassandraStoreUtil.KEY_CERT_PEM, remoteRepository.getKeyCertPem(), extras);
        putValueIntoExtra(CassandraStoreUtil.KEY_PASSWORD, remoteRepository.getKeyPassword(), extras);
        putValueIntoExtra(CassandraStoreUtil.SERVER_CERT_PEM, remoteRepository.getServerCertPem(), extras);
        putValueIntoExtra(CassandraStoreUtil.PREFETCH_RESCAN_TIMESTAMP, remoteRepository.getPrefetchRescanTimestamp(), extras);
        putValueIntoExtra(CassandraStoreUtil.METADATA_TIMEOUT_SECONDS, remoteRepository.getMetadataTimeoutSeconds(), extras);
        putValueIntoExtra(CassandraStoreUtil.CACHE_TIMEOUT_SECONDS, remoteRepository.getCacheTimeoutSeconds(), extras);
        putValueIntoExtra(CassandraStoreUtil.TIMEOUT_SECONDS, remoteRepository.getTimeoutSeconds(), extras);
        putValueIntoExtra(CassandraStoreUtil.MAX_CONNECTIONS, remoteRepository.getMaxConnections(), extras);
        putValueIntoExtra(CassandraStoreUtil.NFC_TIMEOUT_SECONDS, remoteRepository.getNfcTimeoutSeconds(), extras);
        putValueIntoExtra(CassandraStoreUtil.PASS_THROUGH, remoteRepository.isPassthrough(), extras);
        putValueIntoExtra(CassandraStoreUtil.PREFETCH_RESCAN, remoteRepository.isPrefetchRescan(), extras);
        putValueIntoExtra(CassandraStoreUtil.IGNORE_HOST_NAME_VERIFICATION, remoteRepository.isIgnoreHostnameVerification(), extras);
    }
    if (store instanceof Group) {
        Group group = (Group) store;
        putValueIntoExtra(CassandraStoreUtil.CONSTITUENTS, group.getConstituents(), extras);
        putValueIntoExtra(CassandraStoreUtil.PREPEND_CONSTITUENT, group.isPrependConstituent(), extras);
    }
    return extras;
}
Also used : Group(org.commonjava.indy.model.core.Group) HashMap(java.util.HashMap) AbstractRepository(org.commonjava.indy.model.core.AbstractRepository) RemoteRepository(org.commonjava.indy.model.core.RemoteRepository) HostedRepository(org.commonjava.indy.model.core.HostedRepository)

Example 50 with Group

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

the class StoreDataSetupAction method start.

@Override
public void start() throws IndyLifecycleException {
    final ChangeSummary summary = new ChangeSummary(ChangeSummary.SYSTEM_USER, "Initializing default data.");
    try {
        logger.info("Verfiying that Indy basic stores are installed...");
        storeManager.install();
        if (storeManager.query().getRemoteRepository(MAVEN_PKG_KEY, "central") == null) {
            final RemoteRepository central = new RemoteRepository(MAVEN_PKG_KEY, "central", "https://repo.maven.apache.org/maven2/");
            central.setCacheTimeoutSeconds(86400);
            storeManager.storeArtifactStore(central, summary, true, true, new EventMetadata().set(StoreDataManager.EVENT_ORIGIN, DEFAULT_SETUP));
        }
        if (storeManager.query().getHostedRepository(MAVEN_PKG_KEY, "local-deployments") == null) {
            final HostedRepository local = new HostedRepository(MAVEN_PKG_KEY, "local-deployments");
            local.setAllowReleases(true);
            local.setAllowSnapshots(true);
            local.setSnapshotTimeoutSeconds(86400);
            storeManager.storeArtifactStore(local, summary, true, true, new EventMetadata().set(StoreDataManager.EVENT_ORIGIN, DEFAULT_SETUP));
        }
        if (storeManager.query().getGroup(MAVEN_PKG_KEY, "public") == null) {
            final Group pub = new Group(MAVEN_PKG_KEY, "public");
            pub.addConstituent(new StoreKey(MAVEN_PKG_KEY, StoreType.remote, "central"));
            pub.addConstituent(new StoreKey(MAVEN_PKG_KEY, StoreType.hosted, "local-deployments"));
            storeManager.storeArtifactStore(pub, summary, true, true, new EventMetadata().set(StoreDataManager.EVENT_ORIGIN, DEFAULT_SETUP));
        }
    } catch (final IndyDataException e) {
        throw new RuntimeException("Failed to boot indy components: " + e.getMessage(), e);
    }
}
Also used : IndyDataException(org.commonjava.indy.data.IndyDataException) Group(org.commonjava.indy.model.core.Group) RemoteRepository(org.commonjava.indy.model.core.RemoteRepository) ChangeSummary(org.commonjava.indy.audit.ChangeSummary) StoreKey(org.commonjava.indy.model.core.StoreKey) EventMetadata(org.commonjava.maven.galley.event.EventMetadata) HostedRepository(org.commonjava.indy.model.core.HostedRepository)

Aggregations

Group (org.commonjava.indy.model.core.Group)211 Test (org.junit.Test)111 HostedRepository (org.commonjava.indy.model.core.HostedRepository)89 RemoteRepository (org.commonjava.indy.model.core.RemoteRepository)82 StoreKey (org.commonjava.indy.model.core.StoreKey)76 ByteArrayInputStream (java.io.ByteArrayInputStream)67 InputStream (java.io.InputStream)62 IndyDataException (org.commonjava.indy.data.IndyDataException)44 AbstractContentManagementTest (org.commonjava.indy.ftest.core.AbstractContentManagementTest)42 ArtifactStore (org.commonjava.indy.model.core.ArtifactStore)42 Transfer (org.commonjava.maven.galley.model.Transfer)31 EventMetadata (org.commonjava.maven.galley.event.EventMetadata)30 Logger (org.slf4j.Logger)30 Before (org.junit.Before)29 StoreDataManager (org.commonjava.indy.data.StoreDataManager)27 ConcreteResource (org.commonjava.maven.galley.model.ConcreteResource)27 HashSet (java.util.HashSet)26 ArrayList (java.util.ArrayList)25 List (java.util.List)22 IndyWorkflowException (org.commonjava.indy.IndyWorkflowException)22