本文整理汇总了Java中org.apache.tinkerpop.gremlin.structure.Graph.OptOut方法的典型用法代码示例。如果您正苦于以下问题:Java Graph.OptOut方法的具体用法?Java Graph.OptOut怎么用?Java Graph.OptOut使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tinkerpop.gremlin.structure.Graph
的用法示例。
在下文中一共展示了Graph.OptOut方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerOptOuts
import org.apache.tinkerpop.gremlin.structure.Graph; //导入方法依赖的package包/类
private void registerOptOuts(final Class<? extends Graph> graphClass,
final Optional<GraphProvider.Descriptor> graphProviderDescriptor,
final TraversalEngine.Type traversalEngineType) throws InitializationError {
final Graph.OptOut[] optOuts = graphClass.getAnnotationsByType(Graph.OptOut.class);
if (optOuts != null && optOuts.length > 0) {
// validate annotation - test class and reason must be set
if (!Arrays.stream(optOuts).allMatch(ignore -> ignore.test() != null && ignore.reason() != null && !ignore.reason().isEmpty()))
throw new InitializationError("Check @IgnoreTest annotations - all must have a 'test' and 'reason' set");
try {
filter(new OptOutTestFilter(optOuts, graphProviderDescriptor, traversalEngineType));
} catch (NoTestsRemainException ex) {
throw new InitializationError(ex);
}
}
}
示例2: validateOptInAndOutAnnotationsOnGraph
import org.apache.tinkerpop.gremlin.structure.Graph; //导入方法依赖的package包/类
public static void validateOptInAndOutAnnotationsOnGraph(final Class<? extends Graph> klass) throws InitializationError {
// sometimes test names change and since they are String representations they can easily break if a test
// is renamed. this test will validate such things. it is not possible to @OptOut of this test.
final Graph.OptOut[] optOuts = klass.getAnnotationsByType(Graph.OptOut.class);
for (Graph.OptOut optOut : optOuts) {
final Class testClass;
try {
testClass = Class.forName(optOut.test());
} catch (Exception ex) {
throw new InitializationError(String.format("Invalid @OptOut on Graph instance. Could not instantiate test class (it may have been renamed): %s", optOut.test()));
}
if (!optOut.method().equals("*") && !Arrays.stream(testClass.getMethods()).anyMatch(m -> m.getName().equals(optOut.method())))
throw new InitializationError(String.format("Invalid @OptOut on Graph instance. Could not match @OptOut test name %s on test class %s (it may have been renamed)", optOut.method(), optOut.test()));
}
}
示例3: checkGraphProviderDescriptorForComputer
import org.apache.tinkerpop.gremlin.structure.Graph; //导入方法依赖的package包/类
private boolean checkGraphProviderDescriptorForComputer(final Graph.OptOut optOut) {
// immediately include the ignore if this is a standard tests suite (i.e. not computer)
// or if the OptOut doesn't specify any computers to filter
if (traversalEngineType == TraversalEngine.Type.STANDARD
|| optOut.computers().length == 0) {
return true;
}
// can assume that that GraphProvider.Descriptor is not null at this point. a test should
// only opt out if it matches the expected computer
return Stream.of(optOut.computers()).map(c -> {
try {
return Class.forName(c);
} catch (ClassNotFoundException e) {
return Object.class;
}
}).filter(c -> !c.equals(Object.class)).anyMatch(c -> c == graphProviderDescriptor.get().computer());
}
示例4: OptOutTestFilter
import org.apache.tinkerpop.gremlin.structure.Graph; //导入方法依赖的package包/类
public OptOutTestFilter(final Graph.OptOut[] optOuts,
final Optional<GraphProvider.Descriptor> graphProviderDescriptor,
final TraversalEngine.Type traversalEngineType) {
this.graphProviderDescriptor = graphProviderDescriptor;
this.traversalEngineType = traversalEngineType;
// split the tests to filter into two groups - true represents those that should ignore a whole
final Map<Boolean, List<Graph.OptOut>> split = Arrays.stream(optOuts)
.filter(this::checkGraphProviderDescriptorForComputer)
.collect(Collectors.groupingBy(optOut -> optOut.method().equals("*")));
final List<Graph.OptOut> optOutsOfIndividualTests = split.getOrDefault(Boolean.FALSE, Collections.emptyList());
individualSpecificTestsToIgnore = optOutsOfIndividualTests.stream()
.filter(ignoreTest -> !ignoreTest.method().equals("*"))
.filter(allowAbstractMethod(false))
.<Pair>map(ignoreTest -> Pair.with(ignoreTest.test(), ignoreTest.specific().isEmpty() ? ignoreTest.method() : String.format("%s[%s]", ignoreTest.method(), ignoreTest.specific())))
.<Description>map(p -> Description.createTestDescription(p.getValue0().toString(), p.getValue1().toString()))
.collect(Collectors.toList());
testGroupToIgnore = optOutsOfIndividualTests.stream()
.filter(ignoreTest -> !ignoreTest.method().equals("*"))
.filter(allowAbstractMethod(true))
.<Pair>map(ignoreTest -> Pair.with(ignoreTest.test(), ignoreTest.specific().isEmpty() ? ignoreTest.method() : String.format("%s[%s]", ignoreTest.method(), ignoreTest.specific())))
.<Description>map(p -> Description.createTestDescription(p.getValue0().toString(), p.getValue1().toString()))
.collect(Collectors.toList());
entireTestCaseToIgnore = split.getOrDefault(Boolean.TRUE, Collections.emptyList());
}
示例5: allowAbstractMethod
import org.apache.tinkerpop.gremlin.structure.Graph; //导入方法依赖的package包/类
private Predicate<Graph.OptOut> allowAbstractMethod(final boolean allow) {
return optOut -> {
try {
// ignore those methods in process that are defined as abstract methods
final Class testClass = Class.forName(optOut.test());
if (allow)
return Modifier.isAbstract(testClass.getModifiers());
else
return !Modifier.isAbstract(testClass.getModifiers());
} catch (Exception ex) {
throw new RuntimeException(ex);
}
};
}
示例6: transformToClass
import org.apache.tinkerpop.gremlin.structure.Graph; //导入方法依赖的package包/类
private Class<?> transformToClass(final Graph.OptOut optOut) {
try {
return Class.forName(optOut.test());
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}