Examples of ChannelID


Examples of org.cometd.bayeux.ChannelId

        CountDownLatch latch = new CountDownLatch(1);
        Object service = new ListenerWithParametersService(latch, value);
        boolean processed = processor.process(service);
        assertTrue(processed);

        String parentChannel = new ChannelId(ListenerWithParametersService.CHANNEL).getParent();

        // Fake a publish
        LocalSession remote = bayeuxServer.newLocalSession("remote");
        remote.handshake();
        ServerMessage.Mutable message = bayeuxServer.newMessage();
View Full Code Here

Examples of org.cometd.bayeux.ChannelId

        CountDownLatch latch = new CountDownLatch(1);
        Object service = new ListenerWithParametersNotBindingService(latch);
        boolean processed = processor.process(service);
        assertTrue(processed);

        String parentChannel = new ChannelId(ListenerWithParametersNotBindingService.CHANNEL).getParent();
        String grandParentChannel = new ChannelId(parentChannel).getParent();

        // Fake a publish
        LocalSession remote = bayeuxServer.newLocalSession("remote");
        remote.handshake();
        ServerMessage.Mutable message = bayeuxServer.newMessage();
View Full Code Here

Examples of org.cometd.bayeux.ChannelId

        CountDownLatch latch = new CountDownLatch(1);
        Object service = new SubscriberWithParametersService(latch, value);
        boolean processed = processor.process(service);
        assertTrue(processed);

        String parentChannel = new ChannelId(SubscriberWithParametersService.CHANNEL).getParent();

        // Fake a publish
        LocalSession remote = bayeuxServer.newLocalSession("remote");
        remote.handshake();
        ServerMessage.Mutable message = bayeuxServer.newMessage();
View Full Code Here

Examples of org.cometd.bayeux.ChannelId

                        if (ChannelId.isMeta(channel))
                            throw new IllegalArgumentException("Annotation @" + Subscription.class.getSimpleName() +
                                    " on method '" + method.getName() + "' on class '" +
                                    method.getDeclaringClass().getName() + "' must specify a non meta channel");

                        ChannelId channelId = new ChannelId(channel);
                        if (channelId.isTemplate())
                            channel = channelId.getWilds().get(0);

                        SubscriptionCallback subscriptionCallback = new SubscriptionCallback(clientSession, bean, method, paramNames, channelId, channel);
                        // We should delay the subscription if the client session did not complete the handshake
                        if (clientSession.isHandshook())
                            clientSession.getChannel(channel).subscribe(subscriptionCallback);
View Full Code Here

Examples of org.cometd.bayeux.ChannelId

public class ChannelIdTest
{
    @Test
    public void testDepth()
    {
        Assert.assertEquals(1, new ChannelId("/foo").depth());
        Assert.assertEquals(1, new ChannelId("/foo/").depth());
        Assert.assertEquals(2, new ChannelId("/foo/bar").depth());
        Assert.assertEquals(2, new ChannelId("/foo/bar/").depth());
        Assert.assertEquals(3, new ChannelId("/foo/bar/*").depth());
        Assert.assertEquals(3, new ChannelId("/foo/bar/**").depth());
    }
View Full Code Here

Examples of org.cometd.bayeux.ChannelId

    }

    @Test
    public void testSegments()
    {
        ChannelId channel = new ChannelId("/foo/bar");

        Assert.assertEquals("foo", channel.getSegment(0));
        Assert.assertEquals("bar", channel.getSegment(1));

        Assert.assertNull(channel.getSegment(2));
        Assert.assertNull(channel.getSegment(3));
    }
View Full Code Here

Examples of org.cometd.bayeux.ChannelId

    }

    @Test
    public void testIsXxx()
    {
        ChannelId id;

        id = new ChannelId("/foo/bar");
        Assert.assertFalse(id.isDeepWild());
        Assert.assertFalse(id.isMeta());
        Assert.assertFalse(id.isService());
        Assert.assertFalse(id.isWild());

        id = new ChannelId("/foo/*");
        Assert.assertTrue(id.isShallowWild());
        Assert.assertFalse(id.isDeepWild());
        Assert.assertFalse(id.isMeta());
        Assert.assertFalse(id.isService());
        Assert.assertTrue(id.isWild());

        id = new ChannelId("/foo/**");
        Assert.assertTrue(id.isDeepWild());
        Assert.assertFalse(id.isMeta());
        Assert.assertFalse(id.isService());
        Assert.assertTrue(id.isWild());

        id = new ChannelId("/meta/bar");
        Assert.assertFalse(id.isDeepWild());
        Assert.assertTrue(id.isMeta());
        Assert.assertFalse(id.isService());
        Assert.assertFalse(id.isWild());

        id = new ChannelId("/service/bar");
        Assert.assertFalse(id.isDeepWild());
        Assert.assertFalse(id.isMeta());
        Assert.assertTrue(id.isService());
        Assert.assertFalse(id.isWild());

        id = new ChannelId("/service/**");
        Assert.assertTrue(id.isDeepWild());
        Assert.assertFalse(id.isMeta());
        Assert.assertTrue(id.isService());
        Assert.assertTrue(id.isWild());

        id = new ChannelId("/service/{var}");
        Assert.assertFalse(id.isMeta());
        Assert.assertTrue(id.isService());
        Assert.assertFalse(id.isWild());
        Assert.assertTrue(id.isTemplate());
    }
View Full Code Here

Examples of org.cometd.bayeux.ChannelId

    }

    @Test
    public void testIsParent()
    {
        ChannelId foo = new ChannelId("/foo");
        ChannelId bar = new ChannelId("/bar");
        ChannelId foobar = new ChannelId("/foo/bar");
        ChannelId foobarbaz = new ChannelId("/foo/bar/baz");

        Assert.assertFalse(foo.isParentOf(foo));
        Assert.assertTrue(foo.isParentOf(foobar));
        Assert.assertFalse(foo.isParentOf(foobarbaz));
View Full Code Here

Examples of org.cometd.bayeux.ChannelId

    }

    @Test
    public void testEquals()
    {
        ChannelId foobar0 = new ChannelId("/foo/bar");
        ChannelId foobar1 = new ChannelId("/foo/bar/");
        ChannelId foo = new ChannelId("/foo");
        ChannelId wild = new ChannelId("/foo/*");
        ChannelId deep = new ChannelId("/foo/**");

        Assert.assertTrue(foobar0.equals(foobar0));
        Assert.assertTrue(foobar0.equals(foobar1));

        Assert.assertFalse(foobar0.equals(foo));
View Full Code Here

Examples of org.cometd.bayeux.ChannelId

    }

    @Test
    public void testMatches()
    {
        ChannelId foobar0 = new ChannelId("/foo/bar");
        ChannelId foobar1 = new ChannelId("/foo/bar");
        ChannelId foobarbaz = new ChannelId("/foo/bar/baz");
        ChannelId foo = new ChannelId("/foo");
        ChannelId wild = new ChannelId("/foo/*");
        ChannelId deep = new ChannelId("/foo/**");

        Assert.assertTrue(foobar0.matches(foobar0));
        Assert.assertTrue(foobar0.matches(foobar1));

        Assert.assertFalse(foo.matches(foobar0));
        Assert.assertTrue(wild.matches(foobar0));
        Assert.assertTrue(deep.matches(foobar0));

        Assert.assertFalse(foo.matches(foobarbaz));
        Assert.assertFalse(wild.matches(foobarbaz));
        Assert.assertTrue(deep.matches(foobarbaz));
    }
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.