Examples of EmbeddedServletContainer


Examples of org.apache.oozie.test.EmbeddedServletContainer

            services.init();
            Services.get().setService(ForTestAuthorizationService.class);
            Services.get().setService(ForTestWorkflowStoreService.class);
            Services.get().setService(MockDagEngineService.class);
            Services.get().setService(MockCoordinatorEngineService.class);
            container = new EmbeddedServletContainer("oozie");
            container.addServletEndpoint("/versions", HeaderTestingVersionServlet.class);
            String version = "/v" + XOozieClient.WS_PROTOCOL_VERSION;
            container.addServletEndpoint(version + "/admin/*", V1AdminServlet.class);
            container.addFilter("*", HostnameFilter.class);
            container.addFilter("/*", AuthFilter.class);
View Full Code Here

Examples of org.apache.oozie.test.EmbeddedServletContainer

        }
        else {
            System.getProperties().remove("oozielocal.log");
        }

        container = new EmbeddedServletContainer("oozie");
        container.addServletEndpoint("/callback", CallbackServlet.class);
        container.start();
        String callbackUrl = container.getServletURL("/callback");
        Services.get().getConf().set(CallbackService.CONF_BASE_URL, callbackUrl);
        XLog.getLog(LocalOozie.class).info("LocalOozie started callback set to [{0}]", callbackUrl);
View Full Code Here

Examples of org.apache.oozie.test.EmbeddedServletContainer

    }
    protected void setUp() throws Exception {
        super.setUp();
        CallbackServlet.reset();
        container = new EmbeddedServletContainer("oozie");
        container.addServletEndpoint("/callback", CallbackServlet.class);
        container.start();

        setSystemProperty(SchemaService.WF_CONF_EXT_SCHEMAS, "wf-ext-schema.xsd");
        services = new Services();
View Full Code Here

Examples of org.apache.oozie.test.EmbeddedServletContainer

            services.getConf().setBoolean(AuthorizationService.CONF_SECURITY_ENABLED, securityEnabled);
            Services.get().setService(ForTestAuthorizationService.class);
            Services.get().setService(ForTestWorkflowStoreService.class);
            Services.get().setService(MockDagEngineService.class);
            Services.get().setService(MockCoordinatorEngineService.class);
            container = new EmbeddedServletContainer("oozie");
            for (int i = 0; i < servletPath.length; i++) {
                container.addServletEndpoint(servletPath[i], servletClass[i]);
            }
            container.addFilter("*", HostnameFilter.class);
            container.addFilter("*", AuthFilter.class);
View Full Code Here

Examples of org.apache.oozie.test.EmbeddedServletContainer

    public void setUp() throws Exception {
        super.setUp();
        setSystemProperty(NotificationXCommand.NOTIFICATION_URL_CONNECTION_TIMEOUT_KEY, "50");
        Services services = new Services();
        services.init();
        container = new EmbeddedServletContainer("blah");
        container.addServletEndpoint("/hang/*", HangServlet.class);
        container.start();
    }
View Full Code Here

Examples of org.apache.oozie.test.EmbeddedServletContainer

    }

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        container = new EmbeddedServletContainer("oozie-login");
        container.addServletEndpoint("/", getServletClass(), getInitParameters());
        container.start();
    }
View Full Code Here

Examples of org.apache.oozie.test.EmbeddedServletContainer

    }

    protected void setUp() throws Exception {
        super.setUp();
        container = new EmbeddedServletContainer("oozie");
        container.addServletEndpoint("/v2/admin/*", V2AdminServlet.class);
        container.addServletEndpoint("/other-oozie-server/*", DummyV2AdminServlet.class);
        container.addFilter("*", HostnameFilter.class);
        container.start();
        Services.get().setService(ShareLibService.class);
View Full Code Here

Examples of org.apache.oozie.test.EmbeddedServletContainer

        assertTrue(outArr[2].contains("_L6_"));

        // We'll use a DummyZKOozie to create an entry in ZK and then set its url to an (unrelated) servlet that will simply return
        // some log messages
        DummyZKOozie dummyOozie = null;
        EmbeddedServletContainer container = new EmbeddedServletContainer("oozie");
        container.addServletEndpoint("/other-oozie-server/*", DummyLogStreamingServlet.class);
        try {
            container.start();
            dummyOozie = new DummyZKOozie("9876", container.getServletURL("/other-oozie-server/*"));

            DummyLogStreamingServlet.lastQueryString = null;
            out = doStreamLog(xf);
            outArr = out.split("\n");
            assertEquals(16, outArr.length);
            assertTrue(outArr[0].contains("_L1_"));
            assertTrue(outArr[1].contains("_L2_"));
            assertTrue(outArr[2].contains("_L3_"));
            assertTrue(outArr[3].contains("_L4_"));
            assertTrue(outArr[4].contains("_L5_"));
            assertTrue(outArr[5].contains("_L6_"));
            assertTrue(outArr[6].contains("_L7_"));
            assertTrue(outArr[7].contains("_L8_"));
            assertTrue(outArr[8].contains("_L9_"));
            assertTrue(outArr[9].contains("_L10_"));
            assertTrue(outArr[10].contains("_L11_"));
            assertTrue(outArr[11].contains("_L12_"));
            assertTrue(outArr[12].contains("_L13_"));
            assertTrue(outArr[13].contains("_L14_"));
            assertTrue(outArr[14].contains("_L15_"));
            assertTrue(outArr[15].contains("_L16_"));
            assertEquals("show=log&allservers=false", DummyLogStreamingServlet.lastQueryString);

            // If we stop the container but leave the DummyZKOozie running, it will simulate if that server is down but still has
            // info in ZK; we should be able to get the logs from other servers (in this case, this server) and a message about
            // which servers it couldn't reach
            container.stop();
            out = doStreamLog(xf);
            outArr = out.split("\n");
            assertEquals(6, outArr.length);
            assertTrue(outArr[0].startsWith("Unable"));
            assertEquals("9876", outArr[1].trim());
            assertEquals("", outArr[2]);
            assertFalse(out.contains("_L1_"));
            assertFalse(out.contains("_L2_"));
            assertTrue(outArr[3].contains("_L3_"));
            assertTrue(outArr[4].contains("_L4_"));
            assertFalse(out.contains("_L5_"));
            assertTrue(outArr[5].contains("_L6_"));
        }
        finally {
            if (dummyOozie != null) {
                dummyOozie.teardown();
            }
            container.stop();
        }
    }
