Package com.hellblazer.slp

Examples of com.hellblazer.slp.ServiceScope


            public void execute(Runnable command) {
                command.run();
            }
        };

        ServiceScope localScope = new LocalScope(
                                                 executor,
                                                 Generators.randomBasedGenerator());
        ServiceURL url1 = new ServiceURL("service:http://foo.bar/two");
        ServiceURL url2 = new ServiceURL("service:http://foo.bar/one");

        localScope.addServiceListener(serviceListener, "(" + SERVICE_TYPE
                                                       + "=service:http)");

        UUID reference1 = localScope.register(url1,
                                              new HashMap<String, String>());
        localScope.register(url2, new HashMap<String, String>());
        localScope.setProperties(reference1, new HashMap<String, String>());
        localScope.unregister(reference1);

        ArgumentCaptor<ServiceEvent> eventCaptor = ArgumentCaptor.forClass(ServiceEvent.class);
        verify(serviceListener, new Times(4)).serviceChanged(eventCaptor.capture());
        List<ServiceEvent> events = eventCaptor.getAllValues();
        assertNotNull(events);
View Full Code Here


            public void execute(Runnable command) {
                command.run();
            }
        };

        ServiceScope localScope = new LocalScope(
                                                 executor,
                                                 Generators.randomBasedGenerator());
        ServiceURL url1 = new ServiceURL("service:http://foo.bar/one");
        ServiceURL url2 = new ServiceURL("service:http://foo.bar/two");

        UUID reference1 = localScope.register(url1,
                                              new HashMap<String, String>());
        String serviceType = "service:http";
        assertEquals(url1, localScope.getServiceReference(serviceType).getUrl());

        localScope.register(url2, new HashMap<String, String>());
        List<ServiceReference> references = localScope.getServiceReferences(serviceType,
                                                                            "");
        assertNotNull(references);
        assertEquals(2, references.size());
        Set<ServiceURL> urls = new HashSet<ServiceURL>();
        urls.add(references.get(0).getUrl());
        urls.add(references.get(1).getUrl());
        assertTrue(urls.contains(url1));
        assertTrue(urls.contains(url2));
        localScope.unregister(reference1);
        references = localScope.getServiceReferences(serviceType, "");
        assertEquals(1, references.size());
        assertEquals(url2, references.get(0).getUrl());
    }
View Full Code Here

TOP

Related Classes of com.hellblazer.slp.ServiceScope

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.