Exemplo n.º 1
0
  public void getDiscoveryServices(
      DiscoveryServiceComponent component,
      TestStub dsTestStub,
      List<ServiceID> dsList,
      boolean modified) {
    DiscoveryService discoveryService = (DiscoveryService) getDiscoveryServiceProxy();
    ObjectDeployment dsOD = getDiscoveryServiceControlDeployment(component);

    DiscoveryService ds = (DiscoveryService) dsTestStub.getObject();

    AcceptanceTestUtil.publishTestObject(
        component, dsTestStub.getDeploymentID(), ds, DiscoveryService.class);

    AcceptanceTestUtil.setExecutionContext(component, dsOD, dsTestStub.getDeploymentID());

    CommuneLogger logger = component.getLogger();

    logger.debug(
        "The Discovery Service "
            + dsTestStub.getDeploymentID().getServiceID()
            + " requested my network list");
    EasyMock.replay(logger);

    ds.hereAreDiscoveryServices(DiscoveryServicesServiceIDListMatcher.eqMatcher(dsList));
    EasyMock.replay(ds);

    discoveryService.getDiscoveryServices(ds);

    EasyMock.verify(logger);
    EasyMock.verify(ds);
    EasyMock.reset(logger);
    EasyMock.reset(ds);
  }
  public void execute(DSHereAreDiscoveryServicesResponseTO response, ServiceManager manager) {
    Set<DiscoveryServiceInfo> discoveryServices = response.getDiscoveryServices();

    List<ServiceID> dsIDs = new ArrayList<ServiceID>();

    for (DiscoveryServiceInfo ds : discoveryServices) {
      dsIDs.add(ServiceID.parse(ds.getDsAddress()));
    }

    DiscoveryService ds =
        (DiscoveryService)
            manager.getStub(ServiceID.parse(response.getStubAddress()), DiscoveryService.class);

    ds.hereAreDiscoveryServices(dsIDs);
  }