use of com.emc.storageos.db.client.impl.DbClientImpl in project coprhd-controller by CoprHD.
the class Cassandraforplugin method returnDBClient.
public static DbClient returnDBClient() throws IOException {
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("/dbutils-conf.xml");
DbClientImpl dbClient = (DbClientImpl) ctx.getBean("dbclient");
dbClient.setClusterName("StorageOS");
dbClient.setKeyspaceName("StorageOS");
dbClient.start();
return dbClient;
}
use of com.emc.storageos.db.client.impl.DbClientImpl in project coprhd-controller by CoprHD.
the class SMICommunicationInterfaceTest method testVNXBlockPlugin.
// Need to start coordinator & DB service, before running this test
@Test
public void testVNXBlockPlugin() {
try {
final SMICommunicationInterface _smiplugin = (SMICommunicationInterface) _context.getBean("block");
Map<String, Object> map1 = new ConcurrentHashMap<String, Object>();
Set<String> idset = new HashSet<String>();
idset.add("SYMMETRIX+000194900404+VOLUME+00000");
map1.put("000194900404-block-Volumes", idset);
_smiplugin.injectCache(map1);
_smiplugin.injectDBClient(new DbClientImpl());
_smiplugin.scan(createAccessProfile());
// sleeptest(_smiplugin);
} catch (Exception e) {
_LOGGER.error(e.getMessage(), e);
}
}
use of com.emc.storageos.db.client.impl.DbClientImpl in project coprhd-controller by CoprHD.
the class RowMutationTest method insertRecordAndIndexColumnWithError.
@Test
public void insertRecordAndIndexColumnWithError() throws ConnectionException {
String rowKey = URIUtil.createId(Volume.class).toString();
String volumeLabel = "volume label";
// insert data object
ColumnListMutation<CompositeColumnName> columnList = rowMutator.getRecordColumnList(volumeCF, rowKey);
columnList.putColumn(new CompositeColumnName("allocatedCapacity"), 20);
columnList.putColumn(new CompositeColumnName("label"), volumeLabel);
// insert related index
rowMutator.getIndexColumnList(indexCF, "vo").putColumn(new IndexColumnName("Volume", volumeLabel, volumeLabel, rowKey, rowMutator.getTimeUUID()), "");
// insert error column
ColumnListMutation<CompositeColumnName> no_columnList = rowMutator.getRecordColumnList(noExistCF, rowKey);
no_columnList.putColumn(new CompositeColumnName("test"), 20);
try {
rowMutator.execute();
Assert.fail();
} catch (Exception e) {
// expected exception
}
// no volume should be created
Volume volume = (Volume) this.getDbClient().queryObject(URI.create(rowKey));
Assert.assertNull(volume);
// no index should be created
CqlStatement statement = ((DbClientImpl) this.getDbClient()).getLocalContext().getKeyspace().prepareCqlStatement();
String cql = String.format("select * from \"LabelPrefixIndex\" where key='%s' and column1='Volume' and column2='%s' and column3='%s' and column4='%s'", "vo", volumeLabel, volumeLabel, rowKey);
CqlStatementResult result = statement.withCql(cql).execute().getResult();
Rows<String, IndexColumnName> rows = result.getRows(indexCF);
Assert.assertEquals(rows.size(), 0);
}
use of com.emc.storageos.db.client.impl.DbClientImpl in project coprhd-controller by CoprHD.
the class DbConsistencyCheckerHelperTest method setUp.
@Before
public void setUp() throws Exception {
Map<Long, String> timeStampVersionMap = new TreeMap<Long, String>();
timeStampVersionMap.put(TIME_STAMP_2_4_1, "2.4.1");
timeStampVersionMap.put(TIME_STAMP_3_0, "3.0");
timeStampVersionMap.put(TIME_STAMP_3_5, "3.5");
timeStampVersionMap.put(TIME_STAMP_3_6, "3.6");
helper = new DbConsistencyCheckerHelper((DbClientImpl) getDbClient()) {
@Override
protected Map<Long, String> querySchemaVersions() {
return timeStampVersionMap;
}
};
}
use of com.emc.storageos.db.client.impl.DbClientImpl in project coprhd-controller by CoprHD.
the class DbConsistencyCheckerHelperTest method testIsIndexExists.
@Test
public void testIsIndexExists() throws Exception {
FileShare testData = new FileShare();
testData.setId(URIUtil.createId(FileShare.class));
testData.setPath("path1");
testData.setMountPath("mountPath1");
getDbClient().createObject(testData);
ColumnFamily<String, IndexColumnName> indexCF = new ColumnFamily<String, IndexColumnName>("AltIdIndex", StringSerializer.get(), IndexColumnNameSerializer.get());
Keyspace keyspace = ((DbClientImpl) getDbClient()).getLocalContext().getKeyspace();
CompositeRangeBuilder builder = IndexColumnNameSerializer.get().buildRange();
builder.withPrefix("FileShare").greaterThanEquals(testData.getId().toString()).lessThanEquals(testData.getId().toString());
Rows<String, IndexColumnName> result = keyspace.prepareQuery(indexCF).getAllRows().withColumnRange(builder).execute().getResult();
for (Row<String, IndexColumnName> row : result) {
System.out.println(row.getColumns().getColumnByIndex(0).getName());
assertTrue(helper.isIndexExists(keyspace, indexCF, row.getKey(), row.getColumns().getColumnByIndex(0).getName()));
}
((DbClientImpl) getDbClient()).internalRemoveObjects(testData);
for (Row<String, IndexColumnName> row : result) {
assertFalse(helper.isIndexExists(keyspace, indexCF, row.getKey(), row.getColumns().getColumnByIndex(0).getName()));
}
}
Aggregations