Java Code Examples for org.jboss.shrinkwrap.api.GenericArchive#add()
The following examples show how to use
org.jboss.shrinkwrap.api.GenericArchive#add() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TeiidOpenShiftClient.java From syndesis with Apache License 2.0 | 5 votes |
protected void buildDataSourceBuilders(Model model, GenericArchive archive) { for (String name : model.getSourceNames()) { try { String str = null; String replacement = model.getSourceConnectionJndiName(name); String translatorName = model.getSourceTranslatorName(name); final String resourceName; if ("salesforce".equals(translatorName)) { resourceName = "s2i/Salesforce.mustache"; } else if ("mongodb".equals(translatorName)) { resourceName = "s2i/MongoDB.mustache"; } else { resourceName = "s2i/Jdbc.mustache"; } try (InputStream is = this.getClass().getClassLoader().getResourceAsStream(resourceName)) { str = inputStreamToString(is); } str = str.replace("{{packageName}}", "io.integration"); str = str.replace("{{dsName}}", replacement); archive.add(new ByteArrayAsset(ObjectConverterUtil .convertToByteArray(new ByteArrayInputStream(str.getBytes("UTF-8")))), "/src/main/java/io/integration/DataSources" + replacement + ".java"); } catch (IOException e) { throw handleError(e); } } }
Example 2
Source File: DeploymentArchiveUtils.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
/** * Create CLI archive for deployment testing * * @param archiveName Name of archive * @param content Content in archive file deploy.scr * @return Return created {@link File} instance */ public static File createCliArchive(String archiveName, String content) { final GenericArchive cliArchive = ShrinkWrap.create(GenericArchive.class, archiveName); cliArchive.add(new StringAsset(content), "deploy.scr"); final String tempDir = TestSuiteEnvironment.getTmpDir(); final File file = new File(tempDir, cliArchive.getName()); cliArchive.as(ZipExporter.class).exportTo(file, true); return file; }