Package org.onebusaway.federations

Examples of org.onebusaway.federations.SimpleFederatedService


public class FederatedByBoundsMethodInvocationHandlerImplTest {

  @Test
  public void testSimple() throws Exception {

    SimpleFederatedService mockService = Mockito.mock(SimpleFederatedService.class);
    FederatedServiceCollection mockCollection = Mockito.mock(FederatedServiceCollectionImpl.class);
    Mockito.when(mockCollection.getServiceForBounds(0.0,1.0,2.0,3.0)).thenReturn(mockService);
   
    Method method = SimpleFederatedService.class.getDeclaredMethod("getValueForBounds", Double.TYPE,Double.TYPE,Double.TYPE,Double.TYPE);
    Object[] args = {0.0,1.0,2.0,3.0};
View Full Code Here


    Thread.sleep(TIMEOUT);

    services = _collection.getAllServices();
    assertEquals(1, services.size());

    SimpleFederatedService service = (SimpleFederatedService) _collection.getServiceForAgencyId("A");
    assertEquals("A", service.getValueForId(""));

    _registry.addService("http://localhost:" + PORT + "/service-B/service",
        SimpleFederatedService.class.getName(), new HashMap<String, String>());

    Thread.sleep(TIMEOUT);

    services = _collection.getAllServices();
    assertEquals(2, services.size());

    service = (SimpleFederatedService) _collection.getServiceForAgencyId("A");
    assertEquals("A", service.getValueForId(""));

    service = (SimpleFederatedService) _collection.getServiceForAgencyId("B");
    assertEquals("B", service.getValueForId(""));

    // Simulate a server crash
    _server.stop();
    _server = null;
View Full Code Here

TOP

Related Classes of org.onebusaway.federations.SimpleFederatedService

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.