Search in sources :

Example 46 with Properties

use of java.util.Properties in project camel by apache.

the class MailMessageTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    Mailbox.clearAll();
    endpoint = resolveMandatoryEndpoint("pop3://someone@myhost:30/subject");
    Properties properties = new Properties();
    properties.put("mail.smtp.host", "localhost");
    mailSession = Session.getInstance(properties, null);
    mimeMessage = new MimeMessage(mailSession);
    mimeMessage.setText(body);
}
Also used : MimeMessage(javax.mail.internet.MimeMessage) Properties(java.util.Properties) Before(org.junit.Before)

Example 47 with Properties

use of java.util.Properties in project hadoop by apache.

the class DelegationTokenAuthenticationFilter method getConfiguration.

/**
   * It delegates to
   * {@link AuthenticationFilter#getConfiguration(String, FilterConfig)} and
   * then overrides the {@link AuthenticationHandler} to use if authentication
   * type is set to <code>simple</code> or <code>kerberos</code> in order to use
   * the corresponding implementation with delegation token support.
   *
   * @param configPrefix parameter not used.
   * @param filterConfig parameter not used.
   * @return hadoop-auth de-prefixed configuration for the filter and handler.
   */
@Override
protected Properties getConfiguration(String configPrefix, FilterConfig filterConfig) throws ServletException {
    Properties props = super.getConfiguration(configPrefix, filterConfig);
    setAuthHandlerClass(props);
    return props;
}
Also used : Properties(java.util.Properties)

Example 48 with Properties

use of java.util.Properties in project groovy by apache.

the class CompilerConfigurationTest method setUp.

// Use setUp/tearDown to avoid mucking with system properties for other tests...
public void setUp() {
    savedProperties = System.getProperties();
    System.setProperties(new Properties(savedProperties));
}
Also used : Properties(java.util.Properties)

Example 49 with Properties

use of java.util.Properties in project hadoop by apache.

the class TestAltKerberosAuthenticationHandler method testNonDefaultNonBrowserUserAgentAsNonBrowser.

@Test(timeout = 60000)
public void testNonDefaultNonBrowserUserAgentAsNonBrowser() throws Exception {
    if (handler != null) {
        handler.destroy();
        handler = null;
    }
    handler = getNewAuthenticationHandler();
    Properties props = getDefaultProperties();
    props.setProperty("alt-kerberos.non-browser.user-agents", "foo, bar");
    try {
        handler.init(props);
    } catch (Exception ex) {
        handler = null;
        throw ex;
    }
    // Run the kerberos tests again
    testRequestWithoutAuthorization();
    testRequestWithInvalidAuthorization();
    testRequestWithAuthorization();
    testRequestWithInvalidKerberosAuthorization();
}
Also used : Properties(java.util.Properties) AuthenticationException(org.apache.hadoop.security.authentication.client.AuthenticationException) IOException(java.io.IOException) Test(org.junit.Test)

Example 50 with Properties

use of java.util.Properties in project hadoop by apache.

the class TestAltKerberosAuthenticationHandler method testNonDefaultNonBrowserUserAgentAsBrowser.

@Test(timeout = 60000)
public void testNonDefaultNonBrowserUserAgentAsBrowser() throws Exception {
    HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
    HttpServletResponse response = Mockito.mock(HttpServletResponse.class);
    if (handler != null) {
        handler.destroy();
        handler = null;
    }
    handler = getNewAuthenticationHandler();
    Properties props = getDefaultProperties();
    props.setProperty("alt-kerberos.non-browser.user-agents", "foo, bar");
    try {
        handler.init(props);
    } catch (Exception ex) {
        handler = null;
        throw ex;
    }
    // Pretend we're something that will not match with "foo" (or "bar")
    Mockito.when(request.getHeader("User-Agent")).thenReturn("blah");
    // Should use alt authentication
    AuthenticationToken token = handler.authenticate(request, response);
    Assert.assertEquals("A", token.getUserName());
    Assert.assertEquals("B", token.getName());
    Assert.assertEquals(getExpectedType(), token.getType());
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) HttpServletResponse(javax.servlet.http.HttpServletResponse) Properties(java.util.Properties) AuthenticationException(org.apache.hadoop.security.authentication.client.AuthenticationException) IOException(java.io.IOException) Test(org.junit.Test)

Aggregations

Properties (java.util.Properties)9354 Test (org.junit.Test)3005 IOException (java.io.IOException)1277 Connection (java.sql.Connection)1179 File (java.io.File)1013 ResultSet (java.sql.ResultSet)860 ConfigurationProperties (org.apache.geode.distributed.ConfigurationProperties)819 PreparedStatement (java.sql.PreparedStatement)791 InputStream (java.io.InputStream)614 FileInputStream (java.io.FileInputStream)598 HashMap (java.util.HashMap)475 Map (java.util.Map)387 PhoenixConnection (org.apache.phoenix.jdbc.PhoenixConnection)387 ArrayList (java.util.ArrayList)371 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)321 SQLException (java.sql.SQLException)308 Before (org.junit.Before)272 AttributesFactory (org.apache.geode.cache.AttributesFactory)245 InitialContext (javax.naming.InitialContext)214 Configuration (org.apache.hadoop.conf.Configuration)187