@RunWith(Parameterized.class) @Category({ ReplicationTests.class, LargeTests.class }) public class TestReplicationSmallTestsSync extends TestReplicationSmallTests { @ClassRule public static final HBaseClassTestRule CLASS_RULE = HBaseClassTestRule.forClass(TestReplicationSmallTestsSync.class); @Override protected boolean isSyncPeer() { return true; } }
private static Class<?>[] directCategories(Description description) { if (description == null) { return new Class<?>[0]; } Category annotation= description.getAnnotation(Category.class); return annotation == null ? new Class<?>[0] : annotation.value(); }
@RunWith(SpringRunner.class) @TestExecutionListeners({ TransactionalTestExecutionListener.class, DependencyInjectionTestExecutionListener.class }) @Category(CategoryComponentTest.class) public abstract class ComponentDbTest extends DbTest { private EntityManager entityManager; @Inject private TestCleaner testUtility;
@Category(RequiresOpenshift.class) @RequiresOpenshift @RunWith(ArquillianConditionalRunner.class) public class HelloPodDeploymentOpenShiftITCase { @ArquillianResource private URL base; @Deployment(testable = false) public static WebArchive deploy() { return ShrinkWrap.create(WebArchive.class) .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); } @Test public void shouldBeAbleToInjectURL() throws Exception { Assert.assertNotNull(base); } }
/** Integration tests for database admin functionality: DDL etc. */ @Category(IntegrationTest.class) @RunWith(JUnit4.class) public class ITDatabaseTest { @ClassRule public static IntegrationTestEnv env = new IntegrationTestEnv(); @Rule public ExpectedException expectedException = ExpectedException.none(); @Test public void badDdl() { expectedException.expect(isSpannerException(ErrorCode.INVALID_ARGUMENT)); expectedException.expectMessage("Syntax error on line 1"); env.getTestHelper().createTestDatabase("CREATE TABLE T ( Illegal Way To Define A Table )"); } }
@RunWith(Parameterized.class) @Category(AsyncLoggers.class) public class AsyncLoggerThreadContextDefaultTest extends AbstractAsyncThreadContextTestBase { @Parameterized.Parameters public static Collection<Object[]> data() { return Arrays.asList(new Object[][] { { ContextImpl.WEBAPP, Mode.ALL_ASYNC}, { ContextImpl.WEBAPP, Mode.BOTH_ALL_ASYNC_AND_MIXED}, }); } public AsyncLoggerThreadContextDefaultTest(final ContextImpl contextImpl, final Mode asyncMode) { super(contextImpl, asyncMode); } }
@Category({ RegionServerTests.class, SmallTests.class }) public class TestReadOnlyConfiguration { @ClassRule public static final HBaseClassTestRule CLASS_RULE = HBaseClassTestRule.forClass(TestReadOnlyConfiguration.class); @Rule public TestName name = new TestName(); @Test public void testAddDefaultResource() { Configuration configuration = new Configuration(); Configuration readOnlyConf = new ReadOnlyConfiguration(configuration); configuration.addDefaultResource("abc.xml"); } }
@Category({LuceneTest.class}) public class LuceneIndexImplJUnitTest { public static final String REGION = "region"; public static final String INDEX = "index"; public static final int MAX_WAIT = 30000; private InternalCache cache; private LuceneIndex index; @Rule public ExpectedException thrown = ExpectedException.none(); @Before public void createLuceneIndex() { cache = Fakes.cache(); index = new LuceneIndexForPartitionedRegion(INDEX, REGION, cache); } }
@Category(SerialTests.class) public class EmbeddedLogTest extends KCVSLogTest { @BeforeClass public static void startCassandra() { CassandraStorageSetup.startCleanEmbedded(); } @Override public KeyColumnValueStoreManager openStorageManager() throws BackendException { return new CassandraEmbeddedStoreManager(CassandraStorageSetup.getEmbeddedConfiguration(getClass().getSimpleName())); } }
@Category(RequiresOpenshift.class) @RunWith(ArquillianConditionalRunner.class) @RequiresOpenshift public class HelloOpenShiftRestAssuredIT { @ArquillianResource RequestSpecBuilder requestSpecBuilder; @Test public void testGreetingEndpoint() { given(requestSpecBuilder.build()) .when().get() .then() .statusCode(200) .body(containsString("Hello OpenShift!")); } } // end::openshift_restassured_example[]
@RunWith(Parameterized.class) @Category({ RegionServerTests.class, SmallTests.class }) public class TestWALConfiguration { private static final Logger LOG = LoggerFactory.getLogger(TestWALConfiguration.class); static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); @ClassRule public static final HBaseClassTestRule CLASS_RULE = HBaseClassTestRule.forClass(TestWALConfiguration.class); @Rule public TestName name = new TestName();
@RunWith(Parameterized.class) @Category(AsyncLoggers.class) public class AsyncLoggerThreadContextCopyOnWriteTest extends AbstractAsyncThreadContextTestBase { @Parameterized.Parameters(name = "{0} {1}") public static Collection<Object[]> data() { return Arrays.asList(new Object[][] { { ContextImpl.COPY_ON_WRITE, Mode.ALL_ASYNC}, { ContextImpl.COPY_ON_WRITE, Mode.BOTH_ALL_ASYNC_AND_MIXED} }); } public AsyncLoggerThreadContextCopyOnWriteTest(final ContextImpl contextImpl, final Mode asyncMode) { super(contextImpl, asyncMode); } }
@Category({SmallTests.class}) public class TestRetriesExhaustedWithDetailsException { @ClassRule public static final HBaseClassTestRule CLASS_RULE = HBaseClassTestRule.forClass(TestRetriesExhaustedWithDetailsException.class); @Rule public TestName name = new TestName(); /** * Assert that a RetriesExhaustedException that has RegionTooBusyException outputs region name. */ @Test public void testRegionTooBusyException() { List<Throwable> ts = new ArrayList<>(1); final String regionName = this.name.getMethodName(); ts.add(new RegionTooBusyException(regionName)); List<Row> rows = new ArrayList<>(1); rows.add(Mockito.mock(Row.class)); List<String> hostAndPorts = new ArrayList<>(1); hostAndPorts.add("example.com:1234"); RetriesExhaustedException ree = new RetriesExhaustedWithDetailsException(ts, rows, hostAndPorts); assertTrue(ree.toString().contains(regionName)); } }
/** * Unit tests for {@link AlertingAction}. */ @Category(AlertingTest.class) public class AlertingActionTest { @Rule public ErrorCollector errorCollector = new ErrorCollector(); @Test public void isThreadAlertingIsFalseByDefault() { assertThat(isThreadAlerting()).isFalse(); } @Test public void isThreadAlertingIsTrueWhileExecuting() { execute(() -> errorCollector.checkThat(isThreadAlerting(), is(true))); } @Test public void isThreadAlertingIsFalseAfterExecuting() { execute(() -> System.out.println("hi")); assertThat(isThreadAlerting()).isFalse(); } }
@Category({RegionServerTests.class, LargeTests.class}) public class TestWALSplitCompressed extends TestWALSplit { @ClassRule public static final HBaseClassTestRule CLASS_RULE = HBaseClassTestRule.forClass(TestWALSplitCompressed.class); @BeforeClass public static void setUpBeforeClass() throws Exception { TestWALSplit.setUpBeforeClass(); TEST_UTIL.getConfiguration().setBoolean(HConstants.ENABLE_WAL_COMPRESSION, true); } }
@Category(SerialTests.class) public class ThriftLogTest extends KCVSLogTest { @BeforeClass public static void startCassandra() { CassandraStorageSetup.startCleanEmbedded(); } @Override public KeyColumnValueStoreManager openStorageManager() throws BackendException { return new CassandraThriftStoreManager(CassandraStorageSetup.getCassandraThriftConfiguration(this.getClass().getSimpleName())); } }