use of org.commonjava.indy.content.index.IndexedStorePath in project indy by Commonjava.
the class ContentIndexDirLvWithArtifactsTest method test.
@Test
public void test() throws Exception {
final String remoteName1 = newName();
RemoteRepository remote1 = new RemoteRepository(MAVEN_PKG_KEY, remoteName1, server.formatUrl(remoteName1));
remote1 = client.stores().create(remote1, name.getMethodName(), RemoteRepository.class);
final String remoteName2 = newName();
RemoteRepository remote2 = new RemoteRepository(MAVEN_PKG_KEY, remoteName2, server.formatUrl(remoteName2));
remote2 = client.stores().create(remote2, name.getMethodName(), RemoteRepository.class);
final String groupName = newName();
Group group = new Group(MAVEN_PKG_KEY, groupName, remote1.getKey(), remote2.getKey());
group = client.stores().create(group, name.getMethodName(), Group.class);
server.expect(server.formatUrl(remoteName2, PATH_JAR), 200, PATH_JAR_CONTENT);
server.expect(server.formatUrl(remoteName2, PATH_POM), 200, PATH_POM_CONTENT);
final String CHECKSUM_CONTENT = newName();
for (String checksumPath : PATHS_CHECKSUM) {
server.expect(server.formatUrl(remoteName2, checksumPath), 200, CHECKSUM_CONTENT);
}
try (InputStream s = client.content().get(group.getKey(), PATH_JAR)) {
assertThat(IOUtils.toString(s), equalTo(PATH_JAR_CONTENT));
}
try (InputStream s = client.content().get(group.getKey(), PATH_JAR)) {
assertThat(IOUtils.toString(s), equalTo(PATH_JAR_CONTENT));
}
for (String checksumPath : PATHS_CHECKSUM) {
try (InputStream s = client.content().get(group.getKey(), checksumPath)) {
assertThat(IOUtils.toString(s), equalTo(CHECKSUM_CONTENT));
}
}
AdvancedCache<IndexedStorePath, IndexedStorePath> advancedCache = (AdvancedCache) contentIndex.execute(c -> c);
System.out.println("[Content index DEBUG]: cached isps: " + advancedCache.keySet());
for (IndexedStorePath value : advancedCache.values()) {
boolean match = remote2.getKey().equals(value.getOriginStoreKey()) || remote2.getKey().equals(value.getStoreKey());
assertThat(match, equalTo(true));
}
System.out.println("[Content index DEBUG]: cache size:" + advancedCache.size());
assertTrue(advancedCache.size() <= 2);
System.out.println("[Content index DEBUG]: cache hit:" + advancedCache.getStats().getHits());
assertTrue(advancedCache.getStats().getHits() >= 7);
System.out.println("[Content index DEBUG]: cache misses:" + advancedCache.getStats().getMisses());
}
use of org.commonjava.indy.content.index.IndexedStorePath in project indy by Commonjava.
the class ContentIndexDirLvWithMetadataTest method test.
@Test
public void test() throws Exception {
final String remoteName1 = newName();
RemoteRepository remote1 = new RemoteRepository(MAVEN_PKG_KEY, remoteName1, server.formatUrl(remoteName1));
remote1 = client.stores().create(remote1, name.getMethodName(), RemoteRepository.class);
final String remoteName2 = newName();
RemoteRepository remote2 = new RemoteRepository(MAVEN_PKG_KEY, remoteName2, server.formatUrl(remoteName2));
remote2 = client.stores().create(remote2, name.getMethodName(), RemoteRepository.class);
final String groupName = newName();
Group group = new Group(MAVEN_PKG_KEY, groupName, remote1.getKey(), remote2.getKey());
group = client.stores().create(group, name.getMethodName(), Group.class);
server.expect(server.formatUrl(remoteName2, PATH_META), 200, PATH_META_CONTENT);
try (InputStream s = client.content().get(group.getKey(), PATH_META)) {
assertThat(IOUtils.toString(s), equalTo(PATH_META_CONTENT));
}
AdvancedCache<IndexedStorePath, IndexedStorePath> advancedCache = (AdvancedCache) contentIndex.execute(c -> c);
System.out.println("[Content index DEBUG]: cached isps: " + advancedCache.keySet());
for (IndexedStorePath value : advancedCache.values()) {
assertThat(value.getOriginStoreKey(), equalTo(remote2.getKey()));
}
System.out.println("[Content index DEBUG]: cache size:" + advancedCache.size());
System.out.println("[Content index DEBUG]: cache hit:" + advancedCache.getStats().getHits());
System.out.println("[Content index DEBUG]: cache misses:" + advancedCache.getStats().getMisses());
}
Aggregations