use of org.teiid.core.TeiidException in project teiid by teiid.
the class TestExceptionUtil method testSanitize.
@Test
public void testSanitize() {
TeiidException te = new TeiidException(JDBCPlugin.Event.TEIID20000, "you don't want to see this");
te.initCause(new Exception("or this"));
Throwable t = ExceptionUtil.sanitize(te, true);
assertTrue(t.getStackTrace().length != 0);
assertNotNull(t.getCause());
assertEquals("TEIID20000", t.getMessage());
assertEquals("java.lang.Exception", t.getCause().getMessage());
t = ExceptionUtil.sanitize(te, false);
assertEquals(0, t.getStackTrace().length);
assertEquals("TEIID20000", t.getMessage());
}
use of org.teiid.core.TeiidException in project teiid by teiid.
the class TestProcessor method sampleDataBQT2.
private void sampleDataBQT2(FakeDataManager dataMgr) {
QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
String[] groups = new String[] { "bqt1.smalla", "bqt2.smalla", "bqt3.smalla" };
try {
for (int i = 0; i < groups.length; i++) {
String groupName = groups[i];
List[] tuples = new List[30];
for (int row = 0; row < tuples.length; row++) {
tuples[row] = new ArrayList(17);
tuples[row].add(new Integer(row));
for (int col = 0; col < 16; col++) {
tuples[row].add(null);
}
}
dataMgr.registerTuples(metadata, groupName, tuples);
}
} catch (TeiidException e) {
throw new RuntimeException(e);
}
}
use of org.teiid.core.TeiidException in project teiid by teiid.
the class TestBaseProcessorPlan method testGetAndClearWarnings.
@Test
public void testGetAndClearWarnings() {
FakeProcessorPlan plan = new FakeProcessorPlan(Collections.emptyList(), Collections.emptyList());
CommandContext cc = new CommandContext();
plan.initialize(cc, null, null);
// $NON-NLS-1$
TeiidException warning = new TeiidException("test");
plan.addWarning(warning);
List<Exception> warnings = cc.getAndClearWarnings();
// $NON-NLS-1$
assertEquals("Did not get expected number of warnings", 1, warnings.size());
// $NON-NLS-1$
assertEquals("Did not get expected warning", warning, warnings.get(0));
// $NON-NLS-1$
assertNull("Did not clear warnings from plan", cc.getAndClearWarnings());
}
use of org.teiid.core.TeiidException in project teiid by teiid.
the class TestQueryRewriter method parseCriteria.
// ################################## TEST HELPERS ################################
private Criteria parseCriteria(String critStr, QueryMetadataInterface metadata) {
try {
Criteria crit = QueryParser.getQueryParser().parseCriteria(critStr);
// resolve against metadata
QueryResolver.resolveCriteria(crit, metadata);
return crit;
} catch (TeiidException e) {
throw new RuntimeException(e);
}
}
use of org.teiid.core.TeiidException in project teiid by teiid.
the class TestQueryRewriter method testRewriteFunctionThrowsEvaluationError.
@Test
public void testRewriteFunctionThrowsEvaluationError() {
QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
// $NON-NLS-1$
Criteria origCrit = parseCriteria("5 / 0 = 5", metadata);
// rewrite
try {
QueryRewriter.rewriteCriteria(origCrit, null, metadata);
// $NON-NLS-1$
fail("Expected QueryValidatorException due to divide by 0");
} catch (TeiidException e) {
// looks like message is being wrapped with another exception with same message
// $NON-NLS-1$
assertEquals("TEIID30328 Unable to evaluate (5 / 0): TEIID30384 Error while evaluating function /", e.getMessage());
}
}
Aggregations