File tree Expand file tree Collapse file tree 3 files changed +45
-0
lines changed
driver-core/src/test/java/com/datastax/driver/core Expand file tree Collapse file tree 3 files changed +45
-0
lines changed Original file line number Diff line number Diff line change 10
10
import static org .mockito .Mockito .times ;
11
11
import static org .mockito .Mockito .verify ;
12
12
13
+ import com .datastax .driver .core .utils .ScyllaOnly ;
13
14
import java .util .Collection ;
14
15
import org .testng .annotations .Test ;
15
16
16
17
@ CreateCCM (CreateCCM .TestMode .PER_METHOD )
18
+ @ ScyllaOnly
17
19
public class ScyllaSniProxyTest extends CCMTestsSupport {
18
20
19
21
private void test_ccm_cluster (int testNodes ) {
Original file line number Diff line number Diff line change 23
23
24
24
import com .datastax .driver .core .utils .CassandraVersion ;
25
25
import com .datastax .driver .core .utils .DseVersion ;
26
+ import com .datastax .driver .core .utils .ScyllaOnly ;
26
27
import com .datastax .driver .core .utils .ScyllaSkip ;
27
28
import java .lang .reflect .AnnotatedElement ;
28
29
import java .lang .reflect .Method ;
@@ -129,6 +130,10 @@ private boolean scanAnnotatedElement(AnnotatedElement element) {
129
130
scyllaSkipCheck ();
130
131
foundAnnotation = true ;
131
132
}
133
+ if (element .isAnnotationPresent (ScyllaOnly .class )) {
134
+ scyllaOnlyCheck ();
135
+ foundAnnotation = true ;
136
+ }
132
137
if (element .isAnnotationPresent (CassandraVersion .class )) {
133
138
CassandraVersion cassandraVersion = element .getAnnotation (CassandraVersion .class );
134
139
cassandraVersionCheck (cassandraVersion );
@@ -173,6 +178,12 @@ private static void scyllaSkipCheck() {
173
178
}
174
179
}
175
180
181
+ private static void scyllaOnlyCheck () {
182
+ if (CCMBridge .getGlobalScyllaVersion () == null ) {
183
+ throw new SkipException ("Skipping test because it is enabled only for Scylla cluster." );
184
+ }
185
+ }
186
+
176
187
private static void versionCheck (
177
188
VersionNumber current , VersionNumber required , String skipString ) {
178
189
if (current == null ) {
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (C) 2022 ScyllaDB
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ package com .datastax .driver .core .utils ;
18
+
19
+ import java .lang .annotation .Retention ;
20
+ import java .lang .annotation .RetentionPolicy ;
21
+
22
+ /**
23
+ * Annotation for a Class or Method that skips a test when NOT testing with Scylla.
24
+ *
25
+ * @see com.datastax.driver.core.TestListener#beforeInvocation(org.testng.IInvokedMethod,
26
+ * org.testng.ITestResult)
27
+ */
28
+ @ Retention (RetentionPolicy .RUNTIME )
29
+ public @interface ScyllaOnly {
30
+ /** @return The description returned if the Scylla requirement is not met. */
31
+ String description () default "Marked skip when not testing with Scylla." ;
32
+ }
You can’t perform that action at this time.
0 commit comments