Examples of IService


Examples of client.IService

  public void testGetConfigOK() throws Exception{
    ZooKeeper zk = this.initZK();
   
    CountDownLatch connectedSignal = new CountDownLatch(1);
    TestHandler th = new TestHandler(connectedSignal);
    IService iservice = new IService(TestConf.host,null,null,null,"./src/test/tmp");   
    iservice.setEventHandle(Constants.CONNECT_EVENT, th);
    iservice.init();
    connectedSignal.await();
   
    Config config = iservice.createConfig("/iserviceTest/node1");
    DefaultData data = (DefaultData) config.get("node3", 123);
    Assert.assertEquals("node3", data.getData());
   
    this.clearUpZK(zk);
    this.clearUpFiles(TestConf.tmpPath);
View Full Code Here

Examples of client.IService

 
  public void testSetConfigOK() throws Exception {
    ZooKeeper zk = this.initZK();
   
    CountDownLatch connectedSignal = new CountDownLatch(1);
    IService iservice = new IService(TestConf.host,null,null,null,"./src/test/tmp");   
    iservice.setEventHandle(Constants.CONNECT_EVENT, new TestHandler(connectedSignal));
    iservice.init();
    connectedSignal.await();
   
    Config config = iservice.createConfig("/iserviceTest/node1");
    DefaultData data = (DefaultData) config.get("node3", 123);
    Assert.assertEquals("node3", data.getData());
   
   
    CountDownLatch connectedSignal2 = new CountDownLatch(1);
View Full Code Here

Examples of client.IService

  // change local file before update
  public void testSetConfigOK2() throws Exception{
    ZooKeeper zk = this.initZK();
   
    CountDownLatch connectedSignal = new CountDownLatch(1);
    IService iservice = new IService(TestConf.host,null,null,null,"./src/test/tmp");   
    iservice.setEventHandle(Constants.CONNECT_EVENT, new TestHandler(connectedSignal));
    iservice.init();
    connectedSignal.await();
   
    Config config = iservice.createConfig("/iserviceTest/node1");
    DefaultData data = (DefaultData) config.get("node3", 123);
    Assert.assertEquals("node3", data.getData());
   
    FS.dump(TestConf.tmpPath + "/" + Extends.getPid() + "/iserviceTest/node1/node4.data", "version:1\r\nnew-node4");
   
View Full Code Here

Examples of client.IService

    FS.dump(TestConf.tmpPath + "/234/root/node1.data", "version:1\r\ni'm newer info1");
    FS.dump(TestConf.tmpPath + "/234/root/node2.data", "version:0\r\ni'm older info2");
   
    CountDownLatch connectedSignal = new CountDownLatch(1);
    TestHandler th = new TestHandler(connectedSignal);
    IService iservice = new IService("127.0.0.1:6000",null,null,null,"./src/test/tmp");   
    iservice.setEventHandle(Constants.DISCONNECT_EVENT, th);
    iservice.init();
    connectedSignal.await();
   
    Config config = iservice.createConfig("/root/node1");
    DefaultData data = (DefaultData) config.get("info", 111);
    Assert.assertEquals("i'm in newer node", data.getData());
   
    this.clearUpFiles(TestConf.tmpPath);
  }
View Full Code Here

Examples of client.IService

 
  public static void main(String args[]) throws Exception{
    Main2 m = new Main2();
    m.initZk();
   
    IService client = new IService(DemoConf.host, DemoConf.root, "", "", DemoConf.tmpPath);
    client.setEventHandle(Constants.CONNECT_EVENT, new ConnectHandler());
    client.setEventHandle(Constants.DISCONNECT_EVENT, new DisconnectHandler());
    client.setEventHandle(Constants.EXPIRED_EVENT, new ExpiredHandler());
    client.init();
   
    String key = "app2/key1";
    Config config = client.createConfig("/IserviceDemoTest/group1");
    config.setEventHandle(Constants.DATA_CHANGE_EVENT, new DataChangeHandler(config, key));
   
    Timer timer = new Timer();
    TimerTask task = new Main2().new GetDataTask(config);
   
View Full Code Here

Examples of client.IService

 
  public static void main(String args[]) throws Exception{
    Main m = new Main();
    m.initZk();
   
    IService client = new IService(DemoConf.host, DemoConf.root, "", "", DemoConf.tmpPath);
    client.setEventHandle(Constants.CONNECT_EVENT, new ConnectHandler());
    client.setEventHandle(Constants.DISCONNECT_EVENT, new DisconnectHandler());
    client.setEventHandle(Constants.EXPIRED_EVENT, new ExpiredHandler());
    client.init();
   
    String key = "key1";
    Config config = client.createConfig("/IserviceDemoTest/group1/app2");
    config.setEventHandle(Constants.DATA_CHANGE_EVENT, new DataChangeHandler(config, key));
   
    Timer timer = new Timer();
    TimerTask task = new Main().new GetDataTask(config);
   
View Full Code Here

Examples of org.apache.webbeans.test.component.service.IService

        Assert.assertTrue(object instanceof Producer1ConsumerComponent);

        Producer1ConsumerComponent single = (Producer1ConsumerComponent) object;

        IService service = single.getService();

        Assert.assertNotNull(service);

        contextFactory.destroyApplicationContext(null);
        contextFactory.destroyRequestContext(null);
View Full Code Here

Examples of org.apache.webbeans.test.component.service.IService

        Assert.assertEquals(2, comps.size());

        Object producerResult = getInstanceByName("service");
       
        IService producverService = (IService)producerResult;
       
        Assert.assertNotNull(producverService);
       
        Object disposalComp = getManager().getInstance(comps.get(1));
        Object object = getManager().getInstance(comps.get(0));

        Assert.assertTrue(object instanceof ServiceImpl1);
        Assert.assertTrue(disposalComp instanceof DisposalMethodComponent);

        DisposalMethodComponent mc = (DisposalMethodComponent) disposalComp;

        IService s = mc.service();

        Assert.assertNotNull(s);

        contextFactory.destroyApplicationContext(null);
        contextFactory.destroyRequestContext(null);
View Full Code Here

Examples of org.jamesii.core.services.IService

   * availability.
   *
   * @return the next service number
   */
  private synchronized IService getNextService() {
    IService result = null;
    try {
      result = management.get(getNextServiceIndex());
    } catch (ArrayIndexOutOfBoundsException e) {
      SimSystem.report(e);
    }
View Full Code Here

Examples of org.lestr.astenn.remoteimplementation.api.IService

    public static void main(String... args) throws MalformedURLException {

        ServiceLocator.getSingleton().setLocation(new URL("http://localhost:8080/implementation-1.0-SNAPSHOT/org.lestr.astenn.remoteimplementation.api.IService/org.lestr.astenn.remoteimplementation.implementation.Service"));

        IService service = ServiceLocator.getSingleton().getService();

        System.out.println(service.sayHello());

    }// END Method main
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.