org.junit.jupiter.api.extension.Extension源码实例Demo

org.junit.jupiter.api.extension.BeforeAllCallback#org.junit.jupiter.api.extension.Extension源码实例Demo

下面列出了org.junit.jupiter.api.extension.BeforeAllCallback#org.junit.jupiter.api.extension.Extension 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: doma   文件: EntityProcessorTest.java
private TestTemplateInvocationContext invocationContext(
    Class<?> compilationUnit, String... options) {
  return new TestTemplateInvocationContext() {
    @Override
    public String getDisplayName(int invocationIndex) {
      return compilationUnit.getSimpleName();
    }

    @Override
    public List<Extension> getAdditionalExtensions() {
      return Arrays.asList(
          new SimpleParameterResolver(compilationUnit),
          new ResourceParameterResolver(compilationUnit),
          new GeneratedClassNameParameterResolver(compilationUnit),
          new SimpleParameterResolver(options));
    }
  };
}
 
源代码2 项目: doma   文件: EntityProcessorTest.java
private TestTemplateInvocationContext invocationContext(
    Class<?> compilationUnit, Class<?> annotatedClass, String... options) {
  return new TestTemplateInvocationContext() {
    @Override
    public String getDisplayName(int invocationIndex) {
      return compilationUnit.getSimpleName();
    }

    @Override
    public List<Extension> getAdditionalExtensions() {
      return Arrays.asList(
          new SimpleParameterResolver(compilationUnit),
          new ResourceParameterResolver(compilationUnit),
          new GeneratedClassNameParameterResolver(annotatedClass),
          new SimpleParameterResolver(options));
    }
  };
}
 
源代码3 项目: doma   文件: EntityProcessorTest.java
private TestTemplateInvocationContext invocationContext(
    Class<?> clazz, Message message, String... options) {
  return new TestTemplateInvocationContext() {
    @Override
    public String getDisplayName(int invocationIndex) {
      return clazz.getSimpleName();
    }

    @Override
    public List<Extension> getAdditionalExtensions() {
      return Arrays.asList(
          new SimpleParameterResolver(clazz),
          new SimpleParameterResolver(message),
          new SimpleParameterResolver(options));
    }
  };
}
 
源代码4 项目: doma   文件: MetamodelTest.java
private TestTemplateInvocationContext invocationContext(
    Class<?> compilationUnit, String... options) {
  return new TestTemplateInvocationContext() {
    @Override
    public String getDisplayName(int invocationIndex) {
      return compilationUnit.getSimpleName();
    }

    @Override
    public List<Extension> getAdditionalExtensions() {
      return Arrays.asList(
          new SimpleParameterResolver(compilationUnit),
          new ResourceParameterResolver(compilationUnit),
          new CriteriaGeneratedClassNameParameterResolver(compilationUnit),
          new SimpleParameterResolver(options));
    }
  };
}
 
源代码5 项目: doma   文件: MetamodelTest.java
private TestTemplateInvocationContext invocationContext(
    Class<?> compilationUnit, String... options) {
  return new TestTemplateInvocationContext() {
    @Override
    public String getDisplayName(int invocationIndex) {
      return compilationUnit.getSimpleName();
    }

    @Override
    public List<Extension> getAdditionalExtensions() {
      return Arrays.asList(
          new SimpleParameterResolver(compilationUnit),
          new ResourceParameterResolver(compilationUnit),
          new CriteriaGeneratedClassNameParameterResolver(compilationUnit, "Q", ""),
          new SimpleParameterResolver(options));
    }
  };
}
 
源代码6 项目: doma   文件: MetamodelTest.java
private TestTemplateInvocationContext invocationContext(
    Class<?> clazz, Message message, String... options) {
  return new TestTemplateInvocationContext() {
    @Override
    public String getDisplayName(int invocationIndex) {
      return clazz.getSimpleName();
    }

    @Override
    public List<Extension> getAdditionalExtensions() {
      return Arrays.asList(
          new SimpleParameterResolver(clazz),
          new SimpleParameterResolver(message),
          new SimpleParameterResolver(options));
    }
  };
}
 
