本文整理汇总了Java中org.apache.accumulo.minicluster.MiniAccumuloCluster.getInstanceName方法的典型用法代码示例。如果您正苦于以下问题:Java MiniAccumuloCluster.getInstanceName方法的具体用法?Java MiniAccumuloCluster.getInstanceName怎么用?Java MiniAccumuloCluster.getInstanceName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.accumulo.minicluster.MiniAccumuloCluster
的用法示例。
在下文中一共展示了MiniAccumuloCluster.getInstanceName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: teardownRya
import org.apache.accumulo.minicluster.MiniAccumuloCluster; //导入方法依赖的package包/类
@After
public void teardownRya() {
final MiniAccumuloCluster cluster = getMiniAccumuloCluster();
final String instanceName = cluster.getInstanceName();
final String zookeepers = cluster.getZooKeepers();
// Uninstall the instance of Rya.
final RyaClient ryaClient = AccumuloRyaClientFactory.build(
new AccumuloConnectionDetails(ACCUMULO_USER, ACCUMULO_PASSWORD.toCharArray(), instanceName, zookeepers),
super.getAccumuloConnector());
try {
ryaClient.getUninstall().uninstall(RYA_INSTANCE_NAME);
// Shutdown the repo.
if(ryaSailRepo != null) {ryaSailRepo.shutDown();}
if(dao != null ) {dao.destroy();}
} catch (final Exception e) {
System.out.println("Encountered the following Exception when shutting down Rya: " + e.getMessage());
}
}
示例2: installRyaInstance
import org.apache.accumulo.minicluster.MiniAccumuloCluster; //导入方法依赖的package包/类
private void installRyaInstance() throws Exception {
final MiniAccumuloCluster cluster = super.getMiniAccumuloCluster();
final String instanceName = cluster.getInstanceName();
final String zookeepers = cluster.getZooKeepers();
// Install the Rya instance to the mini accumulo cluster.
final RyaClient ryaClient = AccumuloRyaClientFactory.build(
new AccumuloConnectionDetails(ACCUMULO_USER, ACCUMULO_PASSWORD.toCharArray(), instanceName, zookeepers),
super.getAccumuloConnector());
ryaClient.getInstall().install(RYA_INSTANCE_NAME,
InstallConfiguration.builder().setEnableTableHashPrefix(false).setEnableFreeTextIndex(false)
.setEnableEntityCentricIndex(false).setEnableGeoIndex(false).setEnableTemporalIndex(false).setEnablePcjIndex(true)
.setFluoPcjAppName(super.getFluoConfiguration().getApplicationName()).build());
// Connect to the Rya instance that was just installed.
final AccumuloRdfConfiguration conf = makeConfig(instanceName, zookeepers);
final Sail sail = RyaSailFactory.getInstance(conf);
dao = RyaSailFactory.getAccumuloDAOWithUpdatedConfig(conf);
ryaSailRepo = new RyaSailRepository(sail);
}
示例3: connectAccumulo
import org.apache.accumulo.minicluster.MiniAccumuloCluster; //导入方法依赖的package包/类
@Test
public void connectAccumulo() throws IOException {
final MiniAccumuloCluster cluster = getCluster();
final Bootstrap bootstrap = getTestBootstrap();
final JLineShellComponent shell = getTestShell();
// Mock the user entering the correct password.
final ApplicationContext context = bootstrap.getApplicationContext();
final PasswordPrompt mockPrompt = context.getBean( PasswordPrompt.class );
when(mockPrompt.getPassword()).thenReturn("password".toCharArray());
// Execute the connect command.
final String cmd =
RyaConnectionCommands.CONNECT_ACCUMULO_CMD + " " +
"--username root " +
"--instanceName " + cluster.getInstanceName() + " "+
"--zookeepers " + cluster.getZooKeepers();
final CommandResult connectResult = shell.executeCommand(cmd);
// Ensure the connection was successful.
assertTrue( connectResult.isSuccess() );
}
示例4: connectAccumulo_wrongCredentials
import org.apache.accumulo.minicluster.MiniAccumuloCluster; //导入方法依赖的package包/类
@Test
public void connectAccumulo_wrongCredentials() throws IOException {
final MiniAccumuloCluster cluster = getCluster();
final Bootstrap bootstrap = getTestBootstrap();
final JLineShellComponent shell = getTestShell();
// Mock the user entering the wrong password.
final ApplicationContext context = bootstrap.getApplicationContext();
final PasswordPrompt mockPrompt = context.getBean( PasswordPrompt.class );
when(mockPrompt.getPassword()).thenReturn("asjifo[ijwa".toCharArray());
// Execute the command
final String cmd =
RyaConnectionCommands.CONNECT_ACCUMULO_CMD + " " +
"--username root " +
"--instanceName " + cluster.getInstanceName() + " "+
"--zookeepers " + cluster.getZooKeepers();
final CommandResult connectResult = shell.executeCommand(cmd);
// Ensure the command failed.
assertFalse( connectResult.isSuccess() );
}
示例5: connectToInstance_instanceDoesNotExist
import org.apache.accumulo.minicluster.MiniAccumuloCluster; //导入方法依赖的package包/类
@Test
public void connectToInstance_instanceDoesNotExist() throws IOException {
final MiniAccumuloCluster cluster = getCluster();
final Bootstrap bootstrap = getTestBootstrap();
final JLineShellComponent shell = getTestShell();
// Mock the user entering the correct password.
final ApplicationContext context = bootstrap.getApplicationContext();
final PasswordPrompt mockPrompt = context.getBean( PasswordPrompt.class );
when(mockPrompt.getPassword()).thenReturn("password".toCharArray());
// Connect to the mini accumulo instance.
String cmd =
RyaConnectionCommands.CONNECT_ACCUMULO_CMD + " " +
"--username root " +
"--instanceName " + cluster.getInstanceName() + " "+
"--zookeepers " + cluster.getZooKeepers();
shell.executeCommand(cmd);
// Try to connect to a non-existing instance.
cmd = RyaConnectionCommands.CONNECT_INSTANCE_CMD + " --instance doesNotExist";
final CommandResult result = shell.executeCommand(cmd);
assertFalse( result.isSuccess() );
}
示例6: disconnect
import org.apache.accumulo.minicluster.MiniAccumuloCluster; //导入方法依赖的package包/类
@Test
public void disconnect() throws IOException {
final MiniAccumuloCluster cluster = getCluster();
final Bootstrap bootstrap = getTestBootstrap();
final JLineShellComponent shell = getTestShell();
// Mock the user entering the correct password.
final ApplicationContext context = bootstrap.getApplicationContext();
final PasswordPrompt mockPrompt = context.getBean( PasswordPrompt.class );
when(mockPrompt.getPassword()).thenReturn("password".toCharArray());
// Connect to the mini accumulo instance.
final String cmd =
RyaConnectionCommands.CONNECT_ACCUMULO_CMD + " " +
"--username root " +
"--instanceName " + cluster.getInstanceName() + " "+
"--zookeepers " + cluster.getZooKeepers();
shell.executeCommand(cmd);
// Disconnect from it.
final CommandResult disconnectResult = shell.executeCommand( RyaConnectionCommands.DISCONNECT_COMMAND_NAME_CMD );
assertTrue( disconnectResult.isSuccess() );
}
示例7: createAccumuloCluster
import org.apache.accumulo.minicluster.MiniAccumuloCluster; //导入方法依赖的package包/类
@BeforeClass
public static void createAccumuloCluster() throws Exception {
macDir = File.createTempFile("miniaccumulocluster", null);
Assert.assertTrue(macDir.delete());
Assert.assertTrue(macDir.mkdir());
macDir.deleteOnExit();
MiniAccumuloConfig config = new MiniAccumuloConfig(macDir, "");
config.setNumTservers(2);
mac = new MiniAccumuloCluster(config);
mac.start();
ZooKeeperInstance zkInst = new ZooKeeperInstance(mac.getInstanceName(), mac.getZooKeepers());
Connector c = zkInst.getConnector("root", new PasswordToken(""));
// Add in auths for "en"
c.securityOperations().changeUserAuthorizations("root", new Authorizations("en"));
zk = new TestingServer();
}
示例8: setupMAC
import org.apache.accumulo.minicluster.MiniAccumuloCluster; //导入方法依赖的package包/类
@BeforeClass
public static void setupMAC() throws Exception {
File tmp = Files.createTempDir();
tmp.deleteOnExit();
conf = new MiniAccumuloConfig(tmp, "foo");
conf.setNumTservers(2);
mac = new MiniAccumuloCluster(conf);
mac.start();
ZooKeeperInstance zkInst = new ZooKeeperInstance(mac.getInstanceName(), mac.getZooKeepers());
Connector con = zkInst.getConnector("root", new PasswordToken("foo"));
con.tableOperations().create(Defaults.DATA_TABLE);
con.tableOperations().create(Defaults.METADATA_TABLE);
zk = new TestingServer();
}
示例9: startMiniAccumulo
import org.apache.accumulo.minicluster.MiniAccumuloCluster; //导入方法依赖的package包/类
/**
* Setup a Mini Accumulo cluster that uses a temporary directory to store its data.
*
* @return A Mini Accumulo cluster.
*/
private static MiniAccumuloCluster startMiniAccumulo() throws IOException, InterruptedException, AccumuloException, AccumuloSecurityException {
final File miniDataDir = Files.createTempDir();
// Setup and start the Mini Accumulo.
final MiniAccumuloCluster accumulo = new MiniAccumuloCluster(miniDataDir, "password");
accumulo.start();
// Store a connector to the Mini Accumulo.
final Instance instance = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers());
accumuloConn = instance.getConnector("root", new PasswordToken("password"));
return accumulo;
}
示例10: startMiniAccumulo
import org.apache.accumulo.minicluster.MiniAccumuloCluster; //导入方法依赖的package包/类
private static MiniAccumuloCluster startMiniAccumulo() throws IOException, InterruptedException, AccumuloException, AccumuloSecurityException {
final File miniDataDir = Files.createTempDir();
// Setup and start the Mini Accumulo.
final MiniAccumuloCluster accumulo = new MiniAccumuloCluster(
miniDataDir, "password");
accumulo.start();
// Store a connector to the Mini Accumulo.
final Instance instance = new ZooKeeperInstance(
accumulo.getInstanceName(), accumulo.getZooKeepers());
accCon = instance.getConnector("root", new PasswordToken("password"));
return accumulo;
}
示例11: printConnectionDetails_connectedToAccumulo
import org.apache.accumulo.minicluster.MiniAccumuloCluster; //导入方法依赖的package包/类
@Test
public void printConnectionDetails_connectedToAccumulo() throws IOException {
final MiniAccumuloCluster cluster = getCluster();
final Bootstrap bootstrap = getTestBootstrap();
final JLineShellComponent shell = getTestShell();
// Mock the user entering the correct password.
final ApplicationContext context = bootstrap.getApplicationContext();
final PasswordPrompt mockPrompt = context.getBean( PasswordPrompt.class );
when(mockPrompt.getPassword()).thenReturn("password".toCharArray());
// Connect to the mini accumulo instance.
final String cmd =
RyaConnectionCommands.CONNECT_ACCUMULO_CMD + " " +
"--username root " +
"--instanceName " + cluster.getInstanceName() + " "+
"--zookeepers " + cluster.getZooKeepers();
shell.executeCommand(cmd);
// Run the print connection details command.
final CommandResult printResult = shell.executeCommand( RyaConnectionCommands.PRINT_CONNECTION_DETAILS_CMD );
final String msg = (String) printResult.getResult();
final String expected =
"The shell is connected to an instance of Accumulo using the following parameters:\n" +
" Username: root\n" +
" Instance Name: " + cluster.getInstanceName() + "\n" +
" Zookeepers: " + cluster.getZooKeepers();
assertEquals(expected, msg);
}
示例12: testRFileReaderRDDCanBeCreatedAndIsNonEmpty
import org.apache.accumulo.minicluster.MiniAccumuloCluster; //导入方法依赖的package包/类
@Test
public void testRFileReaderRDDCanBeCreatedAndIsNonEmpty() throws IOException,
InterruptedException, AccumuloSecurityException, AccumuloException, TableNotFoundException,
TableExistsException, StoreException {
// Given
final String table = "table1";
final MiniAccumuloCluster cluster = MiniAccumuloClusterProvider.getMiniAccumuloCluster();
// Add some data
final Connector connector = cluster.getConnector(MiniAccumuloClusterProvider.USER,
MiniAccumuloClusterProvider.PASSWORD);
connector.tableOperations().create(table);
final BatchWriter bw = connector.createBatchWriter(table, new BatchWriterConfig());
final Mutation m1 = new Mutation("row");
m1.put("CF", "CQ", "value");
bw.addMutation(m1);
final Mutation m2 = new Mutation("row2");
m2.put("CF", "CQ", "not");
bw.addMutation(m2);
bw.close();
// Compact to ensure an RFile is created, sleep to give it a little time to do it
connector.tableOperations().compact(table, new CompactionConfig());
Thread.sleep(1000L);
// When
final SparkSession sparkSession = SparkSessionProvider.getSparkSession();
final Configuration conf = new Configuration();
InputConfigurator.fetchColumns(AccumuloInputFormat.class, conf,
Sets.newHashSet(new Pair<>(new Text("CF"), new Text("CQ"))));
final RFileReaderRDD rdd = new RFileReaderRDD(sparkSession.sparkContext(),
cluster.getInstanceName(), cluster.getZooKeepers(), MiniAccumuloClusterProvider.USER,
MiniAccumuloClusterProvider.PASSWORD, table, new HashSet<>(),
serialiseConfiguration(conf));
final long count = rdd.count();
// Then
assertEquals(2L, count);
}
示例13: accumuloInit
import org.apache.accumulo.minicluster.MiniAccumuloCluster; //导入方法依赖的package包/类
public void accumuloInit()
throws AccumuloException,
AccumuloSecurityException,
IOException,
InterruptedException,
SchemaException {
final String miniEnabled = System.getProperty("miniAccumulo");
if ((miniEnabled != null) && miniEnabled.equalsIgnoreCase("false")) {
mode = AccumuloMode.DEPLOYED_ACCUMULO;
}
TYPE = DataUtilities.createType(
"TestPoint",
"location:Point:srid=4326,dim1:Double,dim2:Double,dim3:Double,startTime:Date,stopTime:Date,index:String");
if (mode == AccumuloMode.MINI_ACCUMULO) {
tempDir = Files.createTempDir();
tempDir.deleteOnExit();
log.debug(tempDir.getAbsolutePath());
final MiniAccumuloConfig config = new MiniAccumuloConfig(
tempDir,
DEFAULT_MINI_ACCUMULO_PASSWORD);
config.setNumTservers(4);
miniAccumulo = new MiniAccumuloCluster(
config);
miniAccumulo.start();
zookeeperUrl = miniAccumulo.getZooKeepers();
instancename = miniAccumulo.getInstanceName();
username = "root";
password = DEFAULT_MINI_ACCUMULO_PASSWORD;
}
else if (mode == AccumuloMode.DEPLOYED_ACCUMULO) {
zookeeperUrl = System.getProperty("zookeeperUrl");
instancename = System.getProperty("instance");
username = System.getProperty("username");
password = System.getProperty("password");
}
else {
// intentionally left blank
}
}
示例14: setup
import org.apache.accumulo.minicluster.MiniAccumuloCluster; //导入方法依赖的package包/类
@BeforeClass
public static void setup() throws Exception {
// Squash loud logs.
Logger.getLogger(ClientCnxn.class).setLevel(Level.ERROR);
// Setup the Mini Accumulo Cluster.
final File miniDataDir = com.google.common.io.Files.createTempDir();
final MiniAccumuloConfig cfg = new MiniAccumuloConfig( miniDataDir, ACCUMULO_PASSWORD);
cluster = new MiniAccumuloCluster(cfg);
cluster.start();
// Create a Rya Client connected to the Mini Accumulo Cluster.
final AccumuloConnectionDetails connDetails = new AccumuloConnectionDetails(
ACCUMULO_USER,
ACCUMULO_PASSWORD.toCharArray(),
cluster.getInstanceName(),
cluster.getZooKeepers());
final Connector connector = cluster.getConnector(ACCUMULO_USER, ACCUMULO_PASSWORD);
final RyaClient ryaClient = AccumuloRyaClientFactory.build(connDetails, connector);
// Install an instance of Rya on the mini cluster.
installRya(ryaClient);
// Get a Sail object that is backed by the Rya store that is on the mini cluster.
final AccumuloRdfConfiguration ryaConf = new AccumuloRdfConfiguration();
ryaConf.setTablePrefix(RYA_INSTANCE_NAME);
ryaConf.set(ConfigUtils.CLOUDBASE_USER, ACCUMULO_USER);
ryaConf.set(ConfigUtils.CLOUDBASE_PASSWORD, ACCUMULO_PASSWORD);
ryaConf.set(ConfigUtils.CLOUDBASE_ZOOKEEPERS, cluster.getZooKeepers());
ryaConf.set(ConfigUtils.CLOUDBASE_INSTANCE, cluster.getInstanceName());
ryaConf.set(ConfigUtils.USE_PCJ, "true");
ryaConf.set(ConfigUtils.PCJ_STORAGE_TYPE, PrecomputedJoinStorageType.ACCUMULO.toString());
ryaConf.set(ConfigUtils.PCJ_UPDATER_TYPE, PrecomputedJoinUpdaterType.NO_UPDATE.toString());
sail = RyaSailFactory.getInstance( ryaConf );
// Load some data into the cluster that will match the query we're testing against.
loadTestStatements();
// Add a PCJ to the application that summarizes the query.
createTestPCJ(ryaClient);
}
示例15: connectToInstance
import org.apache.accumulo.minicluster.MiniAccumuloCluster; //导入方法依赖的package包/类
@Test
public void connectToInstance() throws IOException {
final MiniAccumuloCluster cluster = getCluster();
final Bootstrap bootstrap = getTestBootstrap();
final JLineShellComponent shell = getTestShell();
// Mock the user entering the correct password.
final ApplicationContext context = bootstrap.getApplicationContext();
final PasswordPrompt mockPrompt = context.getBean( PasswordPrompt.class );
when(mockPrompt.getPassword()).thenReturn("password".toCharArray());
// Connect to the mini accumulo instance.
String cmd =
RyaConnectionCommands.CONNECT_ACCUMULO_CMD + " " +
"--username root " +
"--instanceName " + cluster.getInstanceName() + " "+
"--zookeepers " + cluster.getZooKeepers();
CommandResult result = shell.executeCommand(cmd);
// Install an instance of rya.
final String instanceName = "testInstance";
final InstallConfiguration installConf = InstallConfiguration.builder().build();
final InstallPrompt installPrompt = context.getBean( InstallPrompt.class );
when(installPrompt.promptInstanceName()).thenReturn("testInstance");
when(installPrompt.promptInstallConfiguration("testInstance")).thenReturn( installConf );
when(installPrompt.promptVerified(instanceName, installConf)).thenReturn(true);
result = shell.executeCommand( RyaAdminCommands.INSTALL_CMD );
assertTrue( result.isSuccess() );
// Connect to the instance that was just installed.
cmd = RyaConnectionCommands.CONNECT_INSTANCE_CMD + " --instance " + instanceName;
result = shell.executeCommand(cmd);
assertTrue( result.isSuccess() );
// Verify the shell state indicates it is connected to an instance.
final SharedShellState sharedState = context.getBean( SharedShellState.class );
final ShellState state = sharedState.getShellState();
assertEquals(ConnectionState.CONNECTED_TO_INSTANCE, state.getConnectionState());
}