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);
}
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;
}
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));
}
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();
}
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());
}
Aggregations