use of org.commonjava.indy.model.core.HostedRepository in project indy by Commonjava.
the class NoPreExistingPaths_GroupWithOneOfTwoHosts_RuleTest method start.
@Override
public void start() throws Throwable {
super.start();
hostTarget1 = new HostedRepository("hostTarget1");
hostTarget1 = client.stores().create(hostTarget1, "Creating first host target", HostedRepository.class);
hostTarget2 = new HostedRepository("hostTarget2");
hostTarget2 = client.stores().create(hostTarget2, "Creating secondary host target", HostedRepository.class);
}
use of org.commonjava.indy.model.core.HostedRepository 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.HostedRepository 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.HostedRepository 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);
}
}
use of org.commonjava.indy.model.core.HostedRepository in project indy by Commonjava.
the class DefaultDownloadManagerTest method getTransferFromNotAllowedDeletionStore_DownloadOp_ThrowException.
@Test(expected = IOException.class)
public void getTransferFromNotAllowedDeletionStore_DownloadOp_ThrowException() throws Exception {
ChangeSummary summary = new ChangeSummary(ChangeSummary.SYSTEM_USER, "Test setup");
HostedRepository hosted = new HostedRepository(MAVEN_PKG_KEY, "one");
hosted.setReadonly(true);
storeManager.storeArtifactStore(hosted, summary, false, true, new EventMetadata());
String originalString = "This is a test";
final String path = "/path/path";
Transfer transfer = downloadManager.getStorageReference(hosted, path, TransferOperation.DOWNLOAD);
try (OutputStream out = transfer.openOutputStream(TransferOperation.UPLOAD)) {
out.write(originalString.getBytes());
}
assertThat(transfer.exists(), equalTo(true));
transfer.delete();
}
Aggregations