Search in sources :

Example 11 with Slf4jIntLogger

use of com.blackducksoftware.integration.log.Slf4jIntLogger in project hub-docker-inspector by blackducksoftware.

the class ImageInspectorClient method createConnection.

private RestConnection createConnection(final String baseUrl, final int timeoutSeconds) throws MalformedURLException {
    final UnauthenticatedRestConnectionBuilder connectionBuilder = new UnauthenticatedRestConnectionBuilder();
    connectionBuilder.setBaseUrl(baseUrl);
    connectionBuilder.setTimeout(timeoutSeconds);
    final IntLogger intLogger = new Slf4jIntLogger(logger);
    connectionBuilder.setLogger(intLogger);
    connectionBuilder.setAlwaysTrustServerCertificate(false);
    final RestConnection connection = connectionBuilder.build();
    return connection;
}
Also used : RestConnection(com.blackducksoftware.integration.hub.rest.RestConnection) Slf4jIntLogger(com.blackducksoftware.integration.log.Slf4jIntLogger) UnauthenticatedRestConnectionBuilder(com.blackducksoftware.integration.hub.rest.UnauthenticatedRestConnectionBuilder) IntLogger(com.blackducksoftware.integration.log.IntLogger) Slf4jIntLogger(com.blackducksoftware.integration.log.Slf4jIntLogger)

Example 12 with Slf4jIntLogger

use of com.blackducksoftware.integration.log.Slf4jIntLogger in project hub-detect by blackducksoftware.

the class HubServiceWrapper method init.

public void init() throws IntegrationException, DetectUserFriendlyException {
    try {
        slf4jIntLogger = new Slf4jIntLogger(logger);
        hubServerConfig = createHubServerConfig(slf4jIntLogger);
        hubServicesFactory = createHubServicesFactory(slf4jIntLogger, hubServerConfig);
    } catch (IllegalStateException | EncryptionException e) {
        throw new DetectUserFriendlyException(String.format("Not able to initialize Hub connection: %s", e.getMessage()), e, ExitCodeType.FAILURE_HUB_CONNECTIVITY);
    }
    final HubService hubService = createHubService();
    final CurrentVersionView currentVersion = hubService.getResponse(ApiDiscovery.CURRENT_VERSION_LINK_RESPONSE);
    logger.info(String.format("Successfully connected to Hub (version %s)!", currentVersion.version));
    detectPhoneHomeManager.init(createPhoneHomeService());
    detectPhoneHomeManager.startPhoneHome();
}
Also used : CurrentVersionView(com.blackducksoftware.integration.hub.api.generated.response.CurrentVersionView) DetectUserFriendlyException(com.blackducksoftware.integration.hub.detect.exception.DetectUserFriendlyException) Slf4jIntLogger(com.blackducksoftware.integration.log.Slf4jIntLogger) EncryptionException(com.blackducksoftware.integration.exception.EncryptionException) HubService(com.blackducksoftware.integration.hub.service.HubService)

Aggregations

Slf4jIntLogger (com.blackducksoftware.integration.log.Slf4jIntLogger)12 TestGlobalProperties (com.blackducksoftware.integration.hub.alert.TestGlobalProperties)5 HubConnectionTest (com.blackducksoftware.integration.test.annotation.HubConnectionTest)5 Test (org.junit.Test)5 RestConnection (com.blackducksoftware.integration.hub.rest.RestConnection)3 IntLogger (com.blackducksoftware.integration.log.IntLogger)3 IntegrationException (com.blackducksoftware.integration.exception.IntegrationException)2 MockLoginRestModel (com.blackducksoftware.integration.hub.alert.mock.model.MockLoginRestModel)2 HubServerConfigBuilder (com.blackducksoftware.integration.hub.configuration.HubServerConfigBuilder)2 DetectUserFriendlyException (com.blackducksoftware.integration.hub.detect.exception.DetectUserFriendlyException)2 UnauthenticatedRestConnectionBuilder (com.blackducksoftware.integration.hub.rest.UnauthenticatedRestConnectionBuilder)2 CIEnvironmentVariables (com.blackducksoftware.integration.util.CIEnvironmentVariables)2 File (java.io.File)2 EncryptionException (com.blackducksoftware.integration.exception.EncryptionException)1 Credentials (com.blackducksoftware.integration.hub.Credentials)1 GlobalProperties (com.blackducksoftware.integration.hub.alert.config.GlobalProperties)1 GlobalHubConfigEntity (com.blackducksoftware.integration.hub.alert.datasource.entity.global.GlobalHubConfigEntity)1 LoginRestModel (com.blackducksoftware.integration.hub.alert.web.model.LoginRestModel)1 CurrentVersionView (com.blackducksoftware.integration.hub.api.generated.response.CurrentVersionView)1 ProjectVersionView (com.blackducksoftware.integration.hub.api.generated.view.ProjectVersionView)1