Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -133,31 +133,79 @@ public void beforeInvocation(IInvokedMethod testMethod, ITestResult testResult)
}

private boolean scanAnnotatedElement(AnnotatedElement element) {
boolean foundAnnotation = false;
if (element.isAnnotationPresent(ScyllaSkip.class)) {
scyllaSkipCheck();
foundAnnotation = true;
if (CCMBridge.getGlobalScyllaVersion() != null) {
if (element.isAnnotationPresent(ScyllaSkip.class)) {
throw new SkipException("Skipping test because it is disabled for Scylla cluster.");
}

if (element.isAnnotationPresent(ScyllaVersion.class)) {
ScyllaVersion scyllaVersion = element.getAnnotation(ScyllaVersion.class);
scyllaVersionCheck(scyllaVersion);
return true;
}

if (element.isAnnotationPresent(ScyllaOnly.class)) {
return true;
}

if (element.isAnnotationPresent(CassandraVersion.class)) {
CassandraVersion cassandraVersion = element.getAnnotation(CassandraVersion.class);
cassandraVersionCheck(cassandraVersion);
return true;
}

if (element.isAnnotationPresent(DseVersion.class)) {
throw new SkipException(
"Skipping test because it is designed for DSE only, but running on Scylla cluster.");
}

return false;
} else if (CCMBridge.isDse()) {
if (element.isAnnotationPresent(ScyllaOnly.class)) {
throw new SkipException("Skipping test because it is enabled only for Scylla cluster.");
}

if (element.isAnnotationPresent(DseVersion.class)) {
DseVersion dseVersion = element.getAnnotation(DseVersion.class);
dseVersionCheck(dseVersion);
return true;
}

if (element.isAnnotationPresent(CassandraVersion.class)) {
CassandraVersion cassandraVersion = element.getAnnotation(CassandraVersion.class);
cassandraVersionCheck(cassandraVersion);
return true;
}

if (element.isAnnotationPresent(ScyllaVersion.class)) {
throw new SkipException(
"Skipping test because it is designed for Scylla only, but running on DSE cluster.");
}

return false;
}

if (element.isAnnotationPresent(ScyllaOnly.class)) {
scyllaOnlyCheck();
foundAnnotation = true;
throw new SkipException("Skipping test because it is enabled only for Scylla cluster.");
}

if (element.isAnnotationPresent(CassandraVersion.class)) {
CassandraVersion cassandraVersion = element.getAnnotation(CassandraVersion.class);
cassandraVersionCheck(cassandraVersion);
foundAnnotation = true;
}
if (element.isAnnotationPresent(DseVersion.class)) {
DseVersion dseVersion = element.getAnnotation(DseVersion.class);
dseVersionCheck(dseVersion);
foundAnnotation = true;
return true;
}

if (element.isAnnotationPresent(ScyllaVersion.class)) {
ScyllaVersion scyllaVersion = element.getAnnotation(ScyllaVersion.class);
scyllaVersionCheck(scyllaVersion);
foundAnnotation = true;
throw new SkipException(
"Skipping test because it is designed for Scylla only, but running on Cassandra cluster.");
}

if (element.isAnnotationPresent(DseVersion.class)) {
throw new SkipException(
"Skipping test because it is designed for DSE only, but running on Cassandra cluster.");
}
return foundAnnotation;

return false;
}

@Override
Expand Down Expand Up @@ -236,18 +284,6 @@ private static void scyllaVersionCheck(ScyllaVersion annotation) {
}
}

private static void scyllaSkipCheck() {
if (CCMBridge.getGlobalScyllaVersion() != null) {
throw new SkipException("Skipping test because it is disabled for Scylla cluster.");
}
}

private static void scyllaOnlyCheck() {
if (CCMBridge.getGlobalScyllaVersion() == null) {
throw new SkipException("Skipping test because it is enabled only for Scylla cluster.");
}
}

private static void versionCheck(
VersionNumber current, VersionNumber required, String skipString) {
if (current == null) {
Expand Down