本文整理汇总了Java中org.springframework.test.annotation.IfProfileValue类的典型用法代码示例。如果您正苦于以下问题:Java IfProfileValue类的具体用法?Java IfProfileValue怎么用?Java IfProfileValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IfProfileValue类属于org.springframework.test.annotation包,在下文中一共展示了IfProfileValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: verifyConcurrentServiceTicketGeneration
import org.springframework.test.annotation.IfProfileValue; //导入依赖的package包/类
@Test
@IfProfileValue(name="cas.jpa.concurrent", value="true")
public void verifyConcurrentServiceTicketGeneration() throws Exception {
final TicketGrantingTicket newTgt = newTGT();
addTicketInTransaction(newTgt);
final ExecutorService executor = Executors.newFixedThreadPool(CONCURRENT_SIZE);
try {
final List<ServiceTicketGenerator> generators = new ArrayList<>(CONCURRENT_SIZE);
for (int i = 0; i < CONCURRENT_SIZE; i++) {
generators.add(new ServiceTicketGenerator(newTgt.getId(), this.jpaTicketRegistry, this.txManager));
}
final List<Future<String>> results = executor.invokeAll(generators);
for (final Future<String> result : results) {
assertNotNull(result.get());
}
} catch (final Exception e) {
logger.debug("testConcurrentServiceTicketGeneration produced an error", e);
fail("testConcurrentServiceTicketGeneration failed.");
} finally {
executor.shutdownNow();
}
}
示例2: verifyConcurrentAcquireAndReleaseOnExistingLock
import org.springframework.test.annotation.IfProfileValue; //导入依赖的package包/类
/**
* Test concurrent acquire/release semantics for existing lock.
*/
@Test
@IfProfileValue(name="cas.jpa.concurrent", value="true")
public void verifyConcurrentAcquireAndReleaseOnExistingLock() throws Exception {
final LockingStrategy[] locks = getConcurrentLocks("concurrent-exists");
locks[0].acquire();
locks[0].release();
final ExecutorService executor = Executors.newFixedThreadPool(CONCURRENT_SIZE);
try {
testConcurrency(executor, locks);
} catch (final Exception e) {
logger.debug("testConcurrentAcquireAndReleaseOnExistingLock produced an error", e);
fail("testConcurrentAcquireAndReleaseOnExistingLock failed.");
} finally {
executor.shutdownNow();
}
}
示例3: testConcurrentServiceTicketGeneration
import org.springframework.test.annotation.IfProfileValue; //导入依赖的package包/类
@Test
@IfProfileValue(name="cas.jpa.concurrent", value="true")
public void testConcurrentServiceTicketGeneration() throws Exception {
final TicketGrantingTicket newTgt = newTGT();
addTicketInTransaction(newTgt);
final ExecutorService executor = Executors.newFixedThreadPool(CONCURRENT_SIZE);
try {
final List<ServiceTicketGenerator> generators = new ArrayList<ServiceTicketGenerator>(CONCURRENT_SIZE);
for (int i = 0; i < CONCURRENT_SIZE; i++) {
generators.add(new ServiceTicketGenerator(newTgt.getId()));
}
final List<Future<String>> results = executor.invokeAll(generators);
for (Future<String> result : results) {
assertNotNull(result.get());
}
} catch (final Exception e) {
logger.debug("testConcurrentServiceTicketGeneration produced an error", e);
fail("testConcurrentServiceTicketGeneration failed.");
} finally {
executor.shutdownNow();
}
}
示例4: testConcurrentAcquireAndReleaseOnExistingLock
import org.springframework.test.annotation.IfProfileValue; //导入依赖的package包/类
/**
* Test concurrent acquire/release semantics for existing lock.
*/
@Test
@IfProfileValue(name="cas.jpa.concurrent", value="true")
public void testConcurrentAcquireAndReleaseOnExistingLock() throws Exception {
final LockingStrategy[] locks = getConcurrentLocks("concurrent-exists");
locks[0].acquire();
locks[0].release();
final ExecutorService executor = Executors.newFixedThreadPool(CONCURRENT_SIZE);
try {
testConcurrency(executor, locks);
} catch (final Exception e) {
logger.debug("testConcurrentAcquireAndReleaseOnExistingLock produced an error", e);
fail("testConcurrentAcquireAndReleaseOnExistingLock failed.");
} finally {
executor.shutdownNow();
}
}
示例5: testUsingSpringTestWithCustomProfilesX
import org.springframework.test.annotation.IfProfileValue; //导入依赖的package包/类
@IfProfileValue(name = "environment", values = "dev")
@Test
public void testUsingSpringTestWithCustomProfilesX() {
try{
log.debug("Using Spring Test fixtures:");
List<Document> documents = engine.findByType(webType);
assertNotNull(documents);
assertTrue(documents.size() == 1);
assertEquals(webType.getName(),documents.get(0).getType().getName());
assertEquals(webType.getDesc(),documents.get(0).getType().getDesc());
assertEquals(webType.getExtension(),documents.get(0).getType().getExtension());
documents = engine.listAll();
assertNotNull(documents);
assertTrue(documents.size() == 4);
}catch(Exception ex){
log.error(ex.getMessage());
}
}
示例6: evaluate
import org.springframework.test.annotation.IfProfileValue; //导入依赖的package包/类
/**
* Determine if the test specified by arguments to the
* {@linkplain #ProfileValueChecker constructor} is <em>enabled</em> in
* the current environment, as configured via the {@link IfProfileValue
* @IfProfileValue} annotation.
* <p>If the test is not annotated with {@code @IfProfileValue} it is
* considered enabled.
* <p>If a test is not enabled, this method will abort further evaluation
* of the execution chain with a failed assumption; otherwise, this method
* will simply evaluate the next {@link Statement} in the execution chain.
* @see ProfileValueUtils#isTestEnabledInThisEnvironment(Class)
* @see ProfileValueUtils#isTestEnabledInThisEnvironment(Method, Class)
* @see org.junit.Assume
*/
@Override
public void evaluate() throws Throwable {
if (this.testMethod == null) {
if (!ProfileValueUtils.isTestEnabledInThisEnvironment(this.testClass)) {
// Invoke assumeTrue() with false to avoid direct reference to JUnit's
// AssumptionViolatedException which exists in two packages as of JUnit 4.12.
Annotation ann = AnnotationUtils.findAnnotation(this.testClass, IfProfileValue.class);
Assume.assumeTrue(String.format(
"Profile configured via [%s] is not enabled in this environment for test class [%s].",
ann, this.testClass.getName()), false);
}
}
else {
if (!ProfileValueUtils.isTestEnabledInThisEnvironment(this.testMethod, this.testClass)) {
// Invoke assumeTrue() with false to avoid direct reference to JUnit's
// AssumptionViolatedException which exists in two packages as of JUnit 4.12.
Assume.assumeTrue(String.format(
"Profile configured via @IfProfileValue is not enabled in this environment for test method [%s].",
this.testMethod), false);
}
}
this.next.evaluate();
}
示例7: verifyConcurrentAcquireAndRelease
import org.springframework.test.annotation.IfProfileValue; //导入依赖的package包/类
/**
* Test concurrent acquire/release semantics.
*/
@Test
@IfProfileValue(name="cas.jpa.concurrent", value="true")
public void verifyConcurrentAcquireAndRelease() throws Exception {
final ExecutorService executor = Executors.newFixedThreadPool(CONCURRENT_SIZE);
try {
testConcurrency(executor, getConcurrentLocks("concurrent-new"));
} catch (final Exception e) {
logger.debug("testConcurrentAcquireAndRelease produced an error", e);
fail("testConcurrentAcquireAndRelease failed.");
} finally {
executor.shutdownNow();
}
}
示例8: testConcurrentAcquireAndRelease
import org.springframework.test.annotation.IfProfileValue; //导入依赖的package包/类
/**
* Test concurrent acquire/release semantics.
*/
@Test
@IfProfileValue(name="cas.jpa.concurrent", value="true")
public void testConcurrentAcquireAndRelease() throws Exception {
final ExecutorService executor = Executors.newFixedThreadPool(CONCURRENT_SIZE);
try {
testConcurrency(executor, getConcurrentLocks("concurrent-new"));
} catch (final Exception e) {
logger.debug("testConcurrentAcquireAndRelease produced an error", e);
fail("testConcurrentAcquireAndRelease failed.");
} finally {
executor.shutdownNow();
}
}
示例9: testUsingSpringTestWithCustomProfilesY
import org.springframework.test.annotation.IfProfileValue; //导入依赖的package包/类
@IfProfileValue(name = "os.name", values = "Unix")
@Test
public void testUsingSpringTestWithCustomProfilesY() {
try{
log.debug("Using Spring Test fixtures on Unix:");
//More Testing
}catch(Exception ex){
log.error(ex.getMessage());
}
}
示例10: crawlUser
import org.springframework.test.annotation.IfProfileValue; //导入依赖的package包/类
@Test
@IfProfileValue(name = "test")
public void crawlUser() {
ResponseEntity<User> user1 = new TestRestTemplate().getForEntity("http://localhost:" + port + "/v1/user/kennybastani", User.class);
assertEquals(HttpStatus.OK, user1.getStatusCode());
ResponseEntity<User> user2 = new TestRestTemplate().getForEntity("http://localhost:" + port + "/v1/user/bridgetkromhout", User.class);
assertEquals(HttpStatus.OK, user2.getStatusCode());
ResponseEntity<User> user3 = new TestRestTemplate().getForEntity("http://localhost:" + port + "/v1/user/starbuxman", User.class);
assertEquals(HttpStatus.OK, user3.getStatusCode());
}
示例11: test
import org.springframework.test.annotation.IfProfileValue; //导入依赖的package包/类
@Test
// sometimes this test fail on FaaS on assertProcessEnded but we don't know why :-(
@IfProfileValue(name="test-groups", values={"activiti"})
public void test() throws InterruptedException {
// deploy the process
repositoryService
.createDeployment()
.addClasspathResource(
"com/francetelecom/clara/cloud/paas/activation/v1/error-catching.bpmn20.xml")
.deploy();
// start a new process instance
final ProcessInstance pi = runtimeService
.startProcessInstanceByKey("error-catching-process");
// fetch active executions
List<Execution> executions = runtimeService.createExecutionQuery()
.processInstanceId(pi.getId()).list();
assertEquals("there should be 2 pending executions", 2,
executions.size());
// one is for the fork
// fetch active execution
Execution failingtaskExec = runtimeService.createExecutionQuery()
.processInstanceId(pi.getId())
.activityId("failingtask").singleResult();
// assert that a 'failingtask' execution exists
assertNotNull(failingtaskExec);
runtimeService.signal(failingtaskExec.getId());
assertProcessEnded(pi);
}
示例12: testDetectorSuccessJni
import org.springframework.test.annotation.IfProfileValue; //导入依赖的package包/类
@Test(timeout=90000)
@IfProfileValue(name="runPingTests", value="true")
public void testDetectorSuccessJni() throws Exception {
PingerFactory.setInstance(new JniPinger());
m_icmpDetector = new IcmpDetector();
assertTrue("ICMP could not be detected on localhost", m_icmpDetector.isServiceDetected(InetAddress.getLocalHost()));
}
示例13: testDetectorFailJni
import org.springframework.test.annotation.IfProfileValue; //导入依赖的package包/类
@Test(timeout=90000)
@IfProfileValue(name="runPingTests", value="true")
public void testDetectorFailJni() throws Exception {
PingerFactory.setInstance(new JniPinger());
m_icmpDetector = new IcmpDetector();
assertFalse("ICMP was incorrectly identified on " + InetAddressUtils.UNPINGABLE_ADDRESS.getHostAddress(), m_icmpDetector.isServiceDetected(InetAddressUtils.UNPINGABLE_ADDRESS));
}
示例14: testDetectorSuccess
import org.springframework.test.annotation.IfProfileValue; //导入依赖的package包/类
@Test(timeout=90000)
@IfProfileValue(name="runPingTests", value="true")
public void testDetectorSuccess() throws Exception {
PingerFactory.setInstance(new JnaPinger());
m_icmpDetector = new IcmpDetector();
assertTrue("ICMP could not be detected on localhost", m_icmpDetector.isServiceDetected(InetAddress.getLocalHost()));
}
示例15: testDetectorFail
import org.springframework.test.annotation.IfProfileValue; //导入依赖的package包/类
@Test(timeout=90000)
@IfProfileValue(name="runPingTests", value="true")
public void testDetectorFail() throws Exception {
PingerFactory.setInstance(new JnaPinger());
m_icmpDetector = new IcmpDetector();
assertFalse("ICMP was incorrectly identified on " + InetAddressUtils.UNPINGABLE_ADDRESS.getHostAddress(), m_icmpDetector.isServiceDetected(InetAddressUtils.UNPINGABLE_ADDRESS));
}