Permalink
Browse files

fixes some bugs

  • Loading branch information...
Otávio Santana
Otávio Santana committed Jul 5, 2012
1 parent 19e6c21 commit 6094a4df321df331bce80b7e1c1c581c27dd89ab
@@ -230,7 +230,9 @@ public static void closeClients() {
for (EasyCassandraClient conexao : conections) {
conexao.getTransport().close();
}
+ if(referenceSuperColunms.get().size()>0){
DomUtil.getFileDom(referenceSuperColunms.get());
+ }
}
/**
@@ -482,6 +482,7 @@ protected boolean runDeleteCqlCommand(String keyValue, Class persistClass) {
*
*/
public List findByIndex(Object index, Class objectClass) {
+
return findByIndex(index, objectClass, ConsistencyLevelCQL.ONE);
}
@@ -512,7 +513,8 @@ public List findByIndex(Object index, Class objectClass,
*/
public List findByIndex(Object index, Class objectClass,
ConsistencyLevelCQL consistencyLevelCQL, int limit) {
- String indexString = index.toString();
+ String indexString = "'" + EncodingUtil.byteToString(
+ Persistence.getWriteManager().convert(index)) + "'";;
Field indexField = ColumnUtil.getIndexField(objectClass);
if (indexField == null) {
try {
@@ -639,9 +641,9 @@ private boolean createIndex(Exception exception, Logger logger,
index.getIndex());
}
query = new StringBuilder();
- query.append(" CREATE INDEX ");
- query.append(index.getIndex());
- query.append("teste" + " ON ");
+ query.append(" CREATE INDEX ");
+ query.append(index.getIndex().concat("_key"));
+ query.append(" ON ");
query.append(index.getColumnFamily());
query.append(" ( ");
query.append(index.getIndex());
@@ -44,7 +44,9 @@ public WriteDocument(AtomicReference<ColumnFamilyIds> columnReference) {
@Override
public void run() {
while (true) {
+ if(columnReference.get().size()>0){
DomUtil.getFileDom(columnReference.get());
+ }
try {
Thread.sleep(TIME_SLEEP);
} catch (InterruptedException e) {
@@ -22,6 +22,7 @@
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
+import org.easycassandra.persistence.ColumnFamilyIds;
/**
* for Read and write a XML Document
@@ -61,8 +62,9 @@ public static Object getDom(File file,
* @param object
* @return the file within object
*/
- public static File getFileDom(Object object) {
+ public static File getFileDom(ColumnFamilyIds object) {
try {
+
JAXBContext jAXBContext = JAXBContext.newInstance(object.getClass());
Marshaller marshaller = jAXBContext.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
@@ -154,6 +154,21 @@ public void executeCqlTest() {
public void countTest() {
Assert.assertTrue(dao.count()>0);
}
+
+ @Test
+ public void insertWithAcent(){
+ Person person=getPerson();
+ person.setName("Otávio");
+ person.setId(32l);
+ Assert.assertTrue(dao.insert(person));
+ }
+
+ @Test
+ public void retrivetWithAcent(){
+
+
+ Assert.assertTrue(dao.listByIndex("Otávio").size()>0);
+ }
private Address getAddress() {
Address address = new Address();

0 comments on commit 6094a4d

Please sign in to comment.