org.springframework.test.context.junit.jupiter.SpringExtension Java Examples

The following examples show how to use org.springframework.test.context.junit.jupiter.SpringExtension. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DBUnitExtension.java    From database-rider with Apache License 2.0 5 votes vote down vote up
private boolean isSpringExtensionEnabled(ExtensionContext extensionContext) {
    try {
        return isOnClasspath("org.springframework.test.context.junit.jupiter.SpringExtension") && extensionContext.getRoot().getStore(Namespace.create(SpringExtension.class)) != null;
    } catch (Exception e) {
        return false;
    }
}
 
Example #2
Source File: DBUnitExtension.java    From database-rider with Apache License 2.0 5 votes vote down vote up
private boolean isSpringTestContextEnabled(ExtensionContext extensionContext) {
    if (!extensionContext.getTestClass().isPresent()) {
        return false;
    }
    Store springStore = extensionContext.getRoot().getStore(Namespace.create(SpringExtension.class));
    return springStore != null && springStore.get(extensionContext.getTestClass().get()) != null;
}
 
Example #3
Source File: PublishedEventsParameterResolver.java    From moduliths with Apache License 2.0 4 votes vote down vote up
PublishedEventsParameterResolver() {
	this(ctx -> SpringExtension.getApplicationContext(ctx));
}
 
Example #4
Source File: DBUnitExtension.java    From database-rider with Apache License 2.0 4 votes vote down vote up
private static DataSource getDataSourceFromSpringContext(ExtensionContext extensionContext, String beanName) {
    ApplicationContext context = SpringExtension.getApplicationContext(extensionContext);
    return beanName.isEmpty() ? context.getBean(DataSource.class) : context.getBean(beanName, DataSource.class);
}
 
Example #5
Source File: FlowableEventSpringExtension.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
@Override
protected EventRegistryEngine createEventRegistryEngine(ExtensionContext context) {
    return SpringExtension.getApplicationContext(context).getBean(EventRegistryEngine.class);
}
 
Example #6
Source File: FlowableFormSpringExtension.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
@Override
protected FormEngine createFormEngine(ExtensionContext context) {
    return SpringExtension.getApplicationContext(context).getBean(FormEngine.class);
}
 
Example #7
Source File: FlowableDmnSpringExtension.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
@Override
protected DmnEngine createDmnEngine(ExtensionContext context) {
    return SpringExtension.getApplicationContext(context).getBean(DmnEngine.class);
}
 
Example #8
Source File: FlowableCmmnSpringExtension.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
@Override
protected CmmnEngine createCmmnEngine(ExtensionContext context) {
    return SpringExtension.getApplicationContext(context).getBean(CmmnEngine.class);
}
 
Example #9
Source File: FlowableSpringExtension.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
@Override
protected ProcessEngine createProcessEngine(ExtensionContext context) {
    return SpringExtension.getApplicationContext(context).getBean(ProcessEngine.class);
}
 
Example #10
Source File: InternalFlowableSpringExtension.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
@Override
protected ProcessEngine getProcessEngine(ExtensionContext context) {
    return getStore(context)
        .getOrComputeIfAbsent(context.getRequiredTestClass(), key -> SpringExtension.getApplicationContext(context).getBean(ProcessEngine.class),
            ProcessEngine.class);
}