本文整理了Java中alluxio.uri.ZookeeperAuthority
类的一些代码示例,展示了ZookeeperAuthority
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZookeeperAuthority
类的具体详情如下:
包路径:alluxio.uri.ZookeeperAuthority
类名称:ZookeeperAuthority
[英]ZookeeperAuthority supports authority containing Zookeeper addresses.
[中]ZookeeperAuthority支持包含Zookeeper地址的权限。
代码示例来源:origin: Alluxio/alluxio
@Override
public Authority toAuthority() {
return new ZookeeperAuthority(mZkAddress);
}
代码示例来源:origin: Alluxio/alluxio
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof ZookeeperAuthority)) {
return false;
}
ZookeeperAuthority that = (ZookeeperAuthority) o;
return toString().equals(that.toString());
}
代码示例来源:origin: Alluxio/alluxio
@Test
public void zookeeperAuthorityTest() {
ZookeeperAuthority authority = (ZookeeperAuthority) Authority.fromString("zk@host:2181");
assertEquals("zk@host:2181", authority.toString());
assertEquals("host:2181", authority.getZookeeperAddress());
authority = (ZookeeperAuthority) Authority
.fromString("zk@127.0.0.1:2181,127.0.0.2:2181,127.0.0.3:2181");
assertEquals("zk@127.0.0.1:2181,127.0.0.2:2181,127.0.0.3:2181", authority.toString());
assertEquals("127.0.0.1:2181,127.0.0.2:2181,127.0.0.3:2181", authority.getZookeeperAddress());
authority = (ZookeeperAuthority) Authority.fromString("zk@host1:2181;host2:2181;host3:2181");
assertEquals("zk@host1:2181,host2:2181,host3:2181", authority.toString());
assertEquals("host1:2181,host2:2181,host3:2181", authority.getZookeeperAddress());
authority = (ZookeeperAuthority) Authority.fromString("zk@host1:2181+host2:2181+host3:2181");
assertEquals("zk@host1:2181,host2:2181,host3:2181", authority.toString());
assertEquals("host1:2181,host2:2181,host3:2181", authority.getZookeeperAddress());
}
代码示例来源:origin: Alluxio/alluxio
alluxioConfProperties.put(PropertyKey.ZOOKEEPER_ENABLED.getName(), true);
alluxioConfProperties.put(PropertyKey.ZOOKEEPER_ADDRESS.getName(),
authority.getZookeeperAddress());
} else if (alluxioUri.getAuthority() instanceof SingleMasterAuthority) {
SingleMasterAuthority authority = (SingleMasterAuthority) alluxioUri.getAuthority();
代码示例来源:origin: Alluxio/alluxio
@Test
public void mixedDelimiters() {
String normalized = "a:0,b:0,c:0";
for (String test : Arrays.asList(
"zk@a:0;b:0+c:0",
"zk@a:0,b:0;c:0",
"zk@a:0+b:0,c:0"
)) {
assertEquals(normalized,
((ZookeeperAuthority) Authority.fromString(test)).getZookeeperAddress());
}
}
}
代码示例来源:origin: Alluxio/alluxio
@Test
public void semicolonZookeeperUri() {
AlluxioURI uri =
new AlluxioURI("alluxio://zk@host1:2181;host2:2181;host3:2181/xy z/a b c");
assertTrue(uri.hasAuthority());
assertEquals("zk@host1:2181,host2:2181,host3:2181", uri.getAuthority().toString());
assertTrue(uri.getAuthority() instanceof ZookeeperAuthority);
ZookeeperAuthority zkAuthority = (ZookeeperAuthority) uri.getAuthority();
assertEquals("host1:2181,host2:2181,host3:2181", zkAuthority.getZookeeperAddress());
}
代码示例来源:origin: Alluxio/alluxio
/**
* Gets the Authority object from the input string.
*
* @param authority the string authority to transfer
* @return an Authority object
*/
static Authority fromString(String authority) {
if (authority == null || authority.length() == 0) {
return NoAuthority.INSTANCE;
}
Matcher matcher = ZOOKEEPER_AUTH.matcher(authority);
if (matcher.matches()) {
return new ZookeeperAuthority(matcher.group(1).replaceAll("[;+]", ","));
} else {
matcher = SINGLE_MASTER_AUTH.matcher(authority);
if (matcher.matches()) {
return new SingleMasterAuthority(matcher.group(1), Integer.parseInt(matcher.group(2)));
} else {
matcher = MULTI_MASTERS_AUTH.matcher(authority);
if (matcher.matches()) {
return new MultiMasterAuthority(authority.replaceAll("[;+]", ","));
}
return new UnknownAuthority(authority);
}
}
}
代码示例来源:origin: Alluxio/alluxio
@Test
public void basicZookeeperUri() {
AlluxioURI uri =
new AlluxioURI("alluxio://zk@host1:2181,host2:2181,host3:2181/xy z/a b c");
assertEquals(uri,
new AlluxioURI("alluxio://zk@host1:2181,host2:2181,host3:2181/xy z/a b c"));
assertEquals("alluxio", uri.getScheme());
assertEquals("zk@host1:2181,host2:2181,host3:2181", uri.getAuthority().toString());
assertTrue(uri.getAuthority() instanceof ZookeeperAuthority);
ZookeeperAuthority zkAuthority = (ZookeeperAuthority) uri.getAuthority();
assertEquals("host1:2181,host2:2181,host3:2181", zkAuthority.getZookeeperAddress());
assertEquals(2, uri.getDepth());
assertEquals("a b c", uri.getName());
assertEquals("alluxio://zk@host1:2181,host2:2181,host3:2181/xy z",
uri.getParent().toString());
assertEquals("alluxio://zk@host1:2181,host2:2181,host3:2181/",
uri.getParent().getParent().toString());
assertEquals("/xy z/a b c", uri.getPath());
assertTrue(uri.hasAuthority());
assertTrue(uri.hasScheme());
assertTrue(uri.isAbsolute());
assertTrue(uri.isPathAbsolute());
assertEquals("alluxio://zk@host1:2181,host2:2181,host3:2181/xy z/a b c/d",
uri.join("/d").toString());
assertEquals("alluxio://zk@host1:2181,host2:2181,host3:2181/xy z/a b c/d",
uri.join(new AlluxioURI("/d"))
.toString());
assertEquals("alluxio://zk@host1:2181,host2:2181,host3:2181/xy z/a b c",
uri.toString());
}
内容来源于网络,如有侵权,请联系作者删除!