Search in sources :

Example 1 with NotFoundCacheSectionDTO

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());
    }
}
Also used : IsNull(org.hamcrest.core.IsNull) NotFoundCacheDTO(org.commonjava.indy.model.core.dto.NotFoundCacheDTO) IndyNfcClientModule(org.commonjava.indy.client.core.module.IndyNfcClientModule) CoreMatchers.equalTo(org.hamcrest.CoreMatchers.equalTo) StoreType(org.commonjava.indy.model.core.StoreType) Test(org.junit.Test) AbstractContentManagementTest(org.commonjava.indy.ftest.core.AbstractContentManagementTest) CoreMatchers.notNullValue(org.hamcrest.CoreMatchers.notNullValue) Assert.assertThat(org.junit.Assert.assertThat) NotFoundCacheSectionDTO(org.commonjava.indy.model.core.dto.NotFoundCacheSectionDTO) HostedRepository(org.commonjava.indy.model.core.HostedRepository) Ignore(org.junit.Ignore) ByteArrayInputStream(java.io.ByteArrayInputStream) CoreMatchers.nullValue(org.hamcrest.CoreMatchers.nullValue) Before(org.junit.Before) InputStream(java.io.InputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) NotFoundCacheSectionDTO(org.commonjava.indy.model.core.dto.NotFoundCacheSectionDTO) IndyNfcClientModule(org.commonjava.indy.client.core.module.IndyNfcClientModule) NotFoundCacheDTO(org.commonjava.indy.model.core.dto.NotFoundCacheDTO) Test(org.junit.Test) AbstractContentManagementTest(org.commonjava.indy.ftest.core.AbstractContentManagementTest)

Example 2 with NotFoundCacheSectionDTO

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());
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) NotFoundCacheSectionDTO(org.commonjava.indy.model.core.dto.NotFoundCacheSectionDTO) IndyNfcClientModule(org.commonjava.indy.client.core.module.IndyNfcClientModule) NotFoundCacheDTO(org.commonjava.indy.model.core.dto.NotFoundCacheDTO) Test(org.junit.Test) AbstractContentManagementTest(org.commonjava.indy.ftest.core.AbstractContentManagementTest)

Example 3 with NotFoundCacheSectionDTO

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));
}
Also used : NotFoundCacheSectionDTO(org.commonjava.indy.model.core.dto.NotFoundCacheSectionDTO)

Example 4 with NotFoundCacheSectionDTO

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());
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) NotFoundCacheSectionDTO(org.commonjava.indy.model.core.dto.NotFoundCacheSectionDTO) IndyNfcClientModule(org.commonjava.indy.client.core.module.IndyNfcClientModule) NotFoundCacheDTO(org.commonjava.indy.model.core.dto.NotFoundCacheDTO) Test(org.junit.Test) AbstractContentManagementTest(org.commonjava.indy.ftest.core.AbstractContentManagementTest)

Example 5 with NotFoundCacheSectionDTO

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());
}
Also used : NotFoundCacheSectionDTO(org.commonjava.indy.model.core.dto.NotFoundCacheSectionDTO)

Aggregations

NotFoundCacheSectionDTO (org.commonjava.indy.model.core.dto.NotFoundCacheSectionDTO)5 ByteArrayInputStream (java.io.ByteArrayInputStream)3 InputStream (java.io.InputStream)3 IndyNfcClientModule (org.commonjava.indy.client.core.module.IndyNfcClientModule)3 AbstractContentManagementTest (org.commonjava.indy.ftest.core.AbstractContentManagementTest)3 NotFoundCacheDTO (org.commonjava.indy.model.core.dto.NotFoundCacheDTO)3 Test (org.junit.Test)3 HostedRepository (org.commonjava.indy.model.core.HostedRepository)1 StoreType (org.commonjava.indy.model.core.StoreType)1 CoreMatchers.equalTo (org.hamcrest.CoreMatchers.equalTo)1 CoreMatchers.notNullValue (org.hamcrest.CoreMatchers.notNullValue)1 CoreMatchers.nullValue (org.hamcrest.CoreMatchers.nullValue)1 IsNull (org.hamcrest.core.IsNull)1 Assert.assertThat (org.junit.Assert.assertThat)1 Before (org.junit.Before)1 Ignore (org.junit.Ignore)1