private void helpFailUpdateProcedure(String procedure, String userUpdateStr, Table.TriggerEvent procedureType, String msg) { // resolve try { helpResolveUpdateProcedure(procedure, userUpdateStr, procedureType); fail("Expected a QueryResolverException but got none."); //$NON-NLS-1$ } catch(QueryResolverException ex) { if (msg != null) { assertEquals(msg, ex.getMessage()); } } catch (TeiidComponentException e) { throw new RuntimeException(e); } catch (QueryParserException e) { throw new RuntimeException(e); } }
private void helpResolveException(String userUpdateStr, QueryMetadataInterface metadata, String msg) throws QueryParserException, TeiidComponentException { try { helpResolve(userUpdateStr, metadata); fail(); } catch (QueryResolverException e) { assertEquals(msg, e.getMessage()); } }
static void helpResolveException(String sql, QueryMetadataInterface queryMetadata, String expectedExceptionMessage){ // parse Command command = helpParse(sql); // resolve try { QueryResolver.resolveCommand(command, queryMetadata); fail("Expected exception for resolving " + sql); //$NON-NLS-1$ } catch(QueryResolverException e) { if(expectedExceptionMessage != null){ assertEquals(expectedExceptionMessage, e.getMessage()); } } catch(TeiidComponentException e) { throw new RuntimeException(e); } }
@Test public void testStoredQueryTransformationWithVariable4() throws Exception { Command command = QueryParser.getQueryParser().parseCommand("EXEC pm1.sq2(pm1.sq2.in)"); //$NON-NLS-1$ // resolve try { // Construct command metadata GroupSymbol sqGroup = new GroupSymbol("pm1.sq5"); //$NON-NLS-1$ ArrayList sqParams = new ArrayList(); ElementSymbol in = new ElementSymbol("pm1.sq5.in1"); //$NON-NLS-1$ in.setType(DataTypeManager.DefaultDataClasses.STRING); sqParams.add(in); Map externalMetadata = new HashMap(); externalMetadata.put(sqGroup, sqParams); QueryResolver.resolveCommand(command, metadata); fail("Expected exception on invalid variable pm1.sq2.in"); //$NON-NLS-1$ } catch(QueryResolverException e) { assertEquals("TEIID31119 Symbol pm1.sq2.\"in\" is specified with an unknown group context", e.getMessage()); //$NON-NLS-1$ } }
fail(); }catch(QueryResolverException qe){ assertEquals("TEIID30558 Error converting parameter number 1 with value \"x\" of class java.lang.String to expected type integer.", qe.getMessage()); //$NON-NLS-1$ fail(); }catch(QueryResolverException qe){ assertEquals("TEIID30556 The number of bound values '2' does not match the number of parameters '1' in the prepared statement.", qe.getMessage()); //$NON-NLS-1$ fail(); }catch(QueryResolverException qe){ assertEquals("TEIID30556 The number of bound values '2' does not match the number of parameters '1' in the prepared statement.", qe.getMessage()); //$NON-NLS-1$
@Test public void testResolveBadConvert() throws Exception { Function function = new Function("convert", new Expression[] {new Constant(new Character('a')), new Constant(DataTypeManager.DefaultDataTypes.DATE)}); //$NON-NLS-1$ try { ResolverVisitor.resolveLanguageObject(function, RealMetadataFactory.example1Cached()); fail("excpetion expected"); //$NON-NLS-1$ } catch (QueryResolverException err) { assertEquals("TEIID30071 The conversion from char to date is not allowed.", err.getMessage()); //$NON-NLS-1$ } }
@Test public void testResolveUnqualifiedCriteria() throws Exception{ Criteria criteria = QueryParser.getQueryParser().parseCriteria("e1 = 1"); //$NON-NLS-1$ // resolve try { QueryResolver.resolveCriteria(criteria, metadata); fail("Exception expected"); //$NON-NLS-1$ } catch(QueryResolverException e) { assertEquals("TEIID31119 Symbol e1 is specified with an unknown group context", e.getMessage()); //$NON-NLS-1$ } }
@Test public void testMissingInput() throws Exception { String sql = "{? = call pm4.spTest9()}"; //$NON-NLS-1$ try { TestPreparedStatement.helpTestProcessing(sql, Collections.EMPTY_LIST, null, new HardcodedDataManager(), RealMetadataFactory.exampleBQTCached(), true, RealMetadataFactory.exampleBQTVDB()); fail(); } catch (QueryResolverException e) { assertEquals("TEIID30089 Required parameter 'pm4.spTest9.inkey' has no value was set or is an invalid parameter.", e.getMessage()); //$NON-NLS-1$ } }
@Test public void testResolveAmbiguousFunction() throws Exception { Function function = new Function("LCASE", new Expression[] {new Reference(0)}); //$NON-NLS-1$ try { ResolverVisitor.resolveLanguageObject(function, RealMetadataFactory.example1Cached()); fail("excpetion expected"); //$NON-NLS-1$ } catch (QueryResolverException err) { assertEquals("TEIID30069 The function 'LCASE(?)' has more than one possible signature.", err.getMessage()); //$NON-NLS-1$ } }
log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31116, exprString, fbi.getFullName(), e.getMessage()));
log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31116, exprString, fbi.getFullName(), e.getMessage()));
log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31116, exprString, fbi.getFullName(), e.getMessage()));