JdbcObjectMetadataParameter extends JdbcMetadataParameter { @Override public void applyOutputParam(Object dbValue, AdaptrisMessage msg) throws JdbcParameterException { super.checkMetadataKey(); msg.addObjectHeader(this.getMetadataKey(), normalize(dbValue)); }  @Override Object applyInputParam(AdaptrisMessage msg); @Override void applyOutputParam(Object dbValue, AdaptrisMessage msg);  }
@Test public void testNoMetadataKeyForOutputParam() throws Exception { JdbcObjectMetadataParameter param = new JdbcObjectMetadataParameter(); try { param.applyOutputParam(null, message); } catch(JdbcParameterException ex) { } }
@Test public void testMetadataDoesNotExistOutputParam() throws Exception { JdbcObjectMetadataParameter param = new JdbcObjectMetadataParameter(); param.setMetadataKey("DOES_NOT_EXIST_KEY"); param.applyOutputParam(null, message); }
@Test public void testMetadataAlreadyExistsOutputParam() throws Exception { message.addObjectHeader(METADATA_KEY, METADATA_VALUE); assertEquals(message.getObjectHeaders().get(METADATA_KEY), METADATA_VALUE); JdbcObjectMetadataParameter param = new JdbcObjectMetadataParameter(); param.setMetadataKey(METADATA_KEY); param.applyOutputParam("NEW_PARAM_METADATA_VALUE", message); assertEquals(message.getObjectHeaders().get(METADATA_KEY), "NEW_PARAM_METADATA_VALUE"); }
@Test public void testMetadataAppliedOutputParam() throws Exception { JdbcObjectMetadataParameter param = new JdbcObjectMetadataParameter(); param.setMetadataKey(METADATA_KEY); param.applyOutputParam(METADATA_VALUE, message); assertTrue(message.getObjectHeaders().containsKey(METADATA_KEY)); assertEquals(message.getObjectHeaders().get(METADATA_KEY), METADATA_VALUE); }