当前位置: 首页>>代码示例>>Java>>正文


Java TestProtocol类代码示例

本文整理汇总了Java中org.apache.hadoop.ipc.TestRPC.TestProtocol的典型用法代码示例。如果您正苦于以下问题:Java TestProtocol类的具体用法?Java TestProtocol怎么用?Java TestProtocol使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TestProtocol类属于org.apache.hadoop.ipc.TestRPC包,在下文中一共展示了TestProtocol类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testDefaultAcl

import org.apache.hadoop.ipc.TestRPC.TestProtocol; //导入依赖的package包/类
@Test
public void testDefaultAcl() {
  ServiceAuthorizationManager serviceAuthorizationManager = 
      new ServiceAuthorizationManager();
  Configuration conf = new Configuration ();
  // test without setting a default acl
  conf.set(ACL_CONFIG, "user1 group1");
  serviceAuthorizationManager.refresh(conf, new TestPolicyProvider());
  AccessControlList acl = serviceAuthorizationManager.getProtocolsAcls(TestProtocol.class);
  assertEquals("user1 group1", acl.getAclString());
  acl = serviceAuthorizationManager.getProtocolsAcls(TestProtocol1.class);
  assertEquals(AccessControlList.WILDCARD_ACL_VALUE, acl.getAclString());

  // test with a default acl
  conf.set(
      CommonConfigurationKeys.HADOOP_SECURITY_SERVICE_AUTHORIZATION_DEFAULT_ACL, 
      "user2 group2");
  serviceAuthorizationManager.refresh(conf, new TestPolicyProvider());
  acl = serviceAuthorizationManager.getProtocolsAcls(TestProtocol.class);
  assertEquals("user1 group1", acl.getAclString());
  acl = serviceAuthorizationManager.getProtocolsAcls(TestProtocol1.class);
  assertEquals("user2 group2", acl.getAclString());
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:24,代码来源:TestServiceAuthorization.java

示例2: run

import org.apache.hadoop.ipc.TestRPC.TestProtocol; //导入依赖的package包/类
@Override
public void run() {
  try {
    Configuration config = new Configuration(conf);
    config.setInt(IPC_CLIENT_CONNECT_MAX_RETRIES_KEY,
        connectRetries);
    config.setInt(
        IPC_CLIENT_CONNECT_MAX_RETRIES_ON_SOCKET_TIMEOUTS_KEY,
        connectRetries);
    waitStarted = true;
    TestProtocol proxy = RPC.waitForProxy(TestProtocol.class,
        TestProtocol.versionID,
        new InetSocketAddress(ADDRESS, 20),
        config,
        15000L);
    proxy.echo("");
  } catch (Throwable throwable) {
    caught = throwable;
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:21,代码来源:TestRPCWaitForProxy.java

示例3: testNMAuditLoggerWithIP

import org.apache.hadoop.ipc.TestRPC.TestProtocol; //导入依赖的package包/类
/**
 * Test {@link NMAuditLogger} with IP set.
 */
@Test  
public void testNMAuditLoggerWithIP() throws Exception {
  Configuration conf = new Configuration();
  // start the IPC server
  Server server = new RPC.Builder(conf).setProtocol(TestProtocol.class)
      .setInstance(new MyTestRPCServer()).setBindAddress("0.0.0.0")
      .setPort(0).setNumHandlers(5).setVerbose(true).build();

  server.start();

  InetSocketAddress addr = NetUtils.getConnectAddress(server);

  // Make a client connection and test the audit log
  TestProtocol proxy = (TestProtocol)RPC.getProxy(TestProtocol.class,
                         TestProtocol.versionID, addr, conf);
  // Start the testcase
  proxy.ping();

  server.stop();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:TestNMAuditLogger.java

示例4: testRMAuditLoggerWithIP

import org.apache.hadoop.ipc.TestRPC.TestProtocol; //导入依赖的package包/类
/**
 * Test {@link RMAuditLogger} with IP set.
 */
@Test  
public void testRMAuditLoggerWithIP() throws Exception {
  Configuration conf = new Configuration();
  // start the IPC server
  Server server = new RPC.Builder(conf).setProtocol(TestProtocol.class)
      .setInstance(new MyTestRPCServer()).setBindAddress("0.0.0.0")
      .setPort(0).setNumHandlers(5).setVerbose(true).build();
  server.start();

  InetSocketAddress addr = NetUtils.getConnectAddress(server);

  // Make a client connection and test the audit log
  TestProtocol proxy = (TestProtocol)RPC.getProxy(TestProtocol.class,
                         TestProtocol.versionID, addr, conf);
  // Start the testcase
  proxy.ping();

  server.stop();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:TestRMAuditLogger.java

示例5: testAuditLoggerWithIP

import org.apache.hadoop.ipc.TestRPC.TestProtocol; //导入依赖的package包/类
/**
 * Test {@link AuditLogger} with IP set.
 */
public void testAuditLoggerWithIP() throws Exception {
  Configuration conf = new Configuration();
  // start the IPC server
  Server server = new RPC.Builder(conf).setProtocol(TestProtocol.class)
          .setInstance(new MyTestRPCServer()).setBindAddress("0.0.0.0")
          .setPort(0).build();
  server.start();

  InetSocketAddress addr = NetUtils.getConnectAddress(server);

  // Make a client connection and test the audit log
  TestProtocol proxy = (TestProtocol)RPC.getProxy(TestProtocol.class,
                         TestProtocol.versionID, addr, conf);
  // Start the testcase
  proxy.ping();

  server.stop();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:TestAuditLogger.java

示例6: testAuditLoggerWithIP

import org.apache.hadoop.ipc.TestRPC.TestProtocol; //导入依赖的package包/类
/**
 * Test {@link AuditLogger} with IP set.
 */
@SuppressWarnings("deprecation")
public void testAuditLoggerWithIP() throws Exception {
  Configuration conf = new Configuration();
  // start the IPC server
  Server server = RPC.getServer(new MyTestRPCServer(), "0.0.0.0", 0, conf);
  server.start();

  InetSocketAddress addr = NetUtils.getConnectAddress(server);

  // Make a client connection and test the audit log
  TestProtocol proxy = (TestProtocol)RPC.getProxy(TestProtocol.class,
                         TestProtocol.versionID, addr, conf);
  // Start the testcase
  proxy.ping();

  server.stop();
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:21,代码来源:TestAuditLogger.java

示例7: testDefaultAcl

import org.apache.hadoop.ipc.TestRPC.TestProtocol; //导入依赖的package包/类
@Test
public void testDefaultAcl() {
  ServiceAuthorizationManager serviceAuthorizationManager = 
      new ServiceAuthorizationManager();
  Configuration conf = new Configuration ();
  //test without setting a default acl
  conf.set(ACL_CONFIG, "user1 group1");
  serviceAuthorizationManager.refresh(conf, new TestPolicyProvider());
  AccessControlList acl = serviceAuthorizationManager.getProtocolsAcls(TestProtocol.class);
  assertEquals("user1 group1", acl.getAclString());
  acl = serviceAuthorizationManager.getProtocolsAcls(TestProtocol1.class);
  assertEquals(AccessControlList.WILDCARD_ACL_VALUE, acl.getAclString());

  //test with a default acl
  conf.set(
      CommonConfigurationKeys.HADOOP_SECURITY_SERVICE_AUTHORIZATION_DEFAULT_ACL, 
      "user2 group2");
  serviceAuthorizationManager.refresh(conf, new TestPolicyProvider());
  acl = serviceAuthorizationManager.getProtocolsAcls(TestProtocol.class);
  assertEquals("user1 group1", acl.getAclString());
  acl = serviceAuthorizationManager.getProtocolsAcls(TestProtocol1.class);
  assertEquals("user2 group2", acl.getAclString());
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:24,代码来源:TestServiceAuthorization.java

示例8: testAuditLoggerWithIP

import org.apache.hadoop.ipc.TestRPC.TestProtocol; //导入依赖的package包/类
/**
 * Test {@link AuditLogger} with IP set.
 */
public void testAuditLoggerWithIP() throws Exception {
  Configuration conf = new Configuration();
  // start the IPC server
  Server server = RPC.getServer(new MyTestRPCServer(), "0.0.0.0", 0, conf);
  server.start();
  
  InetSocketAddress addr = NetUtils.getConnectAddress(server);
  
  // Make a client connection and test the audit log
  TestProtocol proxy = (TestProtocol)RPC.getProxy(TestProtocol.class, 
                         TestProtocol.versionID, addr, conf);
  // Start the testcase
  proxy.ping();

  server.stop();
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:20,代码来源:TestAuditLogger.java

示例9: testAuditLoggerWithIP

import org.apache.hadoop.ipc.TestRPC.TestProtocol; //导入依赖的package包/类
/**
 * Test {@link AuditLogger} with IP set.
 */
@Test
public void testAuditLoggerWithIP() throws Exception {
  Configuration conf = new Configuration();
  // start the IPC server
  Server server = new RPC.Builder(conf).setProtocol(TestProtocol.class)
          .setInstance(new MyTestRPCServer()).setBindAddress("0.0.0.0")
          .setPort(0).build();
  server.start();

  InetSocketAddress addr = NetUtils.getConnectAddress(server);

  // Make a client connection and test the audit log
  TestProtocol proxy = (TestProtocol)RPC.getProxy(TestProtocol.class,
                         TestProtocol.versionID, addr, conf);
  // Start the testcase
  proxy.ping();

  server.stop();
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:23,代码来源:TestAuditLogger.java


注:本文中的org.apache.hadoop.ipc.TestRPC.TestProtocol类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。