Search in sources :

Example 1 with SysSvcImpl

use of com.emc.storageos.systemservices.impl.SysSvcImpl in project coprhd-controller by CoprHD.

the class TestSysServiceBeacon method testBeacon.

@Test
@Ignore("This references a configuration that doesn't exist (syssvc-config.xml), either fix or delete this test")
public void testBeacon() throws Exception {
    String curVersion = "current_version";
    ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("/syssvc-config.xml");
    SysSvcImpl sysservice = (SysSvcImpl) ctx.getBean(SERVICE_BEAN);
    sysservice.start();
    ServiceImpl svc = (ServiceImpl) ctx.getBean(SERVICE_INFO);
    CoordinatorClient client = connectClient();
    SysSvcBeaconImpl beacon = (SysSvcBeaconImpl) ctx.getBean(BEACON_BEAN);
    List<Service> found = client.locateAllServices(svc.getName(), svc.getVersion(), (String) null, null);
    Assert.assertNotNull(found);
    Assert.assertEquals(found.size(), 1);
    Service first = found.get(0);
    Assert.assertEquals(first.getId(), svc.getId());
    Assert.assertEquals(first.getEndpoint(), svc.getEndpoint());
    Assert.assertEquals(first.getAttribute(curVersion), null);
    svc.setAttribute(curVersion, "2");
    beacon.publish();
    found = client.locateAllServices(svc.getName(), svc.getVersion(), (String) null, null);
    Assert.assertNotNull(found);
    Assert.assertEquals(found.size(), 1);
    first = found.get(0);
    Assert.assertEquals(first.getId(), svc.getId());
    Assert.assertEquals(first.getEndpoint(), svc.getEndpoint());
    Assert.assertEquals(first.getAttribute(curVersion), "2");
    sysservice.stop();
}
Also used : SysSvcBeaconImpl(com.emc.storageos.systemservices.impl.SysSvcBeaconImpl) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) SysSvcImpl(com.emc.storageos.systemservices.impl.SysSvcImpl) ServiceImpl(com.emc.storageos.coordinator.common.impl.ServiceImpl) CoordinatorClient(com.emc.storageos.coordinator.client.service.CoordinatorClient) Service(com.emc.storageos.coordinator.common.Service) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

CoordinatorClient (com.emc.storageos.coordinator.client.service.CoordinatorClient)1 Service (com.emc.storageos.coordinator.common.Service)1 ServiceImpl (com.emc.storageos.coordinator.common.impl.ServiceImpl)1 SysSvcBeaconImpl (com.emc.storageos.systemservices.impl.SysSvcBeaconImpl)1 SysSvcImpl (com.emc.storageos.systemservices.impl.SysSvcImpl)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)1