我应该想用一个带赫克托的柜台来装卡桑德拉。我从 hector的测试代码中复制/粘贴这个测试用例:
Mutator<String> m = createMutator(keyspace, se);
MutationResult mr = m.insertCounter( // exception here.
"k", "Counter1", createCounterColumn("name", 5));
assertTrue("Execution time on single counter insert should be > 0", mr.getExecutionTimeMicro() > 0);
assertTrue("Should have operated on a host", mr.getHostUsed() != null);
CounterQuery<String, String> counter = new ThriftCounterColumnQuery<String,String>(keyspace, se, se);
counter.setColumnFamily("Counter1").setKey("k").setName("name");
assertEquals(new Long(5), counter.execute().get().getValue());
但是我在insertCounter行上得到了这个异常,因为 Counter1 未配置,他说:
me.prettyprint.hector.api.exceptions.HInvalidRequestException: InvalidRequestException(why:unconfigured columnfamily Counter1)
at me.prettyprint.cassandra.service.ExceptionsTranslatorImpl.translate(ExceptionsTranslatorImpl.java:45) ~[hector-core-1.0-5.jar:na]
at me.prettyprint.cassandra.connection.HConnectionManager.operateWithFailover(HConnectionManager.java:264) ~[hector-core-1.0-5.jar:na]
at me.prettyprint.cassandra.model.ExecutingKeyspace.doExecuteOperation(ExecutingKeyspace.java:97) ~[hector-core-1.0-5.jar:na]
at me.prettyprint.cassandra.model.MutatorImpl.execute(MutatorImpl.java:243) ~[hector-core-1.0-5.jar:na]
at me.prettyprint.cassandra.model.MutatorImpl.insertCounter(MutatorImpl.java:285) ~[hector-core-1.0-5.jar:na]
好的,但是测试用例没有配置 Counter1 ?我如何配置它?
谢谢。