源代码7 项目: doma   文件: MetamodelOptionTest.java
private TestTemplateInvocationContext invocationContext(
    Class<?> compilationUnit, String... options) {
  return new TestTemplateInvocationContext() {
    @Override
    public String getDisplayName(int invocationIndex) {
      return compilationUnit.getSimpleName();
    }

    @Override
    public List<Extension> getAdditionalExtensions() {
      return Arrays.asList(
          new SimpleParameterResolver(compilationUnit),
          new ResourceParameterResolver(compilationUnit),
          new CriteriaGeneratedClassNameParameterResolver(compilationUnit, PREFIX, SUFFIX),
          new SimpleParameterResolver(options));
    }
  };
}
 
源代码8 项目: doma   文件: EmbeddableProcessorTest.java
private TestTemplateInvocationContext invocationContext(
    Class<?> compilationUnit, String... options) {
  return new TestTemplateInvocationContext() {
    @Override
    public String getDisplayName(int invocationIndex) {
      return compilationUnit.getSimpleName();
    }

    @Override
    public List<Extension> getAdditionalExtensions() {
      return Arrays.asList(
          new SimpleParameterResolver(compilationUnit),
          new ResourceParameterResolver(compilationUnit),
          new GeneratedClassNameParameterResolver(compilationUnit),
          new SimpleParameterResolver(options));
    }
  };
}
 
源代码9 项目: doma   文件: EmbeddableProcessorTest.java
private TestTemplateInvocationContext invocationContext(
    Class<?> compilationUnit, Class<?> annotatedClass, String... options) {
  return new TestTemplateInvocationContext() {
    @Override
    public String getDisplayName(int invocationIndex) {
      return compilationUnit.getSimpleName();
    }

    @Override
    public List<Extension> getAdditionalExtensions() {
      return Arrays.asList(
          new SimpleParameterResolver(compilationUnit),
          new ResourceParameterResolver(compilationUnit),
          new GeneratedClassNameParameterResolver(annotatedClass),
          new SimpleParameterResolver(options));
    }
  };
}
 
源代码10 项目: doma   文件: EmbeddableProcessorTest.java
private TestTemplateInvocationContext invocationContext(
    Class<?> clazz, Message message, String... options) {
  return new TestTemplateInvocationContext() {
    @Override
    public String getDisplayName(int invocationIndex) {
      return clazz.getSimpleName();
    }

    @Override
    public List<Extension> getAdditionalExtensions() {
      return Arrays.asList(
          new SimpleParameterResolver(clazz),
          new SimpleParameterResolver(message),
          new SimpleParameterResolver(options));
    }
  };
}
 
源代码11 项目: doma   文件: DaoProcessorTest.java
private TestTemplateInvocationContext invocationContext(Class<?> clazz, String... options) {
  return new TestTemplateInvocationContext() {
    @Override
    public String getDisplayName(int invocationIndex) {
      return clazz.getSimpleName();
    }

    @Override
    public List<Extension> getAdditionalExtensions() {
      return Arrays.asList(
          new SimpleParameterResolver(clazz),
          new ResourceParameterResolver(clazz),
          new GeneratedClassNameParameterResolver(clazz),
          new SimpleParameterResolver(options));
    }
  };
}
 
源代码12 项目: doma   文件: SqlTest.java
private TestTemplateInvocationContext invocationContext(
    Class<?> clazz, Message message, String... options) {
  return new TestTemplateInvocationContext() {
    @Override
    public String getDisplayName(int invocationIndex) {
      return clazz.getSimpleName();
    }

    @Override
    public List<Extension> getAdditionalExtensions() {
      return Arrays.asList(
          new SimpleParameterResolver(clazz),
          new SimpleParameterResolver(message),
          new SimpleParameterResolver(options));
    }
  };
}
 
