use of org.projectnessie.tools.compatibility.api.Version in project nessie by projectnessie.
the class AbstractMultiVersionExtension method evaluateExecutionCondition.
@Override
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) {
Optional<Version> version = nessieVersionFromContext(context);
if (!version.isPresent()) {
if (isNessieMultiVersionTest(context)) {
return disabled("(not running via multi-nessie-version engine)");
}
return enabled("(not running via multi-nessie-versions engine)");
}
ConditionEvaluationResult classResult = context.getTestClass().map(c -> conditionCheck(version.get(), c)).orElse(PASS);
if (classResult.isDisabled()) {
return classResult;
}
ConditionEvaluationResult methodResult = context.getTestMethod().map(m -> conditionCheck(version.get(), m)).orElse(PASS);
if (methodResult.isDisabled()) {
return methodResult;
}
return PASS;
}
use of org.projectnessie.tools.compatibility.api.Version in project nessie by projectnessie.
the class MultiNessieVersionsTestEngine method discover.
@Override
public TestDescriptor discover(EngineDiscoveryRequest discoveryRequest, UniqueId uniqueId) {
try {
// JupiterEngineDescriptor must be the root, that's what the JUnit Jupiter engine
// implementation expects.
JupiterConfiguration configuration = new CachingJupiterConfiguration(new DefaultJupiterConfiguration(discoveryRequest.getConfigurationParameters()));
JupiterEngineDescriptor engineDescriptor = new JupiterEngineDescriptor(uniqueId, configuration);
SortedSet<Version> versionsToTest;
try {
versionsToTest = VersionsToExercise.versionsForEngine(discoveryRequest);
} catch (IllegalStateException e) {
// No versions to test found - return early
return engineDescriptor;
}
for (Version version : versionsToTest) {
UniqueId perVersionId = uniqueId.append("nessie-version", version.toString());
NessieVersionTestDescriptor perVersionTestDescriptor = new NessieVersionTestDescriptor(perVersionId, version);
engineDescriptor.addChild(perVersionTestDescriptor);
TestDescriptor discoverResult = delegate.discover(discoveryRequest, perVersionId);
List<? extends TestDescriptor> children = new ArrayList<>(discoverResult.getChildren());
for (TestDescriptor child : children) {
discoverResult.removeChild(child);
perVersionTestDescriptor.addChild(child);
}
}
return engineDescriptor;
} catch (Exception e) {
LOGGER.error("Failed to discover tests", e);
throw new RuntimeException(e);
}
}
use of org.projectnessie.tools.compatibility.api.Version in project nessie by projectnessie.
the class NessieUpgradesExtension method beforeAll.
@Override
public void beforeAll(ExtensionContext context) {
Version version = populateNessieVersionAnnotatedFields(context, null);
if (version == null) {
return;
}
ServerKey serverKey = buildServerKey(version, context);
NessieServer nessieServer = nessieServer(context, serverKey, initializeRepositorySupplier(context, serverKey));
populateFields(context, null, version, ctx -> nessieServer);
}
use of org.projectnessie.tools.compatibility.api.Version in project nessie by projectnessie.
the class NessieUpgradesExtension method beforeEach.
@Override
public void beforeEach(ExtensionContext context) {
Object testInstance = context.getRequiredTestInstance();
Version version = populateNessieVersionAnnotatedFields(context, testInstance);
if (version == null) {
return;
}
ServerKey serverKey = buildServerKey(version, context);
NessieServer nessieServer = nessieServerExisting(context, serverKey);
populateFields(context, testInstance, version, ctx -> nessieServer);
}
Aggregations