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()));
}
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);
}
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());
}
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;
}
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);
}
}
Aggregations