io.dropwizard.logging.DefaultLoggingFactory Java Examples

The following examples show how to use io.dropwizard.logging.DefaultLoggingFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ComplianceToolModeConfigurationFactory.java    From verify-service-provider with MIT License 6 votes vote down vote up
private ComplianceToolModeConfiguration createComplianceToolModeConfiguration() throws IOException {
    String serviceEntityId = UUID.randomUUID().toString();
    KeysAndCert signingKeysAndCert = createKeysAndCert(serviceEntityId);
    KeysAndCert encryptionKeysAndCert = createKeysAndCert(serviceEntityId);

    ComplianceToolModeConfiguration complianceToolModeConfiguration = new ComplianceToolModeConfiguration(serviceEntityId, signingKeysAndCert, encryptionKeysAndCert);

    HttpConnectorFactory httpConnectorFactory = new HttpConnectorFactory();
    httpConnectorFactory.setPort(port);
    httpConnectorFactory.setBindHost(bindHost);
    SimpleServerFactory simpleServerFactory = new SimpleServerFactory();
    simpleServerFactory.setApplicationContextPath("/");
    simpleServerFactory.setConnector(httpConnectorFactory);
    complianceToolModeConfiguration.setServerFactory(simpleServerFactory);
    complianceToolModeConfiguration.setLoggingFactory(new DefaultLoggingFactory());

    return complianceToolModeConfiguration;
}
 
Example #2
Source File: ApplicationConfigurationFeatureTests.java    From verify-service-provider with MIT License 5 votes vote down vote up
@Test
public void applicationShouldStartUp() throws Exception {
    environmentHelper.setEnv(new HashMap<String, String>() {{
        put("PORT", "50555");
        put("LOG_LEVEL", "ERROR");
        put("VERIFY_ENVIRONMENT", "COMPLIANCE_TOOL");
        put("SERVICE_ENTITY_IDS", "[\"http://some-service-entity-id\"]");
        put("SAML_SIGNING_KEY", TEST_RP_PRIVATE_SIGNING_KEY);
        put("SAML_PRIMARY_ENCRYPTION_KEY", TEST_RP_PRIVATE_ENCRYPTION_KEY);
        put("SAML_SECONDARY_ENCRYPTION_KEY", TEST_RP_PRIVATE_ENCRYPTION_KEY);
        put("CLOCK_SKEW", "PT30s");
    }});

    application.getTestSupport().before();

    VerifyServiceProviderConfiguration configuration = application.getConfiguration();

    assertThat(application.getLocalPort()).isEqualTo(50555);
    assertThat(((DefaultLoggingFactory) configuration.getLoggingFactory()).getLevel()).isEqualTo("ERROR");
    assertThat(configuration.getHubSsoLocation().toString()).isEqualTo(HubEnvironment.COMPLIANCE_TOOL.getSsoLocation().toString());
    assertThat(configuration.getVerifyHubMetadata().getUri().toString()).isEqualTo(HubEnvironment.COMPLIANCE_TOOL.getMetadataUri().toString());
    assertThat(configuration.getVerifyHubMetadata().getExpectedEntityId()).isEqualTo("https://signin.service.gov.uk");
    assertThat(configuration.getServiceEntityIds()).containsExactly("http://some-service-entity-id");
    assertThat(configuration.getSamlSigningKey().getEncoded()).isEqualTo(decode(TEST_RP_PRIVATE_SIGNING_KEY));
    assertThat(configuration.getSamlPrimaryEncryptionKey().getEncoded()).isEqualTo(decode(TEST_RP_PRIVATE_ENCRYPTION_KEY));
    assertThat(configuration.getSamlSecondaryEncryptionKey().getEncoded()).isEqualTo(decode(TEST_RP_PRIVATE_ENCRYPTION_KEY));
    assertThat(configuration.getClockSkew()).isEqualTo(Duration.standardSeconds(30));
    assertThat(configuration.getEuropeanIdentity().isPresent()).isTrue();
    assertThat(configuration.getEuropeanIdentity().get().getAllAcceptableHubConnectorEntityIds()).containsAll(HubEnvironment.COMPLIANCE_TOOL.getEidasDefaultAcceptableHubConnectorEntityIds());
    assertThat(configuration.getEuropeanIdentity().get().getMetadataSourceUri()).isEqualTo(HubEnvironment.COMPLIANCE_TOOL.getEidasMetadataSourceUri());
    assertThat(configuration.getEuropeanIdentity().get().getTrustAnchorUri()).isEqualTo(HubEnvironment.COMPLIANCE_TOOL.getEidasMetadataTrustAnchorUri());
    assertThat(configuration.getEuropeanIdentity().get().getTrustStore().getCertificate("idaca").toString())
            .isEqualTo(HubEnvironment.COMPLIANCE_TOOL.getMetadataTrustStore().getCertificate("idaca").toString());
    assertThat(configuration.getEuropeanIdentity().get().getTrustStore().getCertificate("idametadata").toString())
            .isEqualTo(HubEnvironment.COMPLIANCE_TOOL.getMetadataTrustStore().getCertificate("idametadata").toString());

}
 
