@@ -17,28 +17,15 @@ package com.example.demo;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Condition;
|
||||
import org.springframework.context.annotation.ConditionContext;
|
||||
import org.springframework.context.annotation.Conditional;
|
||||
import org.springframework.core.type.AnnotatedTypeMetadata;
|
||||
|
||||
import example.springdata.couchbase.util.CouchbaseAvailableRule;
|
||||
|
||||
/**
|
||||
* @author Michael Reiche
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@Conditional(DemoApplication.CouchbaseAvailable.class)
|
||||
public class DemoApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(DemoApplication.class, args);
|
||||
}
|
||||
|
||||
static class CouchbaseAvailable implements Condition {
|
||||
@Override
|
||||
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
|
||||
return CouchbaseAvailableRule.onLocalhost().isAvailable();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,25 +15,20 @@
|
||||
*/
|
||||
package com.example.demo;
|
||||
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
|
||||
import example.springdata.couchbase.util.CouchbaseAvailableRule;
|
||||
import example.springdata.couchbase.util.EnabledOnCouchbaseAvailable;
|
||||
|
||||
/**
|
||||
* @author Michael Reiche
|
||||
* @author Christoph Strobl
|
||||
*/
|
||||
@SpringBootTest
|
||||
@ContextConfiguration(classes = DemoApplication.class)
|
||||
@SpringBootTest(classes = DemoApplication.class)
|
||||
@EnabledOnCouchbaseAvailable
|
||||
class DemoApplicationTests {
|
||||
|
||||
@ClassRule //
|
||||
public static CouchbaseAvailableRule COUCHBASE = CouchbaseAvailableRule.onLocalhost();
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user