源代码13 项目: doma   文件: SingletonConfigProcessorTest.java
private TestTemplateInvocationContext invocationContext(
    Class<?> clazz, Message message, String... options) {
  return new TestTemplateInvocationContext() {
    @Override
    public String getDisplayName(int invocationIndex) {
      return clazz.getSimpleName();
    }

    @Override
    public List<Extension> getAdditionalExtensions() {
      return Arrays.asList(
          new SimpleParameterResolver(clazz),
          new SimpleParameterResolver(message),
          new SimpleParameterResolver(options));
    }
  };
}
 
源代码14 项目: doma   文件: DomainProcessorTest.java
private TestTemplateInvocationContext invocationContext(
    Class<?> compilationUnit, String... options) {
  return new TestTemplateInvocationContext() {
    @Override
    public String getDisplayName(int invocationIndex) {
      return compilationUnit.getSimpleName();
    }

    @Override
    public List<Extension> getAdditionalExtensions() {
      return Arrays.asList(
          new SimpleParameterResolver(compilationUnit),
          new ResourceParameterResolver(compilationUnit),
          new GeneratedClassNameParameterResolver(compilationUnit),
          new SimpleParameterResolver(options));
    }
  };
}
 
源代码15 项目: doma   文件: DomainProcessorTest.java
private TestTemplateInvocationContext invocationContext(
    Class<?> compilationUnit, Class<?> annotatedClass, String... options) {
  return new TestTemplateInvocationContext() {
    @Override
    public String getDisplayName(int invocationIndex) {
      return compilationUnit.getSimpleName();
    }

    @Override
    public List<Extension> getAdditionalExtensions() {
      return Arrays.asList(
          new SimpleParameterResolver(compilationUnit),
          new ResourceParameterResolver(compilationUnit),
          new GeneratedClassNameParameterResolver(annotatedClass),
          new SimpleParameterResolver(options));
    }
  };
}
 
源代码16 项目: doma   文件: DomainProcessorTest.java
private TestTemplateInvocationContext invocationContext(
    Class<?> clazz, Message message, String... options) {
  return new TestTemplateInvocationContext() {
    @Override
    public String getDisplayName(int invocationIndex) {
      return clazz.getSimpleName();
    }

    @Override
    public List<Extension> getAdditionalExtensions() {
      return Arrays.asList(
          new SimpleParameterResolver(clazz),
          new SimpleParameterResolver(message),
          new SimpleParameterResolver(options));
    }
  };
}
 
源代码17 项目: doma   文件: ExternalDomainProcessorTest.java
private TestTemplateInvocationContext invocationContext(
    Class<?> compilationUnit, Class<?> externalDomainClass) {
  return new TestTemplateInvocationContext() {
    @Override
    public String getDisplayName(int invocationIndex) {
      return compilationUnit.getSimpleName();
    }

    @Override
    public List<Extension> getAdditionalExtensions() {
      return Arrays.asList(
          new SimpleParameterResolver(compilationUnit),
          new ResourceParameterResolver(compilationUnit),
          new GeneratedClassNameParameterResolver(externalDomainClass, true));
    }
  };
}
 
源代码18 项目: doma   文件: ExternalDomainProcessorTest.java
private TestTemplateInvocationContext invocationContext(
    Class<?> clazz, Message message, String... options) {
  return new TestTemplateInvocationContext() {
    @Override
    public String getDisplayName(int invocationIndex) {
      return clazz.getSimpleName();
    }

    @Override
    public List<Extension> getAdditionalExtensions() {
      return Arrays.asList(
          new SimpleParameterResolver(clazz),
          new SimpleParameterResolver(message),
          new SimpleParameterResolver(options));
    }
  };
}
 
