Package org.apache.s4.core

Examples of org.apache.s4.core.AppModule


            } catch (IOException e) {
                throw new DeploymentFailedException("Cannot deploy application [" + appName + "] from URI ["
                        + uri.toString() + "] ", e);
            }
            // install locally
            App loaded = server.loadApp(localS4RFileCopy, appName);
            if (loaded != null) {
                logger.info("Successfully installed application {}", appName);
                // TODO sync with other nodes? (e.g. wait for other apps deployed before starting?
                server.startApp(loaded, appName, clusterName);
            } else {
View Full Code Here


        CoreTestUtils.watchAndSignalCreation("/value1Set", signalValue1Set, zk);
        final CountDownLatch signalCheckpointed = new CountDownLatch(1);
        CoreTestUtils.watchAndSignalCreation("/checkpointed", signalCheckpointed, zk);

        Injector injector = Guice.createInjector(new MockCommModule(),
                new MockCoreModuleWithFileBaseCheckpointingBackend(), new AppModule(getClass().getClassLoader()));
        TestApp app = injector.getInstance(TestApp.class);
        app.init();
        app.start();

        Event event = new Event();
View Full Code Here

    /*
     * We inject one event and fire one onTime() event, both should be synchronized (not running in parallel)
     */
    @Test
    public void testSynchronization() throws IOException, InterruptedException {
        Injector injector = Guice.createInjector(new MockCommModule(), new MockCoreModule(), new AppModule(getClass()
                .getClassLoader()));
        TestApp app = injector.getInstance(TestApp.class);
        app.count = 2; // One for the event, another for the timer
        app.init();
        app.start();
View Full Code Here

    @Test
    public void test() {
        ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) LoggerFactory
                .getLogger(Logger.ROOT_LOGGER_NAME);
        root.setLevel(Level.DEBUG);
        Injector injector = Guice.createInjector(new MockCommModule(), new MockCoreModule(), new AppModule(getClass()
                .getClassLoader()));
        TestTimeWindowedApp app = injector.getInstance(TestTimeWindowedApp.class);
        app.init();
        app.start();
View Full Code Here

    // }

    @Before
    public void prepareEmitter() throws IOException {
        injector = Guice.createInjector(new DefaultCommModule(Resources.getResource("default.s4.comm.properties")
                .openStream(), "cluster1"), new DefaultCoreModule(Resources.getResource("default.s4.core.properties")
                .openStream()));

        emitter = injector.getInstance(TCPEmitter.class);

    }
View Full Code Here

    }

    public static Injector createInjectorWithNonFailFastZKClients() throws IOException {
        return Guice.createInjector(Modules.override(
                new DefaultCommModule(Resources.getResource("default.s4.comm.properties").openStream(), "cluster1"),
                new DefaultCoreModule(Resources.getResource("default.s4.core.properties").openStream())).with(
                new NonFailFastZookeeperClientsModule()));
    }
View Full Code Here

    @Test
    public void test() throws Exception {
        Injector injector = Guice.createInjector(
                new DefaultCommModule(Resources.getResource("default.s4.comm.properties").openStream(), CLUSTER_NAME),
                new DefaultCoreModule(Resources.getResource("default.s4.core.properties").openStream()));
        MyApp myApp = injector.getInstance(MyApp.class);

        /* Normally. the container will handle this but this is just a test. */
        myApp.init();
        myApp.start();
View Full Code Here

    App buildApp() {

        /* Stream to PE writing. */
        for (StreamBuilder<? extends Event> sb : streamBuilders) {
            for (String peName : sb.pes) {
                ProcessingElement pe = getPE(peName);
                sb.stream.setPE(pe);
            }
        }

        /* PE to Stream wiring. */
        Map<ProcessingElement, Collection<StreamBuilder<? extends Event>>> pe2streamMap = pe2stream.asMap();
        for (Map.Entry<ProcessingElement, Collection<StreamBuilder<? extends Event>>> entry : pe2streamMap.entrySet()) {
            ProcessingElement pe = entry.getKey();
            Collection<StreamBuilder<? extends Event>> streams = entry.getValue();

            if (pe != null && streams != null) {
                try {
                    setStreamField(pe, streams);
View Full Code Here

    public static void main(String[] args) {

        Injector injector = Guice.createInjector(new Module());
        MyApp myApp = injector.getInstance(MyApp.class);
        Sender sender = injector.getInstance(Sender.class);
        Receiver receiver = injector.getInstance(Receiver.class);
        // myApp.setCommLayer(sender, receiver);
        myApp.init();
        myApp.start();

        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        myApp.close();
        receiver.close();
    }
View Full Code Here

    public void test() throws Exception {

        Injector injector = Guice.createInjector(new Module());
        FluentApp myApp = injector.getInstance(FluentApp.class);
        Sender sender = injector.getInstance(Sender.class);
        Receiver receiver = injector.getInstance(Receiver.class);
        myApp.setCommLayer(sender, receiver);

        /* Normally. the container will handle this but this is just a test. */
        myApp.init();
        myApp.start();
View Full Code Here

TOP

Related Classes of org.apache.s4.core.AppModule

Copyright © 2018 www.massapicom. 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.