本文整理汇总了Java中com.stratio.crossdata.common.data.ClusterName类的典型用法代码示例。如果您正苦于以下问题:Java ClusterName类的具体用法?Java ClusterName怎么用?Java ClusterName使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ClusterName类属于com.stratio.crossdata.common.data包,在下文中一共展示了ClusterName类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: retrieveConfiguration
import com.stratio.crossdata.common.data.ClusterName; //导入依赖的package包/类
/**
* Creates a new query job configuration object from the generic one related to the cluster name.
*
* @param clusterName
* Cluster name.
*
* @return A new query job object containing the cluster configuration.
*
* @throws ExecutionException
* If the execution of the required steps fails.
*/
private ExtractorConfig<Cells> retrieveConfiguration(ClusterName clusterName) throws ExecutionException {
DeepConnection deepConnection = null;
deepConnection = (DeepConnection) deepConnectionHandler.getConnection(clusterName.getName());
ExtractorConfig<Cells> extractorConfig;
if (deepConnection != null) {
extractorConfig = deepConnection.getExtractorConfig().clone();
} else {
throw new ExecutionException("Unknown cluster [" + clusterName.toString() + "]");
}
return extractorConfig;
}
示例2: testConnect
import com.stratio.crossdata.common.data.ClusterName; //导入依赖的package包/类
/**
* Establish the connection with DeepSparkContext in order to be able to retrieve metadata from the system columns
* with the connection config.
*
* @param
* @return Whether the connection has been established or not.
*/
@Test
public void testConnect() throws Exception {
ICredentials iCredentials = mock(ICredentials.class);
ClusterName clusterName = new ClusterName(CLUSTER_NAME);
Map<String, String> options = new HashMap<>();
ConnectorClusterConfig config = new ConnectorClusterConfig(clusterName, options, options);
config.setDataStoreName(new DataStoreName(DATASTORE_NAME));
DeepConnectionHandler connectionHandler = mock(DeepConnectionHandler.class);
Whitebox.setInternalState(deepConnector, "connectionHandler", connectionHandler);
deepConnector.connect(iCredentials, config);
verify(connectionHandler, times(1)).createConnection(iCredentials, config);
}
示例3: testClose
import com.stratio.crossdata.common.data.ClusterName; //导入依赖的package包/类
@Test
public void testClose() throws ConnectionException, ExecutionException {
ICredentials iCredentials = mock(ICredentials.class);
ClusterName clusterName = new ClusterName(CLUSTER_NAME);
Map<String, String> options = new HashMap<>();
ConnectorClusterConfig config = new ConnectorClusterConfig(clusterName, options, options);
config.setDataStoreName(new DataStoreName(DATASTORE_NAME));
DeepConnectionHandler connectionHandler = mock(DeepConnectionHandler.class);
Whitebox.setInternalState(deepConnector, "connectionHandler", connectionHandler);
deepConnector.connect(iCredentials, config);
connectionHandler.closeConnection(clusterName.getName());
DeepConnection conn = (DeepConnection) connectionHandler.getConnection(clusterName.getName());
assertNull(conn);
}
示例4: insert
import com.stratio.crossdata.common.data.ClusterName; //导入依赖的package包/类
@Override public void insert(ClusterName targetCluster, TableMetadata targetTable, Row row)
throws ConnectorException {
Object message= row.getCell("message");
if(message==null){
throw new ConnectorException("You must add message column in the insert clause.");
}
IRCManager manager= managers.get(targetCluster);
manager.sendMessage(targetTable.getName().getName(),message.toString());
}
示例5: createIndex
import com.stratio.crossdata.common.data.ClusterName; //导入依赖的package包/类
@Override
public void createIndex(ClusterName targetCluster, IndexMetadata indexMetadata)
throws ConnectorException {
if(indexMetadata.getColumns().size()>1){
throw new ConnectorException("Only supported one column index");
}
if(!indexMetadata.getColumns().containsKey("message")){
throw new ConnectorException("Only supported index in the column message");
}
}
示例6: createProject
import com.stratio.crossdata.common.data.ClusterName; //导入依赖的package包/类
public static Project createProject(String clusterName, String catalogName, String tableName,
List<String> columnList) {
List<ColumnName> columns = new ArrayList<>();
for (String column : columnList) {
columns.add(new ColumnName(catalogName, tableName, column));
}
TableName table = new TableName(catalogName, tableName);
HashSet<Operations> operations = new HashSet<>();
operations.add(Operations.PROJECT);
return new Project(operations, table, new ClusterName(clusterName), columns);
}
示例7: createProject
import com.stratio.crossdata.common.data.ClusterName; //导入依赖的package包/类
private Project createProject(ClusterName clusterName, TableName tableName) {
List<ColumnName> columns = new ArrayList<>();
columns.add(new ColumnName(CATALOG_CONSTANT, tableName.getName(), COLUMN1_CONSTANT));
columns.add(new ColumnName(CATALOG_CONSTANT, tableName.getName(), COLUMN2_CONSTANT));
Set<Operations> operations = new HashSet<>();
operations.add(Operations.PROJECT);
return new Project(operations, tableName, clusterName, columns);
}
示例8: testCreateConnection
import com.stratio.crossdata.common.data.ClusterName; //导入依赖的package包/类
/**
* Method: createConnection(String clusterName, Connection connection)
*/
@Test
public void testCreateConnection() throws Exception {
ICredentials credentials = mock(ICredentials.class);
Map<String, String> options = new HashMap<>();
options.put(ExtractorConstants.HOST, "127.0.0.1");
options.put(ExtractorConstants.HOSTS, "127.0.0.1 , 127.0.0.2");
options.put(ExtractorConstants.PORT, "PORT");
options.put(DeepConnectorConstants.EXTRACTOR_IMPL_CLASS, "PORT");
ConnectorClusterConfig config = new ConnectorClusterConfig(new ClusterName(CLUSTER_NAME), options, options);
config.setDataStoreName(new DataStoreName("cassandra"));
DeepConnection connection = mock(DeepConnection.class);
whenNew(DeepConnection.class).withArguments(credentials, config).thenReturn(connection);
connectionHandler.createConnection(credentials, config);
Map<String, DeepConnection> mapConnection = (Map<String, DeepConnection>) Whitebox.getInternalState(
connectionHandler, "connections");
DeepConnection recoveredConnection = mapConnection.get(CLUSTER_NAME);
assertNotNull("The connection is not null", recoveredConnection);
// assertEquals("The recoveredConnection is correct", connection, recoveredConnection);
}
示例9: close
import com.stratio.crossdata.common.data.ClusterName; //导入依赖的package包/类
@Override public void close(ClusterName name) throws ConnectionException {
LOG.info("Close connection " + name.toString());
IRCManager manager=managers.get(name);
manager.disconnect();
}
示例10: isConnected
import com.stratio.crossdata.common.data.ClusterName; //导入依赖的package包/类
@Override public boolean isConnected(ClusterName name) {
return managers.containsKey(name);
}
示例11: IRCStorageEngine
import com.stratio.crossdata.common.data.ClusterName; //导入依赖的package包/类
public IRCStorageEngine(Map<ClusterName,IRCManager> managers){
this.managers=managers;
}
示例12: delete
import com.stratio.crossdata.common.data.ClusterName; //导入依赖的package包/类
@Override public void delete(ClusterName targetCluster, TableName tableName, Collection<Filter> whereClauses)
throws ConnectorException {
throw new UnsupportedException("Method not implemented");
}
示例13: update
import com.stratio.crossdata.common.data.ClusterName; //导入依赖的package包/类
@Override public void update(ClusterName targetCluster, TableName tableName, Collection<Relation> assignments,
Collection<Filter> whereClauses) throws ConnectorException {
throw new UnsupportedException("Method not implemented");
}
示例14: truncate
import com.stratio.crossdata.common.data.ClusterName; //导入依赖的package包/类
@Override public void truncate(ClusterName targetCluster, TableName tableName) throws ConnectorException {
throw new UnsupportedException("Method not implemented");
}
示例15: IRCMetadataEngine
import com.stratio.crossdata.common.data.ClusterName; //导入依赖的package包/类
public IRCMetadataEngine(Map<ClusterName,IRCManager> managers){
this.managers = managers;
}