Example #3
Source File: ApplicationConfigurationFeatureTests.java    From verify-service-provider with MIT License 5 votes vote down vote up
@Test
public void applicationShouldStartUpWithListOfServiceEntityIds() throws Exception {
    environmentHelper.setEnv(new HashMap<String, String>() {{
        put("PORT", "50555");
        put("LOG_LEVEL", "ERROR");
        put("VERIFY_ENVIRONMENT", "COMPLIANCE_TOOL");
        put("SERVICE_ENTITY_IDS", "[\"http://some-service-entity-id\",\"http://some-other-service-entity-id\"]");
        put("HASHING_ENTITY_ID", "some-hashing-entity-id");
        put("SAML_SIGNING_KEY", TEST_RP_PRIVATE_SIGNING_KEY);
        put("SAML_PRIMARY_ENCRYPTION_KEY", TEST_RP_PRIVATE_ENCRYPTION_KEY);
        put("SAML_SECONDARY_ENCRYPTION_KEY", TEST_RP_PRIVATE_ENCRYPTION_KEY);
        put("CLOCK_SKEW", "PT30s");
    }});

    application.getTestSupport().before();

    VerifyServiceProviderConfiguration configuration = application.getConfiguration();

    assertThat(application.getLocalPort()).isEqualTo(50555);
    assertThat(((DefaultLoggingFactory) configuration.getLoggingFactory()).getLevel()).isEqualTo("ERROR");
    assertThat(configuration.getHubSsoLocation().toString()).isEqualTo(HubEnvironment.COMPLIANCE_TOOL.getSsoLocation().toString());
    assertThat(configuration.getVerifyHubMetadata().getUri().toString()).isEqualTo(HubEnvironment.COMPLIANCE_TOOL.getMetadataUri().toString());
    assertThat(configuration.getVerifyHubMetadata().getExpectedEntityId()).isEqualTo("https://signin.service.gov.uk");
    assertThat(configuration.getServiceEntityIds()).containsExactly("http://some-service-entity-id", "http://some-other-service-entity-id");
    assertThat(configuration.getHashingEntityId()).isEqualTo("some-hashing-entity-id");
    assertThat(configuration.getSamlSigningKey().getEncoded()).isEqualTo(decode(TEST_RP_PRIVATE_SIGNING_KEY));
    assertThat(configuration.getSamlPrimaryEncryptionKey().getEncoded()).isEqualTo(decode(TEST_RP_PRIVATE_ENCRYPTION_KEY));
    assertThat(configuration.getSamlSecondaryEncryptionKey().getEncoded()).isEqualTo(decode(TEST_RP_PRIVATE_ENCRYPTION_KEY));
    assertThat(configuration.getClockSkew()).isEqualTo(Duration.standardSeconds(30));
}
 
Example #4
Source File: SoaBundle.java    From soabase with Apache License 2.0 5 votes vote down vote up
private LoggingReader initLogging(Configuration configuration) throws IOException
{
    Set<File> mainFiles = Sets.newHashSet();
    Set<File> archiveDirectories = Sets.newHashSet();
    LoggingFactory loggingFactory = configuration.getLoggingFactory();
    if ( loggingFactory instanceof DefaultLoggingFactory )
    {
        for ( AppenderFactory appenderFactory : ((DefaultLoggingFactory)loggingFactory).getAppenders() )
        {
            if ( appenderFactory instanceof FileAppenderFactory )
            {
                FileAppenderFactory fileAppenderFactory = (FileAppenderFactory)appenderFactory;
                if ( fileAppenderFactory.getCurrentLogFilename() != null )
                {
                    mainFiles.add(new File(fileAppenderFactory.getCurrentLogFilename()).getCanonicalFile());
                }

                if ( fileAppenderFactory.getArchivedLogFilenamePattern() != null )
                {
                    File archive = new File(fileAppenderFactory.getArchivedLogFilenamePattern()).getParentFile().getCanonicalFile();
                    archiveDirectories.add(archive);
                }
            }
        }
    }

    if ( (mainFiles.size() == 0) && (archiveDirectories.size() == 0) )
    {
        log.warn("No log files found in config");
    }

    return new LoggingReader(mainFiles, archiveDirectories);
}
 
Example #5
Source File: TimbuctooConfiguration.java    From timbuctoo with GNU General Public License v3.0 4 votes vote down vote up
@Override
@JsonProperty("logging")
@Value.Default
public LoggingFactory getLoggingFactory() {
  return new DefaultLoggingFactory();
}