use of org.commonjava.indy.model.core.dto.NotFoundCacheSectionDTO in project indy by Commonjava.
the class HostedMissingAddToNFCTest method run.
@Test
public void run() throws Exception {
try (InputStream inputStream = client.content().get(hosted.getKey(), JAR_PATH)) {
assertThat(inputStream, notNullValue());
}
try (InputStream inputStream = client.content().get(hosted.getKey(), POM_PATH)) {
assertThat(inputStream, IsNull.nullValue());
}
NotFoundCacheDTO dto = client.module(IndyNfcClientModule.class).getAllNfcContentInStore(StoreType.hosted, hosted.getName());
assertThat(dto, notNullValue());
assertThat(dto.getSections(), notNullValue());
NotFoundCacheSectionDTO nfcSectionDto = dto.getSections().stream().filter(d -> d.getKey().equals(hosted.getKey())).findFirst().orElse(null);
assertThat(nfcSectionDto, notNullValue());
assertThat(nfcSectionDto.getPaths(), notNullValue());
assertThat(nfcSectionDto.getPaths().contains(POM_PATH), equalTo(true));
client.content().store(hosted.getKey(), POM_PATH, new ByteArrayInputStream("This is the pom".getBytes()));
try (InputStream inputStream = client.content().get(hosted.getKey(), POM_PATH)) {
assertThat(inputStream, notNullValue());
}
dto = client.module(IndyNfcClientModule.class).getAllNfcContentInStore(StoreType.hosted, hosted.getName());
assertThat(dto, notNullValue());
assertThat(dto.getSections(), notNullValue());
nfcSectionDto = dto.getSections().stream().filter(d -> d.getKey().equals(hosted.getKey())).findFirst().orElse(null);
assertThat(nfcSectionDto, notNullValue());
assertThat(nfcSectionDto.getPaths(), nullValue());
try (InputStream inputStream = client.content().get(hosted.getKey(), META_PATH)) {
assertThat(inputStream, notNullValue());
}
}
use of org.commonjava.indy.model.core.dto.NotFoundCacheSectionDTO in project indy by Commonjava.
the class NFCForTwoGroupsWithSameHostedTest method run.
@Test
public void run() throws Exception {
try (InputStream inputStream = client.content().get(a.getKey(), PATH)) {
assertThat(inputStream, nullValue());
}
// NotFoundCacheDTO dto = client.module( IndyNfcClientModule.class ).getAllNfcContentInStore( StoreType.group, a.getName() );
//
// assertThat( dto, notNullValue() );
// assertThat( dto.getSections(), notNullValue() );
// NotFoundCacheSectionDTO nfcSectionDto = dto.getSections().stream().findFirst().orElse( null );
// assertThat( nfcSectionDto, notNullValue() );
// assertThat( nfcSectionDto.getPaths(), notNullValue() );
// assertThat( nfcSectionDto.getPaths().contains( PATH ), equalTo( true ) );
// dto = client.module( IndyNfcClientModule.class ).getAllNfcContentInStore( StoreType.hosted, x.getName() );
//
// assertThat( dto, notNullValue() );
// assertThat( dto.getSections(), notNullValue() );
// nfcSectionDto = dto.getSections().stream().findFirst().orElse( null );
// assertThat( nfcSectionDto, notNullValue() );
// assertThat( nfcSectionDto.getPaths(), notNullValue() );
// assertThat( nfcSectionDto.getPaths().contains( PATH ), equalTo( true ) );
client.content().store(b.getKey(), PATH, new ByteArrayInputStream("This is the pom".getBytes()));
try (InputStream inputStream = client.content().get(b.getKey(), PATH)) {
assertThat(inputStream, notNullValue());
}
try (InputStream inputStream = client.content().get(a.getKey(), PATH)) {
assertThat(inputStream, notNullValue());
}
NotFoundCacheDTO dto = client.module(IndyNfcClientModule.class).getAllNfcContentInStore(StoreType.group, a.getName());
NotFoundCacheSectionDTO nfcSectionDto = dto.getSections().stream().findFirst().orElse(null);
assertThat(nfcSectionDto, nullValue());
}
use of org.commonjava.indy.model.core.dto.NotFoundCacheSectionDTO in project indy by Commonjava.
the class NFCGetMissingAndPaginationTest method assertThat_DtoContainsPathsForRepository.
private void assertThat_DtoContainsPathsForRepository(NotFoundCacheDTO dto, List<String> expected, AbstractRepository repository) {
NotFoundCacheSectionDTO nfcSectionDto = dto.getSections().stream().filter(d -> d.getKey().equals(repository.getKey())).findFirst().orElse(null);
assertThat(nfcSectionDto, notNullValue());
assertThat(nfcSectionDto.getPaths(), notNullValue());
Set<String> actual = nfcSectionDto.getPaths();
logger.debug("Actual [{}]: {}", repository.getName(), actual);
assertThat(actual.containsAll(expected), equalTo(true));
}
use of org.commonjava.indy.model.core.dto.NotFoundCacheSectionDTO in project indy by Commonjava.
the class NFCForGroupsWithGroupsTest method run.
@Test
public void run() throws Exception {
try (InputStream inputStream = client.content().get(c.getKey(), PATH)) {
assertThat(inputStream, nullValue());
}
// NotFoundCacheDTO dto =
// client.module( IndyNfcClientModule.class ).getAllNfcContentInStore( StoreType.group, c.getName() );
//
// assertThat( dto, notNullValue() );
// assertThat( dto.getSections(), notNullValue() );
// NotFoundCacheSectionDTO nfcSectionDto = dto.getSections().stream().findFirst().orElse( null );
// assertThat( nfcSectionDto, notNullValue() );
// assertThat( nfcSectionDto.getPaths(), notNullValue() );
// assertThat( nfcSectionDto.getPaths().contains( PATH ), equalTo( true ) );
//
// dto = client.module( IndyNfcClientModule.class ).getAllNfcContentInStore( StoreType.group, a.getName() );
//
// assertThat( dto, notNullValue() );
// assertThat( dto.getSections(), notNullValue() );
// nfcSectionDto = dto.getSections().stream().findFirst().orElse( null );
// assertThat( nfcSectionDto, notNullValue() );
// assertThat( nfcSectionDto.getPaths(), notNullValue() );
// assertThat( nfcSectionDto.getPaths().contains( PATH ), equalTo( true ) );
// dto = client.module( IndyNfcClientModule.class ).getAllNfcContentInStore( StoreType.hosted, x.getName() );
//
// assertThat( dto, notNullValue() );
// assertThat( dto.getSections(), notNullValue() );
// nfcSectionDto = dto.getSections().stream().findFirst().orElse( null );
// assertThat( nfcSectionDto, notNullValue() );
// assertThat( nfcSectionDto.getPaths(), notNullValue() );
// assertThat( nfcSectionDto.getPaths().contains( PATH ), equalTo( true ) );
client.content().store(b.getKey(), PATH, new ByteArrayInputStream("This is the pom".getBytes()));
try (InputStream inputStream = client.content().get(b.getKey(), PATH)) {
assertThat(inputStream, notNullValue());
}
try (InputStream inputStream = client.content().get(c.getKey(), PATH)) {
assertThat(inputStream, notNullValue());
}
NotFoundCacheDTO dto = client.module(IndyNfcClientModule.class).getAllNfcContentInStore(StoreType.group, c.getName());
NotFoundCacheSectionDTO nfcSectionDto = dto.getSections().stream().findFirst().orElse(null);
assertThat(nfcSectionDto, nullValue());
dto = client.module(IndyNfcClientModule.class).getAllNfcContentInStore(StoreType.group, a.getName());
nfcSectionDto = dto.getSections().stream().findFirst().orElse(null);
assertThat(nfcSectionDto, nullValue());
}
use of org.commonjava.indy.model.core.dto.NotFoundCacheSectionDTO in project indy by Commonjava.
the class NFCGetMissingAndPaginationTest method assertThat_DtoContainsNoneForRepository.
private void assertThat_DtoContainsNoneForRepository(NotFoundCacheDTO dto, AbstractRepository repository) {
dto.getSections().forEach(d -> System.out.println(">>> " + d.getKey() + ", " + d.getPaths()));
NotFoundCacheSectionDTO nfcSectionDto = dto.getSections().stream().filter(d -> d.getKey().equals(repository.getKey())).findFirst().orElse(null);
assertThat(nfcSectionDto.getPaths(), nullValue());
}
Aggregations