user1653027
user1653027

Reputation: 809

cassandraunit throws Dataset not found error

I am using cassandra-unit 3.0.0.1 from here but it is throwing dataset not found error

@Rule
public CassandraCQLUnit cassProvider = new CassandraCQLUnit(new ClassPathCQLDataSet("simple.cql","keyspaceNameToCreate"));

is there any other plugins i need to use or is it a bug in cassandra-unit?

EDITED

I have run my test in debug mode and found that the getInputDataSetLocation is returning null for me in ClassPathCQLDataSet.java

protected InputStream getInputDataSetLocation(String dataSetLocation) {  //dataSetLocation: "simple.sql"
    InputStream inputDataSetLocation = this.getClass().getResourceAsStream("/" + dataSetLocation);  // inputDataSetLocation: null
//when i run test for cassandraunit-example app i get BufferedInputStream@924 but I am getting null here which is causing error
    return inputDataSetLocation;
}

Please let me know if i am missing anything here. Thanks a ton

Upvotes: 0

Views: 560

Answers (1)

Shishir
Shishir

Reputation: 326

Before I started to encounter dataset not found error error, was working with the following

public static String CASSANDRA_KEYSPACE = "profile_data";
public static String CASSANDRA_SCHEMA = "profiles_test.cql";
ClassPathCQLDataSet dataSet = new ClassPathCQLDataSet(CASSANDRA_SCHEMA,CASSANDRA_KEYSPACE);

After facing the error found a workaround by using

public static String CASSANDRA_KEYSPACE = "profile_data";
public static String CASSANDRA_SCHEMA = "src/test/resources/profiles_test.cql";
FileCQLDataSet dataSet = new FileCQLDataSet(CASSANDRA_SCHEMA, CASSANDRA_KEYSPACE);

If the above does not work maybe you can try with SimpleCQLDataSet and check

Upvotes: 0

Related Questions