use of com.sun.tck.lib.tgf.AbstractValue in project jtharness by openjdk.
the class ValuesComparison method checkCachedReturnsTheSame.
public static void checkCachedReturnsTheSame(Values values) {
final Values cache = values.createCache();
compare(cache, values);
checkEqualResultsForEveryIteration(cache);
final Object[][] objects_1 = ValuesComparison.createArray(cache);
final Object[][] objects_2 = ValuesComparison.createArray(cache);
org.junit.Assert.assertEquals(objects_1.length, objects_2.length);
Arrays.deepEquals(objects_1, objects_2);
for (int i = 0; i < objects_1.length; i++) {
final Object[] first = objects_1[i];
final Object[] second = objects_2[i];
for (int j = 0; j < first.length; j++) {
org.junit.Assert.assertFalse(first[j] instanceof AbstractValue);
org.junit.Assert.assertFalse(second[j] instanceof AbstractValue);
org.junit.Assert.assertSame(first[j], second[j]);
}
}
}
use of com.sun.tck.lib.tgf.AbstractValue in project jtharness by openjdk.
the class TGFTestCaseMethodSetting method processSettingMethodPhase.
private void processSettingMethodPhase(TestCaseContext.TestCaseLifePhase lifePhase, final TestCaseContext context) {
try {
if (dataIterator == null) {
final Object testGroupInstance = context.getTestGroupInstance();
Values data = collectReferencedData(context, testGroupInstance);
// todo cache somewhere somehow the generated exclude list
Map<String, Values.ExcludedIndices> excludeList = TGFUtils.createExcludeList(context.getParentContext().getExecutionArgs());
String testCaseName = context.getTestCaseName();
if (excludeList.containsKey(testCaseName)) {
data.markNotApplicable(excludeList.get(testCaseName));
}
if (data.isNotApplicable()) {
throw new NotApplicableException(data.getReasonNotApplicaple());
}
dataIterator = data.iterator();
rowIndex = -1;
notApplicableRowIndices = data.getNotApplicableRowIndices();
}
} catch (SomethingIsWrong somethingIsWrong) {
dataCreationFailure = true;
context.setThrownException(somethingIsWrong);
return;
}
if (dataIterator.hasNext() && !wasProcessorCalledForThisPhase(lifePhase)) {
rowIndex++;
rawArgs = dataIterator.next();
freshRawArgs = true;
final Object[] args = new Object[rawArgs.length];
for (int i = 0; i < rawArgs.length; i++) {
if (rawArgs[i] instanceof AbstractValue) {
args[i] = ((AbstractValue) rawArgs[i]).doCreate();
} else {
args[i] = rawArgs[i];
}
}
currentValue = args;
}
if (currentValue != null) {
context.setCallableTestCase(() -> {
context.setTestCaseInvocationArgValues(currentValue);
context.setRowIndex(rowIndex);
if (notApplicableRowIndices.isExcluded(rowIndex)) {
throw new NotApplicableException();
}
Object[] adaptedArgs = adaptArgsForVararg(context.getTestCaseMethod(), currentValue);
return context.getTestCaseMethod().invoke(context.getTestGroupInstance(), adaptedArgs);
});
}
}
Aggregations