Package org.apache.s4.client.util

Examples of org.apache.s4.client.util.ByteArrayIOChannel.send()


                .createSerializerDeserializer(Thread.currentThread().getContextClassLoader());
        for (Long message : messages) {
            Event event = new Event();
            event.put("message", long.class, message);
            event.setStreamId("inputStream");
            emitter.send(0, serDeser.serialize(event));
        }

        // check sequential nodes in zk with correct data
        Assert.assertTrue(signalMessagesReceived.await(10, TimeUnit.SECONDS));
        List<String> children = zkClient.getChildren("/test");
View Full Code Here


        // creating the listener will inject assignment (i.e. assign a partition) and receiver (delegatee for
        // listener, here a mock which simply intercepts the message and notifies through a countdown latch)
        injector2.getInstance(Listener.class);

        // send to the other node
        emitter.send(1, injector1.getInstance(SerializerDeserializer.class).serialize(CommTestUtils.MESSAGE));

        // check receiver got the message
        Assert.assertTrue(CommTestUtils.SIGNAL_MESSAGE_RECEIVED.await(5, TimeUnit.SECONDS));

    }
View Full Code Here

        // creating the listener will inject assignment (i.e. assign a partition) and receiver (delegatee for
        // listener)
        injector2.getInstance(Listener.class);

        // send to the other partition (1)
        emitter.send(1, injector1.getInstance(SerializerDeserializer.class).serialize(CommTestUtils.MESSAGE));

        Assert.assertTrue(CommTestUtils.SIGNAL_MESSAGE_RECEIVED.await(5, TimeUnit.SECONDS));

    }
}
View Full Code Here

            br = new BufferedReader(inputReader);

            // send all messages
            for  (String inputLine = null; (inputLine = br.readLine()) != null;) {
                Message m = new Message(streamName, clazz, inputLine);
                d.send(m);
            }
           
            // read all responses
            while (true) {
                Message response = d.recv();
View Full Code Here

            inputReader = new InputStreamReader(System.in);
            br = new BufferedReader(inputReader);

            for  (String inputLine = null; (inputLine = br.readLine()) != null;) {
                Message m = new Message(streamName, clazz, inputLine);
                d.send(m);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        finally {
View Full Code Here

        try {
            sock = new Socket(hostname, port);

            ByteArrayIOChannel io = new ByteArrayIOChannel(sock);

            io.send(emptyBytes);

            byte[] b = io.recv();

            if (b == null || b.length == 0) {
                if (debug) {
View Full Code Here

        TCPEmitter emitter = injector.getInstance(TCPEmitter.class);

        Event event = new Event();
        event.put("line", String.class, time1);
        emitter.send(0, new EventMessage("-1", "inputStream", injector.getInstance(SerializerDeserializer.class)
                .serialize(event)));

        // check event processed
        Assert.assertTrue(signalEvent1Processed.await(5, TimeUnit.SECONDS));
    }
View Full Code Here

        TCPEmitter emitter = injector.getInstance(TCPEmitter.class);

        Event event = new Event();
        event.put("command", String.class, "setValue1");
        event.put("value", String.class, "message1");
        emitter.send(0, new EventMessage("-1", "inputStream", injector.getInstance(SerializerDeserializer.class)
                .serialize(event)));

        if (manualCheckpointing) {
            insertCheckpointInstruction(injector, emitter);
        }
View Full Code Here

        CoreTestUtils.watchAndSignalCreation("/value2Set", signalValue2Set, zk);

        event = new Event();
        event.put("command", String.class, "setValue2");
        event.put("value", String.class, "message2");
        emitter.send(0, new EventMessage("-1", "inputStream", injector.getInstance(SerializerDeserializer.class)
                .serialize(event)));

        Assert.assertTrue(signalValue2Set.await(10, TimeUnit.SECONDS));

        Assert.assertEquals(expectedFinalResult, new String(zk.getData("/data", false, null)));
View Full Code Here

        Event event = new Event();
        event.put("command", String.class, "setValue1");
        event.put("value", String.class, "message1");
        event.setStreamId("inputStream");
        emitter.send(
                0,
                injector.getInstance(SerializerDeserializerFactory.class)
                        .createSerializerDeserializer(Thread.currentThread().getContextClassLoader()).serialize(event));

        if (manualCheckpointing) {
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.