下面列出了怎么用org.junit.jupiter.api.condition.DisabledIfSystemProperty的API类实例代码及写法,或者点击链接到github查看源代码。
@DisabledIfSystemProperty(named = "aws-service.instance.type", matches = "remote")
@Test
@Timeout(value = 120)
@RepeatedTest(3)
public void testBasicSendReceiveUsingKafkaStyle() {
try {
Properties amazonProperties = awsService.getConnectionProperties();
ConnectorPropertyFactory testProperties = CamelAWSSQSPropertyFactory
.basic()
.withName("CamelAwssqsSinkConnectorKafkaStyle")
.withTopics(TestUtils.getDefaultTestTopic(this.getClass()))
.withAmazonConfig(amazonProperties, CamelAWSSQSPropertyFactory.KAFKA_STYLE)
.withQueueNameOrArn(queueName);
runTest(testProperties);
} catch (Exception e) {
LOG.error("Amazon SQS test failed: {}", e.getMessage(), e);
fail(e.getMessage());
}
}
@DisabledIfSystemProperty(named = "aws-service.instance.type", matches = "remote")
@Test
@Timeout(90)
public void testBasicSendReceiveUsingUrl() throws ExecutionException, InterruptedException {
Properties amazonProperties = service.getConnectionProperties();
ConnectorPropertyFactory connectorPropertyFactory = CamelAWSSQSPropertyFactory
.basic()
.withKafkaTopic(TestUtils.getDefaultTestTopic(this.getClass()))
.withUrl(queueName)
.append("accessKey", amazonProperties.getProperty(AWSConfigs.ACCESS_KEY))
.append("secretKey", amazonProperties.getProperty(AWSConfigs.SECRET_KEY))
.append("protocol", amazonProperties.getProperty(AWSConfigs.PROTOCOL))
.appendIfAvailable("amazonAWSHost", amazonProperties.getProperty(AWSConfigs.AMAZON_AWS_HOST))
.append("region", amazonProperties.getProperty(AWSConfigs.REGION, Regions.US_EAST_1.name()))
.buildUrl();
runTest(connectorPropertyFactory);
}
@DisabledIfSystemProperty(named = "test.mysql.version", matches = "5\\.5(\\.\\d+)?")
@Test
void timeDuration6() {
long seconds = TimeUnit.HOURS.toSeconds(8) + TimeUnit.MINUTES.toSeconds(5) + 45;
Duration one = Duration.ofSeconds(0, -1000);
Duration aDuration = Duration.ofSeconds(seconds, 45_610_000);
Duration oneDay = Duration.ofSeconds(-TimeUnit.DAYS.toSeconds(1), -1000);
Duration oneDayOne = Duration.ofSeconds(TimeUnit.DAYS.toSeconds(1), 1000);
LocalTime aTime = LocalTime.of(8, 5, 45, 45_610_000);
LocalTime lastMicro = LocalTime.of(23, 59, 59, 999_999_000);
LocalTime firstMicro = LocalTime.of(0, 0, 0, 1000);
List<Tuple2<Duration, LocalTime>> dataCases = Arrays.asList(
Tuples.of(one, lastMicro),
Tuples.of(oneDay, lastMicro),
Tuples.of(oneDayOne, firstMicro),
Tuples.of(aDuration, aTime)
);
String tdl = "CREATE TEMPORARY TABLE test(id INT PRIMARY KEY AUTO_INCREMENT,value TIME(6))";
complete(connection -> Mono.from(connection.createStatement(tdl).execute())
.flatMap(IntegrationTestSupport::extractRowsUpdated)
.thenMany(Flux.fromIterable(dataCases)
.concatMap(pair -> testTimeDuration(connection, pair.getT1(), pair.getT2()))));
}
@DisabledIfSystemProperty(named = "test.mysql.version", matches = "5\\.[56](\\.\\d+)?")
@Test
void json() {
create().flatMap(connection -> Mono.from(connection.createStatement(TDL).execute())
.flatMap(IntegrationTestSupport::extractRowsUpdated)
.thenMany(insert(connection))
.flatMap(IntegrationTestSupport::extractRowsUpdated)
.thenMany(connection.createStatement("SELECT value FROM test WHERE id > ?")
.bind(0, 0)
.execute())
.concatMap(r -> r.map((row, meta) -> row.get(0, Bar.class)))
.collectList())
.as(StepVerifier::create)
.expectNext(Arrays.asList(BARS))
.verifyComplete();
}
@DisabledIfSystemProperty(named = "test.mysql.version", matches = "5\\.5(\\.\\d+)?")
@Test
void timeDuration6() {
long seconds = TimeUnit.HOURS.toSeconds(8) + TimeUnit.MINUTES.toSeconds(5) + 45;
Duration one = Duration.ofSeconds(0, -1000);
Duration aDuration = Duration.ofSeconds(seconds, 45_610_000);
Duration oneDay = Duration.ofSeconds(-TimeUnit.DAYS.toSeconds(1), -1000);
Duration oneDayOne = Duration.ofSeconds(TimeUnit.DAYS.toSeconds(1), 1000);
LocalTime aTime = LocalTime.of(8, 5, 45, 45_610_000);
LocalTime lastMicro = LocalTime.of(23, 59, 59, 999_999_000);
LocalTime firstMicro = LocalTime.of(0, 0, 0, 1000);
List<Tuple2<Duration, LocalTime>> dataCases = Arrays.asList(
Tuples.of(one, lastMicro),
Tuples.of(oneDay, lastMicro),
Tuples.of(oneDayOne, firstMicro),
Tuples.of(aDuration, aTime)
);
String tdl = "CREATE TEMPORARY TABLE test(id INT PRIMARY KEY AUTO_INCREMENT,value TIME(6))";
complete(connection -> Mono.from(connection.createStatement(tdl).execute())
.flatMap(IntegrationTestSupport::extractRowsUpdated)
.thenMany(Flux.fromIterable(dataCases)
.concatMap(pair -> testTimeDuration(connection, pair.getT1(), pair.getT2()))));
}
@DisabledIfSystemProperty(named = "test.mysql.version", matches = "5\\.[56](\\.\\d+)?")
@Test
void json() {
create().flatMap(connection -> Mono.from(connection.createStatement(TDL).execute())
.flatMap(IntegrationTestSupport::extractRowsUpdated)
.thenMany(insert(connection))
.flatMap(IntegrationTestSupport::extractRowsUpdated)
.thenMany(connection.createStatement("SELECT value FROM test WHERE id > ?")
.bind(0, 0)
.execute())
.concatMap(r -> r.map((row, meta) -> row.get(0, Bar.class)))
.collectList())
.as(StepVerifier::create)
.expectNext(Arrays.asList(BARS))
.verifyComplete();
}
@DisabledIfSystemProperty(named = "aws-service.instance.type", matches = "remote")
@Test
@Timeout(value = 120)
@RepeatedTest(3)
public void testBasicSendReceiveUsingUrl() {
try {
Properties amazonProperties = awsService.getConnectionProperties();
ConnectorPropertyFactory testProperties = CamelAWSSQSPropertyFactory
.basic()
.withName("CamelAwssqsSinkConnectorUsingUrl")
.withTopics(TestUtils.getDefaultTestTopic(this.getClass()))
.withUrl(queueName)
.append("autoCreateQueue", "true")
.append("accessKey", amazonProperties.getProperty(AWSConfigs.ACCESS_KEY))
.append("secretKey", amazonProperties.getProperty(AWSConfigs.SECRET_KEY))
.append("protocol", amazonProperties.getProperty(AWSConfigs.PROTOCOL))
.append("region", amazonProperties.getProperty(AWSConfigs.REGION, Regions.US_EAST_1.name()))
.append("amazonAWSHost", amazonProperties.getProperty(AWSConfigs.AMAZON_AWS_HOST))
.buildUrl();
runTest(testProperties);
} catch (Exception e) {
LOG.error("Amazon SQS test failed: {}", e.getMessage(), e);
fail(e.getMessage());
}
}
@DisabledIfSystemProperty(named = "aws-service.instance.type", matches = "remote")
@Test
@Timeout(90)
public void testBasicSendReceiveWithKafkaStyle() throws ExecutionException, InterruptedException {
ConnectorPropertyFactory connectorPropertyFactory = CamelAWSSQSPropertyFactory
.basic()
.withKafkaTopic(TestUtils.getDefaultTestTopic(this.getClass()))
.withQueueOrArn(queueName)
.withAmazonConfig(service.getConnectionProperties(), CamelAWSSQSPropertyFactory.KAFKA_STYLE);
runTest(connectorPropertyFactory);
}
@DisabledIfSystemProperty(named = "test.mysql.version", matches = "5\\.5(\\.\\d+)?")
@Test
void time6() {
LocalTime smallTime = LocalTime.of(0, 0, 0, 1000);
LocalTime aTime = LocalTime.of(10, 5, 28, 5_410_000);
LocalTime maxTime = LocalTime.of(23, 59, 59, 999_999_000);
Duration smallDuration = Duration.ofSeconds(-TimeUnit.HOURS.toSeconds(838) - TimeUnit.MINUTES.toSeconds(59) - 58, -999_999_000);
Duration aDuration = Duration.ofSeconds(1854672, 5_410_000);
Duration bigDuration = Duration.ofSeconds(TimeUnit.HOURS.toSeconds(838) + TimeUnit.MINUTES.toSeconds(59) + 58, 999_999_000);
testType(LocalTime.class, true, "TIME(6)", null, smallTime, aTime, maxTime);
testType(Duration.class, true, "TIME(6)", null, smallDuration, aDuration, bigDuration);
}
@DisabledIfSystemProperty(named = "test.mysql.version", matches = "5\\.5(\\.\\d+)?")
@Test
void dateTime6() {
LocalDateTime smallDateTime = LocalDateTime.of(1000, 1, 1, 0, 0, 0, 1000);
LocalDateTime aDateTime = LocalDateTime.of(2020, 5, 12, 8, 4, 10, 5_4210_000);
LocalDateTime maxDateTime = LocalDateTime.of(9999, 12, 31, 23, 59, 59, 999_999_000);
testType(LocalDateTime.class, true, "DATETIME(6)", null, smallDateTime, aDateTime, maxDateTime);
}
@DisabledIfSystemProperty(named = "test.mysql.version", matches = "5\\.5(\\.\\d+)?")
@Test
void timestamp6() {
LocalDateTime minTimestamp = LocalDateTime.of(1970, 1, 3, 0, 0, 0, 1000);
LocalDateTime aTimestamp = LocalDateTime.of(2020, 5, 12, 8, 4, 10, 5_4210_000);
LocalDateTime maxTimestamp = LocalDateTime.of(2038, 1, 15, 23, 59, 59, 999_999_000);
// TIMESTAMP must not be null when database version less than 8.0
testType(LocalDateTime.class, true, "TIMESTAMP(6)", minTimestamp, aTimestamp, maxTimestamp);
}
@DisabledIfSystemProperty(named = "test.mysql.version", matches = "5\\.5(\\.\\d+)?")
@Test
void time6() {
LocalTime smallTime = LocalTime.of(0, 0, 0, 1000);
LocalTime aTime = LocalTime.of(10, 5, 28, 5_410_000);
LocalTime maxTime = LocalTime.of(23, 59, 59, 999_999_000);
Duration smallDuration = Duration.ofSeconds(-TimeUnit.HOURS.toSeconds(838) - TimeUnit.MINUTES.toSeconds(59) - 58, -999_999_000);
Duration aDuration = Duration.ofSeconds(1854672, 5_410_000);
Duration bigDuration = Duration.ofSeconds(TimeUnit.HOURS.toSeconds(838) + TimeUnit.MINUTES.toSeconds(59) + 58, 999_999_000);
testType(LocalTime.class, true, "TIME(6)", null, smallTime, aTime, maxTime);
testType(Duration.class, true, "TIME(6)", null, smallDuration, aDuration, bigDuration);
}
@DisabledIfSystemProperty(named = "test.mysql.version", matches = "5\\.5(\\.\\d+)?")
@Test
void dateTime6() {
LocalDateTime smallDateTime = LocalDateTime.of(1000, 1, 1, 0, 0, 0, 1000);
LocalDateTime aDateTime = LocalDateTime.of(2020, 5, 12, 8, 4, 10, 5_4210_000);
LocalDateTime maxDateTime = LocalDateTime.of(9999, 12, 31, 23, 59, 59, 999_999_000);
testType(LocalDateTime.class, true, "DATETIME(6)", null, smallDateTime, aDateTime, maxDateTime);
}
@DisabledIfSystemProperty(named = "test.mysql.version", matches = "5\\.5(\\.\\d+)?")
@Test
void timestamp6() {
LocalDateTime minTimestamp = LocalDateTime.of(1970, 1, 3, 0, 0, 0, 1000);
LocalDateTime aTimestamp = LocalDateTime.of(2020, 5, 12, 8, 4, 10, 5_4210_000);
LocalDateTime maxTimestamp = LocalDateTime.of(2038, 1, 15, 23, 59, 59, 999_999_000);
// TIMESTAMP must not be null when database version less than 8.0
testType(LocalDateTime.class, true, "TIMESTAMP(6)", minTimestamp, aTimestamp, maxTimestamp);
}
@DisabledIfSystemProperty(named = "jee-testcontainer", matches = "tomee")
@Test void shouldMapClientWebApplicationExceptionWithoutEntityOrMessage() {
testPost("standard/plain-bad-request")
.hasStatus(BAD_REQUEST)
.hasContentType(PROBLEM_DETAIL_JSON)
.hasType("urn:problem-type:bad-request")
.hasTitle("Bad Request")
.hasDetail(null)
.hasUuidInstance();
}
@DisabledIfSystemProperty(named = "jee-testcontainer", matches = "tomee")
@Test void shouldMapClientWebApplicationExceptionWithoutEntityButMessage() {
testPost("/standard/bad-request-with-message")
.hasStatus(BAD_REQUEST)
.hasContentType(PROBLEM_DETAIL_JSON)
.hasType("urn:problem-type:bad-request")
.hasTitle("Bad Request")
.hasDetail("some message")
.hasUuidInstance();
}
@DisabledIfSystemProperty(named = "jee-testcontainer", matches = "tomee")
@Test void shouldMapServerWebApplicationExceptionWithoutEntityOrMessage() {
testPost("/standard/plain-service-unavailable")
.hasStatus(SERVICE_UNAVAILABLE)
.hasContentType(PROBLEM_DETAIL_JSON)
.hasType("urn:problem-type:service-unavailable")
.hasTitle("Service Unavailable")
.hasDetail(null)
.hasUuidInstance();
}
@Test
@Deployment(resources = {
"org/flowable/engine/test/api/event/CallActivityTest.testCallActivityAsyncComplete.bpmn20.xml",
"org/flowable/engine/test/api/event/CallActivityTest.testCallActivityAsyncComplete_subprocess.bpmn20.xml"
})
@DisabledIfSystemProperty(named = "database", matches = "cockroachdb")
public void testCallActivityAsyncCompleteRealExecutor() {
runtimeService.startProcessInstanceByKey("testAsyncComplete");
waitForJobExecutorToProcessAllJobsAndExecutableTimerJobs(20000L, 200L);
assertThat(runtimeService.createProcessInstanceQuery().count()).isZero();
}
/**
* Test for https://activiti.atlassian.net/browse/ACT-4035.
*/
@Test
@Deployment
@DisabledIfSystemProperty(named = "database", matches = "cockroachdb")
public void testExclusiveJobs() {
if (HistoryTestHelper.isHistoryLevelAtLeast(HistoryLevel.AUDIT, processEngineConfiguration)) {
// The process has two script tasks in parallel, both exclusive.
// They should be executed with at least 6 seconds in between (as they both sleep for 6 seconds)
runtimeService.startProcessInstanceByKey("testExclusiveJobs");
waitForJobExecutorToProcessAllJobs(20000L, 500L);
waitForHistoryJobExecutorToProcessAllJobs(7000, 100);
HistoricActivityInstance scriptTaskAInstance = historyService.createHistoricActivityInstanceQuery().activityId("scriptTaskA").singleResult();
HistoricActivityInstance scriptTaskBInstance = historyService.createHistoricActivityInstanceQuery().activityId("scriptTaskB").singleResult();
long endTimeA = scriptTaskAInstance.getEndTime().getTime();
long endTimeB = scriptTaskBInstance.getEndTime().getTime();
long endTimeDifference = 0;
if (endTimeB > endTimeA) {
endTimeDifference = endTimeB - endTimeA;
} else {
endTimeDifference = endTimeA - endTimeB;
}
assertThat(endTimeDifference).isGreaterThan(6000); // > 6000 -> jobs were executed in parallel
}
}
@Test
@EnabledIfSystemProperty(named = "PLATFORM_TYPE", matches = "cloudfoundry")
@DisabledIfSystemProperty(named = "SKIP_CLOUD_CONFIG", matches = "true")
public void streamWithConfigServer() {
logger.info("stream-server-config-test");
try (Stream stream = Stream.builder(dataFlowOperations)
.name("TICKTOCK-config-server")
.definition("time | log")
.create()
.deploy(new DeploymentPropertiesBuilder()
.putAll(testDeploymentProperties())
.put("app.log.spring.profiles.active", "test")
.put("deployer.log.cloudfoundry.services", "cloud-config-server")
.put("app.log.spring.cloud.config.name", "MY_CONFIG_TICKTOCK_LOG_NAME")
.build())) {
Awaitility.await(stream.getName() + " failed to deploy!")
.until(() -> stream.getStatus().equals(DEPLOYED));
Awaitility.await().await("Source not started")
.until(() -> runtimeApps.getFirstInstanceLog(stream, "time")
.contains("Started TimeSource"));
Awaitility.await().await("Sink not started")
.until(() -> runtimeApps.getFirstInstanceLog(stream, "log")
.contains("Started LogSink"));
Awaitility.await().await("No output found")
.until(() -> runtimeApps.getFirstInstanceLog(stream, "log")
.contains("TICKTOCK CLOUD CONFIG - TIMESTAMP:"));
}
}
@DisabledIfSystemProperty(named = "test.mysql.version", matches = "5\\.[56](\\.\\d+)?")
@Test
void json() {
testType(String.class, false, "JSON", null, "{\"data\": 1}", "[\"data\", 1]", "1", "null", "\"R2DBC\"", "2.56");
}
@Test
@DisabledIfSystemProperty(named = "ci-server", matches = "true")
void notOnCiServer() {
// ...
}
@DisabledIfSystemProperty(named = "test.mysql.version", matches = "5\\.[56](\\.\\d+)?")
@Test
void json() {
testType(String.class, false, "JSON", null, "{\"data\": 1}", "[\"data\", 1]", "1", "null", "\"R2DBC\"", "2.56");
}
@Test
// My System Properties "os.name" value is "Mac OS X"
@DisabledIfSystemProperty(named = "os.name", matches = "Mac.*")
void test8() {
assertFalse(3 < 0);
}
@Test
@DisabledIfSystemProperty(named = "com.linecorp.armeria.useJdkDnsResolver", matches = "true")
void useRefreshingAddressResolverGroup() {
final DefaultClientFactory clientFactory = (DefaultClientFactory) ClientFactory.ofDefault();
assertThat(clientFactory.addressResolverGroup()).isInstanceOf(RefreshingAddressResolverGroup.class);
}