@Test public void test83() throws FileNotFoundException, IOException, ClassNotFoundException { CompactObjectInputStream ois = new CompactObjectInputStream(new FileInputStream(UnitTestUtil.getTestDataFile("req.ser")), RequestMessage.class.getClassLoader()); RequestMessage rm = (RequestMessage) ois.readObject(); ois.close(); assertFalse(rm.isReturnAutoGeneratedKeys()); assertFalse(rm.isDelaySerialization()); }
if (this.requestMsg.isReturnAutoGeneratedKeys() && command instanceof Insert) { Insert insert = (Insert)command; List<ElementSymbol> variables = ResolverUtil.resolveElementsInGroup(insert.getGroup(), metadata);
if (this.requestMsg.isReturnAutoGeneratedKeys() && command instanceof Insert) { Insert insert = (Insert)command; List<ElementSymbol> variables = ResolverUtil.resolveElementsInGroup(insert.getGroup(), metadata);
protected boolean validateAccess(String[] commandStr, Command command, CommandType type) throws QueryValidatorException, TeiidComponentException { boolean returnsResultSet = command.returnsResultSet(); this.returnsUpdateCount = !(command instanceof StoredProcedure) && !returnsResultSet; if ((this.requestMsg.getResultsMode() == ResultsMode.UPDATECOUNT && returnsResultSet) || (this.requestMsg.getResultsMode() == ResultsMode.RESULTSET && !returnsResultSet)) { throw new QueryValidatorException(QueryPlugin.Event.TEIID30490, QueryPlugin.Util.getString(this.requestMsg.getResultsMode()==ResultsMode.RESULTSET?"Request.no_result_set":"Request.result_set")); //$NON-NLS-1$ //$NON-NLS-2$ } createCommandContext(); if (command instanceof Insert) { context.setReturnAutoGeneratedKeys(this.requestMsg.isReturnAutoGeneratedKeys()); } if (!this.workContext.isAdmin() && this.authorizationValidator != null) { return this.authorizationValidator.validate(commandStr, command, metadata, context, type); } return false; }
@Test public void testSerialize() throws Exception { RequestMessage copy = UnitTestUtil.helpSerialize(example()); assertTrue(copy.isCallableStatement()); assertEquals(100, copy.getFetchSize()); assertNotNull(copy.getParameterValues()); assertEquals(4, copy.getParameterValues().size()); assertEquals(new Integer(100), copy.getParameterValues().get(0)); assertEquals(new Integer(200), copy.getParameterValues().get(1)); assertEquals(new Integer(300), copy.getParameterValues().get(2)); assertEquals(new Integer(400), copy.getParameterValues().get(3)); assertFalse(copy.isPreparedStatement()); assertEquals("myStyleSheet", copy.getStyleSheet()); //$NON-NLS-1$ assertEquals("myExecutionPayload", copy.getExecutionPayload()); //$NON-NLS-1$ assertEquals(RequestMessage.TXN_WRAP_ON, copy.getTxnAutoWrapMode()); assertEquals(ShowPlan.ON, copy.getShowPlan()); assertEquals(1313, copy.getRowLimit()); assertTrue(copy.isReturnAutoGeneratedKeys()); assertTrue(copy.isDelaySerialization()); assertEquals("foo", copy.getSpanContext()); }