View Full Code Here

Examples of org.apache.oozie.test.EmbeddedServletContainer

        // We'll use a DummyZKOozie to create an entry in ZK and then set its
        // url to an (unrelated) servlet that will simply return
        // some log messages
        DummyZKOozie dummyOozie = null;
        EmbeddedServletContainer container = new EmbeddedServletContainer("oozie");
        container.addServletEndpoint("/other-oozie-server/*", DummyLogStreamingServlet.class);
        try {
            container.start();
            dummyOozie = new DummyZKOozie("9876", container.getServletURL("/other-oozie-server/*"));
            DummyLogStreamingServlet.logs = "";

            DummyLogStreamingServlet.lastQueryString = null;
            Map<String, String[]> param = new HashMap<String, String[]>();
            param.put(RestConstants.JOB_COORD_RANGE_TYPE_PARAM, new String[] { RestConstants.JOB_LOG_ACTION });
            param.put(RestConstants.JOB_COORD_SCOPE_PARAM, new String[] { "1" });
            out = doStreamLog(xf, param);
            assertTrue(DummyLogStreamingServlet.lastQueryString.contains("show=log&allservers=false" ));
            assertTrue(DummyLogStreamingServlet.lastQueryString.contains("type=" + RestConstants.JOB_LOG_ACTION ));
            assertTrue(DummyLogStreamingServlet.lastQueryString.contains(RestConstants.JOB_COORD_SCOPE_PARAM + "=1" ));

            param.clear();
            param.put(RestConstants.JOB_COORD_RANGE_TYPE_PARAM, new String[] { RestConstants.JOB_LOG_ACTION });
            param.put(RestConstants.JOB_COORD_SCOPE_PARAM, new String[] { "1-4,5" });
            out = doStreamLog(xf, param);
            assertTrue(DummyLogStreamingServlet.lastQueryString.contains("show=log&allservers=false" ));
            assertTrue(DummyLogStreamingServlet.lastQueryString.contains("type=" + RestConstants.JOB_LOG_ACTION ));
            assertTrue(DummyLogStreamingServlet.lastQueryString.contains(RestConstants.JOB_COORD_SCOPE_PARAM + "=1-4,5" ));

            param.clear();
            Date endDate = new Date();
            Date createdDate = new Date(endDate.getTime() / 2);
            String date = DateUtils.formatDateOozieTZ(createdDate) + "::" + DateUtils.formatDateOozieTZ(endDate);
            param.put(RestConstants.JOB_COORD_RANGE_TYPE_PARAM, new String[] { RestConstants.JOB_LOG_DATE });
            param.put(RestConstants.JOB_COORD_SCOPE_PARAM, new String[] { date });
            out = doStreamLog(xf, param);
            assertTrue(DummyLogStreamingServlet.lastQueryString.contains("show=log&allservers=false" ));
            assertTrue(DummyLogStreamingServlet.lastQueryString.contains("type=" + RestConstants.JOB_LOG_DATE ));
            assertTrue(DummyLogStreamingServlet.lastQueryString.contains(RestConstants.JOB_COORD_SCOPE_PARAM + "=" + date ));

            container.stop();
        }
        finally {
            if (dummyOozie != null) {
                dummyOozie.teardown();
            }
            container.stop();
        }
    }
View Full Code Here

Examples of org.apache.oozie.test.EmbeddedServletContainer

        }
        else {
            System.getProperties().remove("oozielocal.log");
        }

        container = new EmbeddedServletContainer("oozie");
        container.addServletEndpoint("/callback", CallbackServlet.class);
        container.start();
        String callbackUrl = container.getServletURL("/callback");
        Services.get().getConf().set(CallbackService.CONF_BASE_URL, callbackUrl);
        XLog.getLog(LocalOozie.class).info("LocalOozie started callback set to [{0}]", callbackUrl);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.