use of org.commonjava.indy.model.core.HostedRepository in project indy by Commonjava.
the class ListStoresByTypeTest method listByType.
@Test
public void listByType() throws Exception {
final Set<ArtifactStore> hosteds = new HashSet<>();
for (int i = 0; i < 3; i++) {
final HostedRepository repo = new HostedRepository(newName());
assertThat(client.stores().create(repo, name.getMethodName(), HostedRepository.class), notNullValue());
hosteds.add(repo);
}
final Set<ArtifactStore> remotes = new HashSet<>();
for (int i = 0; i < 3; i++) {
final RemoteRepository repo = new RemoteRepository(newName(), newUrl());
assertThat(client.stores().create(repo, name.getMethodName(), RemoteRepository.class), notNullValue());
remotes.add(repo);
}
final Set<ArtifactStore> groups = new HashSet<>();
for (int i = 0; i < 3; i++) {
final Group repo = new Group(newName());
assertThat(client.stores().create(repo, name.getMethodName(), Group.class), notNullValue());
groups.add(repo);
}
// Now, start listing by type and verify that ONLY those of the given type are present
checkListing(client.stores().listHostedRepositories(), hosteds, Arrays.asList(remotes, groups));
checkListing(client.stores().listRemoteRepositories(), remotes, Arrays.asList(groups, hosteds));
checkListing(client.stores().listGroups(), groups, Arrays.asList(hosteds, remotes));
}
use of org.commonjava.indy.model.core.HostedRepository in project indy by Commonjava.
the class ArtifactRefs_DependencyInAnotherRepoInGroup_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", source.getKey(), 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 PomUploadListenerTest method run.
@Test
public void run() throws Exception {
final String repo1 = "repo1";
HostedRepository hosted1 = new HostedRepository(repo1);
client.stores().create(hosted1, "adding hosted", HostedRepository.class);
StoreKey key = new StoreKey(hosted, repo1);
InputStream stream = new ByteArrayInputStream(content.getBytes());
client.content().store(key, path, stream);
waitForEventPropagation();
boolean exists = client.content().exists(hosted, repo1, pathRel, true);
assertThat(exists, equalTo(true));
}
use of org.commonjava.indy.model.core.HostedRepository in project indy by Commonjava.
the class AbstractValidationRuleTest method start.
@Override
public void start() throws Throwable {
super.start();
module = client.module(IndyPromoteClientModule.class);
HostedRepository shr = new HostedRepository("source");
shr.setAllowSnapshots(true);
System.out.println("Validation rule test client:" + client);
System.out.println("Validation rule test client store:" + client.stores());
source = client.stores().create(shr, "creating test source", HostedRepository.class);
if (Group.class.equals(targetCls)) {
target = (T) client.stores().create(new Group(TARGET_NAME), "creating test target", Group.class);
} else if (HostedRepository.class.equals(targetCls)) {
HostedRepository hr = new HostedRepository(TARGET_NAME);
hr.setAllowSnapshots(true);
target = (T) client.stores().create(hr, "creating test target", HostedRepository.class);
} else {
throw new IllegalStateException(targetCls.getName() + " is not currently supported as promotion targets.");
}
}
use of org.commonjava.indy.model.core.HostedRepository in project indy by Commonjava.
the class AutoProxCalculationTest method jsonRoundTrip_HostedRepoCreation.
@Test
public void jsonRoundTrip_HostedRepoCreation() throws IOException {
HostedRepository repo = new HostedRepository("test");
AutoProxCalculation in = new AutoProxCalculation(repo, "test-rule.groovy");
IndyObjectMapper mapper = new IndyObjectMapper(true);
String json = mapper.writeValueAsString(in);
AutoProxCalculation out = mapper.readValue(json, AutoProxCalculation.class);
assertThat(out, notNullValue());
assertThat(out.getRuleName(), equalTo(in.getRuleName()));
assertThat(out.getStore(), equalTo(in.getStore()));
assertThat(out, equalTo(in));
}
Aggregations