ZkStoreConfDemo implements Closeable { public DimitPath createChannelConf(String did, String gid, String id, String name, ChannelStatus status, int priority, float tps, List<String> tags) throws IOException { long ct = System.currentTimeMillis(); ChannelConf storeConf = ChannelConf.newBuilder().setCt(ct).setGid(gid).setId(id).setMt(ct).setName(name).setPriority(priority) .setStatus(status).setTps(tps).setV(Const.V).addAllTag(tags).build(); DimitPath path = confPath.newPath(did).newPath(gid).newPath(id); path = dss.io().write(path, storeConf, StoreAttribute.PERSISTENT); LOG.info("create ChannelConf {} {} {}", id, name, path); return path; } ZkStoreConfDemo(String uri); DimitStoreSystem storeSystem(); DimitPath createDimitConf(String id, String name); DimitPath createChannelGroupConf(String did, String id, String name); DimitPath createChannelConf(String did, String gid, String id, String name, ChannelStatus status, int priority, float tps,
            List<String> tags); void removeDimitConf(String id); @Override void close();  }
@Test public void createChannelConf_1() throws IOException { DimitPath path = zkStore.createChannelConf("voice", "vcode", "21001", "ch1", ChannelStatus.PRIMARY, 10, 100f, Arrays.asList(DemoConst.TAG_FIXED, DemoConst.TAG_MOBILE)); DimitConf dimitConf = path.<DimitConf> toStore(DimitConf.class); LOG.info("read dimit {} {}", path, dimitConf); }
@Test public void createChannelConf_2() throws IOException { DimitPath path = zkStore.createChannelConf("voice", "vcode", "21002", "ch2", ChannelStatus.PRIMARY, 8, 100f, Arrays.asList(DemoConst.TAG_FIXED)); DimitConf dimitConf = path.<DimitConf> toStore(DimitConf.class); LOG.info("read dimit {} {}", path, dimitConf); }
@Test public void createChannelConf_3() throws IOException { DimitPath path = zkStore.createChannelConf("voice", "vcode", "21003", "ch3", ChannelStatus.STANDBY, 8, 100f, Arrays.asList(DemoConst.TAG_MOBILE)); DimitConf dimitConf = path.<DimitConf> toStore(DimitConf.class); LOG.info("read dimit {} {}", path, dimitConf); }