use of org.teiid.core.TeiidComponentException in project teiid by teiid.
the class TestSocketServiceRegistry method testXATransactionExceptionConversion.
public void testXATransactionExceptionConversion() throws Exception {
Method m = DQP.class.getMethod("recover", new Class[] { Integer.TYPE });
Throwable t = ExceptionUtil.convertException(m, new TeiidComponentException());
assertTrue(t instanceof XATransactionException);
}
use of org.teiid.core.TeiidComponentException in project teiid by teiid.
the class TestSocketServiceRegistry method testExceptionConversionNoException.
public void testExceptionConversionNoException() throws Exception {
Method m = Foo.class.getMethod("somemethod", new Class[] {});
Throwable t = ExceptionUtil.convertException(m, new TeiidComponentException());
assertTrue(t instanceof TeiidRuntimeException);
}
use of org.teiid.core.TeiidComponentException in project teiid by teiid.
the class TestOptimizer method getPlan.
public static ProcessorPlan getPlan(Command command, QueryMetadataInterface md, CapabilitiesFinder capFinder, AnalysisRecord analysisRecord, boolean shouldSucceed, CommandContext cc) {
ProcessorPlan plan = null;
if (analysisRecord == null) {
analysisRecord = new AnalysisRecord(false, DEBUG);
}
Exception exception = null;
try {
// do planning
plan = QueryOptimizer.optimizePlan(command, md, null, capFinder, analysisRecord, cc);
} catch (QueryPlannerException e) {
exception = e;
} catch (TeiidComponentException e) {
exception = e;
} catch (Throwable e) {
throw new TeiidRuntimeException(e);
} finally {
if (DEBUG) {
System.out.println(analysisRecord.getDebugLog());
}
}
if (!shouldSucceed) {
// $NON-NLS-1$
assertNotNull("Expected exception but did not get one.", exception);
return null;
}
if (plan == null) {
throw new TeiidRuntimeException(exception);
}
// $NON-NLS-1$
assertNotNull("Output elements are null", plan.getOutputElements());
// $NON-NLS-1$
if (DEBUG)
System.out.println("\n" + plan);
return plan;
}
use of org.teiid.core.TeiidComponentException in project teiid by teiid.
the class TestBatchedUpdatePlanner method helpPlanCommand.
private BatchedUpdatePlan helpPlanCommand(Command command, QueryMetadataInterface md, CapabilitiesFinder capFinder, boolean shouldSucceed) throws QueryPlannerException, QueryMetadataException, TeiidComponentException {
// plan
ProcessorPlan plan = null;
AnalysisRecord analysisRecord = new AnalysisRecord(false, DEBUG);
if (shouldSucceed) {
try {
// do planning
plan = QueryOptimizer.optimizePlan(command, md, null, capFinder, analysisRecord, null);
} finally {
if (DEBUG) {
System.out.println(analysisRecord.getDebugLog());
}
}
return (BatchedUpdatePlan) plan;
}
Exception exception = null;
try {
// do planning
QueryOptimizer.optimizePlan(command, md, null, capFinder, analysisRecord, null);
} catch (QueryPlannerException e) {
exception = e;
} catch (TeiidComponentException e) {
exception = e;
} finally {
if (DEBUG) {
System.out.println(analysisRecord.getDebugLog());
}
}
// $NON-NLS-1$
assertNotNull("Expected exception but did not get one.", exception);
return null;
}
use of org.teiid.core.TeiidComponentException in project teiid by teiid.
the class ComplexDocumentFilter method matches.
@Override
public boolean matches(Map<String, Object> parentProperties, Map<String, Object> childProperties) throws TranslatorException {
try {
List<Object> tuple = new ArrayList<>();
int i = 0;
for (Column column : parentTable.getMetadataObject().getColumns()) {
tuple.add(i++, parentProperties.get(MarshallerBuilder.getDocumentAttributeName(column, false, metadata)));
}
for (Column column : childTable.getMetadataObject().getColumns()) {
tuple.add(i++, childProperties.get(MarshallerBuilder.getDocumentAttributeName(column, true, metadata)));
}
org.teiid.query.util.CommandContext cc = new org.teiid.query.util.CommandContext();
final Evaluator evaluator = new Evaluator(elementMap, null, cc);
return evaluator.evaluate(criteria, tuple);
} catch (ExpressionEvaluationException e) {
throw new TranslatorException(e);
} catch (BlockedException e) {
throw new TranslatorException(e);
} catch (TeiidComponentException e) {
throw new TranslatorException(e);
}
}
Aggregations