Search in sources :

Example 1 with KMSWebApp

use of org.apache.hadoop.crypto.key.kms.server.KMSWebApp in project ranger by apache.

the class RangerKmsAuthorizerTest method startServers.

@BeforeClass
public static void startServers() throws Exception {
    if (!UNRESTRICTED_POLICIES_INSTALLED) {
        return;
    }
    DerbyTestUtils.startDerby();
    Path configDir = Paths.get("src/test/resources/kms");
    Path logDir = Paths.get("target");
    System.setProperty(KMSConfiguration.KMS_CONFIG_DIR, configDir.toFile().getAbsolutePath());
    System.setProperty("kms.log.dir", logDir.toFile().getAbsolutePath());
    System.setProperty("hostname", "localhost");
    System.setProperty("user", "autotest");
    // Start KMSWebApp
    ServletContextEvent servletContextEvent = Mockito.mock(ServletContextEvent.class);
    kmsWebapp = new KMSWebApp();
    kmsWebapp.contextInitialized(servletContextEvent);
}
Also used : Path(java.nio.file.Path) KMSWebApp(org.apache.hadoop.crypto.key.kms.server.KMSWebApp) ServletContextEvent(javax.servlet.ServletContextEvent) BeforeClass(org.junit.BeforeClass)

Example 2 with KMSWebApp

use of org.apache.hadoop.crypto.key.kms.server.KMSWebApp in project testcases by coheigea.

the class RangerKmsAuthorizerTest method startServers.

@BeforeClass
public static void startServers() throws Exception {
    DerbyTestUtils.startDerby();
    Path configDir = Paths.get("src/test/resources/kms");
    System.setProperty(KMSConfiguration.KMS_CONFIG_DIR, configDir.toFile().getAbsolutePath());
    // Start KMSWebApp
    ServletContextEvent servletContextEvent = EasyMock.createMock(ServletContextEvent.class);
    ServletContext servletContext = EasyMock.createMock(ServletContext.class);
    EasyMock.expect(servletContextEvent.getServletContext()).andReturn(servletContext).anyTimes();
    EasyMock.replay(servletContextEvent);
    kmsWebapp = new KMSWebApp();
    kmsWebapp.contextInitialized(servletContextEvent);
}
Also used : Path(java.nio.file.Path) KMSWebApp(org.apache.hadoop.crypto.key.kms.server.KMSWebApp) ServletContext(javax.servlet.ServletContext) ServletContextEvent(javax.servlet.ServletContextEvent) BeforeClass(org.junit.BeforeClass)

Aggregations

Path (java.nio.file.Path)2 ServletContextEvent (javax.servlet.ServletContextEvent)2 KMSWebApp (org.apache.hadoop.crypto.key.kms.server.KMSWebApp)2 BeforeClass (org.junit.BeforeClass)2 ServletContext (javax.servlet.ServletContext)1