@Test public void testInsertDestination_Exception() throws Exception { FileDataOutputParameter p = new FileDataOutputParameter(); File f = TempFileUtils.createTrackedFile(testName.getMethodName(), "", p); p.setDestination(new ConfiguredProduceDestination("file: AdaptrisMessage msg = mock(AdaptrisMessage.class); doThrow(new RuntimeException()).when(msg).getContentEncoding(); try { p.insert(TEXT, msg); fail(); } catch (CoreException expected) { } }
@Override public void insert(String data, InterlokMessage message) throws CoreException { try { URL url = FsHelper.createUrlFromString(this.url(message), true); try (OutputStream out = new FileOutputStream(FsHelper.createFileReference(url))) { IOUtils.write(data, out, message.getContentEncoding()); } } catch (Exception e) { throw ExceptionHelper.wrapCoreException(e); } }
FileDataOutputParameter extends FileParameter implements DataOutputParameter<String> { @Override public void insert(String data, InterlokMessage message) throws CoreException { try { URL url = FsHelper.createUrlFromString(this.url(message), true); try (OutputStream out = new FileOutputStream(FsHelper.createFileReference(url))) { IOUtils.write(data, out, message.getContentEncoding()); } } catch (Exception e) { throw ExceptionHelper.wrapCoreException(e); } } }
FileDataOutputParameter extends FileParameter implements DataOutputParameter<String> { @Override public void insert(String data, InterlokMessage message) throws CoreException { try { URL url = FsHelper.createUrlFromString(this.url(message), true); try (OutputStream out = new FileOutputStream(FsHelper.createFileReference(url))) { IOUtils.write(data, out, message.getContentEncoding()); } } catch (Exception e) { throw ExceptionHelper.wrapCoreException(e); } } FileDataOutputParameter(); }
FileDataOutputParameter extends FileParameter implements DataOutputParameter<String> { @Override public void insert(String data, InterlokMessage message) throws CoreException { try { URL url = FsHelper.createUrlFromString(this.url(message), true); try (OutputStream out = new FileOutputStream(FsHelper.createFileReference(url))) { IOUtils.write(data, out, message.getContentEncoding()); } } catch (Exception e) { throw ExceptionHelper.wrapCoreException(e); } } FileDataOutputParameter(); @Override void insert(String data, InterlokMessage message); }
FileDataOutputParameter extends FileParameter implements DataOutputParameter<String> { @Override public void insert(String data, InterlokMessage message) throws CoreException { try { URL url = FsHelper.createUrlFromString(this.url(message), true); try (OutputStream out = new FileOutputStream(FsHelper.createFileReference(url))) { IOUtils.write(data, out, message.getContentEncoding()); } } catch (Exception e) { throw ExceptionHelper.wrapCoreException(e); } } FileDataOutputParameter(); @Override void insert(String data, InterlokMessage message);  }