源代码19 项目: junitperf   文件: PerfConfigContext.java
@Override
public List<Extension> getAdditionalExtensions() {
    return Collections.singletonList(
            (TestInstancePostProcessor) (testInstance, context) -> {
                final Class clazz = testInstance.getClass();
                // Group test contexts by test class
                ACTIVE_CONTEXTS.putIfAbsent(clazz, new ArrayList<>());

                EvaluationContext evaluationContext = new EvaluationContext(testInstance,
                        method,
                        DateUtil.getCurrentDateTimeStr());
                evaluationContext.loadConfig(perfConfig);
                evaluationContext.loadRequire(perfRequire);
                StatisticsCalculator statisticsCalculator = perfConfig.statistics().newInstance();
                Set<Reporter> reporterSet = getReporterSet();
                ACTIVE_CONTEXTS.get(clazz).add(evaluationContext);
                try {
                    new PerformanceEvaluationStatement(evaluationContext,
                            statisticsCalculator,
                            reporterSet,
                            ACTIVE_CONTEXTS.get(clazz),
                            clazz).evaluate();
                } catch (Throwable throwable) {
                    throw new JunitPerfRuntimeException(throwable);
                }
            }
    );
}
 
private TestTemplateInvocationContext createInvocationContext(
    String name, Supplier<? extends TransactionManager> tmSupplier) {
  return new TestTemplateInvocationContext() {
    @Override
    public String getDisplayName(int invocationIndex) {
      return name;
    }

    @Override
    public List<Extension> getAdditionalExtensions() {
      return ImmutableList.of(new DatabaseSwitchInvocationContext(tmSupplier));
    }
  };
}
 
public static Extension startDockerCompose(Path tempFolder) {

		if (DockerComposeFactoryProperties.isDockerComposeDisabled()) {
			return (BeforeAllCallback) context -> logger.info("Docker Compose installation is disabled!");
		}

		logger.info("{} = {}", DockerComposeFactoryProperties.TEST_DOCKER_COMPOSE_DATAFLOW_VERSIONN,
				DockerComposeFactoryProperties.get(DockerComposeFactoryProperties.TEST_DOCKER_COMPOSE_DATAFLOW_VERSIONN, DEFAULT_DATAFLOW_VERSION));
		logger.info("{} = {}", DockerComposeFactoryProperties.TEST_DOCKER_COMPOSE_SKIPPER_VERSIONN,
				DockerComposeFactoryProperties.get(DockerComposeFactoryProperties.TEST_DOCKER_COMPOSE_SKIPPER_VERSIONN, DEFAULT_SKIPPER_VERSION));
		logger.info("{} = {}", DockerComposeFactoryProperties.TEST_DOCKER_COMPOSE_STREAM_APPS_URI,
				DockerComposeFactoryProperties.get(DockerComposeFactoryProperties.TEST_DOCKER_COMPOSE_STREAM_APPS_URI, DEFAULT_STREAM_APPS_URI));
		logger.info("{} = {}", DockerComposeFactoryProperties.TEST_DOCKER_COMPOSE_TASK_APPS_URI,
				DockerComposeFactoryProperties.get(DockerComposeFactoryProperties.TEST_DOCKER_COMPOSE_TASK_APPS_URI, DEFAULT_TASK_APPS_URI));
		logger.info("{} = {}", DockerComposeFactoryProperties.TEST_DOCKER_COMPOSE_PATHS,
				DockerComposeFactoryProperties.getDockerComposePaths(DEFAULT_DOCKER_COMPOSE_PATHS));

		String[] dockerComposePaths = new ResourceExtractor(tempFolder).extract(
				DockerComposeFactoryProperties.getDockerComposePaths(DEFAULT_DOCKER_COMPOSE_PATHS));
		logger.info("Extracted docker compose files = {}", Arrays.toString(dockerComposePaths));

		return DockerComposeExtension.builder()
				.files(DockerComposeFiles.from(dockerComposePaths))
				.machine(dockerMachine)
				.saveLogsTo("target/dockerLogs/DockerComposeIT")
				.waitingForService("dataflow-server", HealthChecks.toRespond2xxOverHttp(9393,
						(port) -> port.inFormat("http://$HOST:$EXTERNAL_PORT")), org.joda.time.Duration.standardMinutes(10))
				.waitingForService("skipper-server", HealthChecks.toRespond2xxOverHttp(7577,
						(port) -> port.inFormat("http://$HOST:$EXTERNAL_PORT")), org.joda.time.Duration.standardMinutes(10))
				// set to false to test with local dataflow and skipper images.
				.pullOnStartup(DockerComposeFactoryProperties.getBoolean(DockerComposeFactoryProperties.TEST_DOCKER_COMPOSE_PULLONSTARTUP, true))
				.build();
	}
 
