Search in sources :

Example 1 with PrintStreamIntLogger

use of com.synopsys.integration.log.PrintStreamIntLogger in project hub-alert by blackducksoftware.

the class DockerTagRetrieverTest method getTagsModelTestIT.

@Test
@Tags({ @Tag(TestTags.DEFAULT_INTEGRATION), @Tag(TestTags.CUSTOM_EXTERNAL_CONNECTION) })
public void getTagsModelTestIT() throws IntegrationException {
    IntLogger intLogger = new PrintStreamIntLogger(System.out, LogLevel.INFO);
    IntHttpClient intHttpClient = new IntHttpClient(intLogger, gson, 10, true, ProxyInfo.NO_PROXY_INFO);
    HttpUrl httpUrl = new HttpUrl("https://google.com");
    Request testRequest = new Request.Builder(httpUrl).build();
    try (Response googleResponse = intHttpClient.execute(testRequest)) {
        googleResponse.throwExceptionForError();
    } catch (IntegrationException | IOException e) {
        assumeTrue(null == e, "Could not connect. Skipping this test...");
    }
    DockerTagRetriever dockerTagRetriever = new DockerTagRetriever(gson, intHttpClient);
    DockerTagsResponseModel tagsModel = dockerTagRetriever.getTagsModel();
    assertFalse(tagsModel.isEmpty(), "Expected tags from the docker repo to exist");
}
Also used : Response(com.synopsys.integration.rest.response.Response) DockerTagsResponseModel(com.synopsys.integration.alert.update.model.DockerTagsResponseModel) PrintStreamIntLogger(com.synopsys.integration.log.PrintStreamIntLogger) IntegrationException(com.synopsys.integration.exception.IntegrationException) IntHttpClient(com.synopsys.integration.rest.client.IntHttpClient) Request(com.synopsys.integration.rest.request.Request) IntLogger(com.synopsys.integration.log.IntLogger) PrintStreamIntLogger(com.synopsys.integration.log.PrintStreamIntLogger) IOException(java.io.IOException) HttpUrl(com.synopsys.integration.rest.HttpUrl) Test(org.junit.jupiter.api.Test) TestTags(com.synopsys.integration.alert.test.common.TestTags) Tags(org.junit.jupiter.api.Tags)

Aggregations

TestTags (com.synopsys.integration.alert.test.common.TestTags)1 DockerTagsResponseModel (com.synopsys.integration.alert.update.model.DockerTagsResponseModel)1 IntegrationException (com.synopsys.integration.exception.IntegrationException)1 IntLogger (com.synopsys.integration.log.IntLogger)1 PrintStreamIntLogger (com.synopsys.integration.log.PrintStreamIntLogger)1 HttpUrl (com.synopsys.integration.rest.HttpUrl)1 IntHttpClient (com.synopsys.integration.rest.client.IntHttpClient)1 Request (com.synopsys.integration.rest.request.Request)1 Response (com.synopsys.integration.rest.response.Response)1 IOException (java.io.IOException)1 Tags (org.junit.jupiter.api.Tags)1 Test (org.junit.jupiter.api.Test)1