源代码22 项目: doma   文件: DaoProcessorTest.java
private TestTemplateInvocationContext invocationContext(Class<?> clazz, Message message) {
  return new TestTemplateInvocationContext() {
    @Override
    public String getDisplayName(int invocationIndex) {
      return clazz.getSimpleName();
    }

    @Override
    public List<Extension> getAdditionalExtensions() {
      return Arrays.asList(
          new SimpleParameterResolver(clazz), new SimpleParameterResolver(message));
    }
  };
}
 
源代码23 项目: java-cloudant   文件: MultiExtension.java
public MultiExtension(Extension... extensions) {
    this.extensions = Arrays.asList(extensions);
    // After tests we need to call extensions in the reverse order
    this.reversedExtensions = new ArrayList<>(this.extensions.size());
    this.reversedExtensions.addAll(this.extensions);
    Collections.reverse(reversedExtensions);
}
 
源代码24 项目: java-cloudant   文件: MultiExtension.java
@Override
public void afterAll(ExtensionContext extensionContext) throws Exception {
    for (Extension extension : reversedExtensions) {
        if (extension instanceof AfterAllCallback) {
            ((AfterAllCallback) extension).afterAll(extensionContext);
        }
    }
}
 
源代码25 项目: java-cloudant   文件: MultiExtension.java
@Override
public void afterEach(ExtensionContext extensionContext) throws Exception {
    for (Extension extension : reversedExtensions) {
        if (extension instanceof AfterEachCallback) {
            ((AfterEachCallback) extension).afterEach(extensionContext);
        }
    }
}
 
源代码26 项目: java-cloudant   文件: MultiExtension.java
@Override
public void afterTestExecution(ExtensionContext extensionContext) throws Exception {
    for (Extension extension : reversedExtensions) {
        if (extension instanceof AfterTestExecutionCallback) {
            ((AfterTestExecutionCallback) extension).afterTestExecution(extensionContext);
        }
    }
}
 
源代码27 项目: java-cloudant   文件: MultiExtension.java
@Override
public void beforeAll(ExtensionContext extensionContext) throws Exception {
    for (Extension extension : extensions) {
        if (extension instanceof BeforeAllCallback) {
            ((BeforeAllCallback) extension).beforeAll(extensionContext);
        }
    }
}
 
源代码28 项目: java-cloudant   文件: MultiExtension.java
@Override
public void beforeEach(ExtensionContext extensionContext) throws Exception {
    for (Extension extension : extensions) {
        if (extension instanceof BeforeEachCallback) {
            ((BeforeEachCallback) extension).beforeEach(extensionContext);
        }
    }
}
 
源代码29 项目: java-cloudant   文件: MultiExtension.java
@Override
public void beforeTestExecution(ExtensionContext extensionContext) throws Exception {
    for (Extension extension : extensions) {
        if (extension instanceof BeforeTestExecutionCallback) {
            ((BeforeTestExecutionCallback) extension).beforeTestExecution(extensionContext);
        }
    }
}
 
源代码30 项目: fdb-record-layer   文件: DualPlannerExtension.java
public DualPlannerTestInvocationContext(boolean useRewritePlanner, List<Extension> extensions) {
    this.extensions = new ArrayList<>(extensions);
    this.extensions.add((TestInstancePostProcessor) (testInstance, context) ->
            ((FDBRecordStoreQueryTestBase) testInstance).setUseRewritePlanner(useRewritePlanner));
}