protected InputStream getMyBatisXmlConfigurationSteam() { return ReflectUtil.getResourceAsStream(DEFAULT_MYBATIS_MAPPING_FILE); }
protected InputStream getMyBatisXmlConfigurationSteam() { return ReflectUtil.getResourceAsStream(DEFAULT_MYBATIS_MAPPING_FILE); }
public InputStream getInputStream() { InputStream inputStream = null; if (classLoader == null) { inputStream = ReflectUtil.getResourceAsStream(resource); } else { classLoader.getResourceAsStream(resource); } ensureNotNull("resource '" + resource + "' doesn't exist", "inputStream", inputStream); return inputStream; }
public InputStream getInputStream() { InputStream inputStream = null; if (classLoader == null) { inputStream = ReflectUtil.getResourceAsStream(resource); } else { classLoader.getResourceAsStream(resource); } ensureNotNull("resource '" + resource + "' doesn't exist", "inputStream", inputStream); return inputStream; }
public static void readJavaUtilLoggingConfigFromClasspath() { InputStream inputStream = ReflectUtil.getResourceAsStream("logging.properties"); try { if (inputStream != null) { LogManager.getLogManager().readConfiguration(inputStream); String redirectCommons = LogManager.getLogManager().getProperty("redirect.commons.logging"); if ((redirectCommons != null) && (!redirectCommons.equalsIgnoreCase("false"))) { System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.Jdk14Logger"); } } } catch (Exception e) { throw new PvmException("couldn't initialize logging properly", e); } finally { IoUtil.closeSilently(inputStream); } }
public static void readJavaUtilLoggingConfigFromClasspath() { InputStream inputStream = ReflectUtil.getResourceAsStream("logging.properties"); try { if (inputStream != null) { LogManager.getLogManager().readConfiguration(inputStream); String redirectCommons = LogManager.getLogManager().getProperty("redirect.commons.logging"); if ((redirectCommons != null) && (!redirectCommons.equalsIgnoreCase("false"))) { System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.Jdk14Logger"); } } } catch (Exception e) { throw new PvmException("couldn't initialize logging properly", e); } finally { IoUtil.closeSilently(inputStream); } }
public DeploymentBuilder addClasspathResource(String resource) { InputStream inputStream = ReflectUtil.getResourceAsStream(resource); ensureNotNull("resource '" + resource + "' not found", "inputStream", inputStream); return addInputStream(resource, inputStream); }
public DeploymentBuilder addClasspathResource(String resource) { InputStream inputStream = ReflectUtil.getResourceAsStream(resource); ensureNotNull("resource '" + resource + "' not found", "inputStream", inputStream); return addInputStream(resource, inputStream); }
/** * get a resource location by convention based on a class (type) and a * relative resource name. The return value will be the full classpath * location of the type, plus a suffix built from the name parameter: * <code>BpmnDeployer.BPMN_RESOURCE_SUFFIXES</code>. * The first resource matching a suffix will be returned. */ public static String getBpmnProcessDefinitionResource(Class< ? > type, String name) { for (String suffix : RESOURCE_SUFFIXES) { String resource = createResourceName(type, name, suffix); InputStream inputStream = ReflectUtil.getResourceAsStream(resource); if (inputStream == null) { continue; } else { return resource; } } return createResourceName(type, name, BpmnDeployer.BPMN_RESOURCE_SUFFIXES[0]); }
/** * get a resource location by convention based on a class (type) and a * relative resource name. The return value will be the full classpath * location of the type, plus a suffix built from the name parameter: * <code>BpmnDeployer.BPMN_RESOURCE_SUFFIXES</code>. * The first resource matching a suffix will be returned. */ public static String getBpmnProcessDefinitionResource(Class< ? > type, String name) { for (String suffix : RESOURCE_SUFFIXES) { String resource = createResourceName(type, name, suffix); InputStream inputStream = ReflectUtil.getResourceAsStream(resource); if (inputStream == null) { continue; } else { return resource; } } return createResourceName(type, name, BpmnDeployer.BPMN_RESOURCE_SUFFIXES[0]); }
private InputStream createMockCaseDefinitionCmmnXml() { // do not close the input stream, will be done in implementation InputStream cmmnXmlInputStream = ReflectUtil.getResourceAsStream("cases/case-model.cmmn"); Assert.assertNotNull(cmmnXmlInputStream); return cmmnXmlInputStream; }
private InputStream createMockProcessDefinionBpmn20Xml() { // do not close the input stream, will be done in implementation InputStream bpmn20XmlIn = null; bpmn20XmlIn = ReflectUtil.getResourceAsStream("processes/fox-invoice_en_long_id.bpmn"); Assert.assertNotNull(bpmn20XmlIn); return bpmn20XmlIn; }
private InputStream createMockDeploymentResourceBpmnData() { // do not close the input stream, will be done in implementation InputStream bpmn20XmlIn = ReflectUtil.getResourceAsStream("processes/fox-invoice_en_long_id.bpmn"); assertNotNull(bpmn20XmlIn); return bpmn20XmlIn; }
private InputStream createMockDeploymentResourceSvgData() { // do not close the input stream, will be done in implementation InputStream image = ReflectUtil.getResourceAsStream("processes/diagram.svg"); assertNotNull(image); return image; }
protected InputStream createMockDecisionRequirementsDefinitionDmnXml() { // do not close the input stream, will be done in implementation InputStream dmnXmlInputStream = ReflectUtil.getResourceAsStream("decisions/decision-requirements-model.dmn"); Assert.assertNotNull(dmnXmlInputStream); return dmnXmlInputStream; }
private InputStream createMockDecisionDefinitionDmnXml() { // do not close the input stream, will be done in implementation InputStream dmnXmlInputStream = ReflectUtil.getResourceAsStream("decisions/decision-model.dmn"); Assert.assertNotNull(dmnXmlInputStream); return dmnXmlInputStream; }
InputStream resourceAsStream = null; try { resourceAsStream = ReflectUtil.getResourceAsStream(resourceLocation); if (resourceAsStream != null) { resourceBytes = IoUtil.readInputStream(resourceAsStream, resourcePath);
public void executeSchemaResource(String operation, String component, String resourceName, boolean isOptional) { InputStream inputStream = null; try { inputStream = ReflectUtil.getResourceAsStream(resourceName); if (inputStream == null) { if (isOptional) { LOG.missingSchemaResource(resourceName, operation); } else { throw LOG.missingSchemaResourceException(resourceName, operation); } } else { executeSchemaResource(operation, component, resourceName, inputStream); } } finally { IoUtil.closeSilently(inputStream); } }
public void executeSchemaResource(String operation, String component, String resourceName, boolean isOptional) { InputStream inputStream = null; try { inputStream = ReflectUtil.getResourceAsStream(resourceName); if (inputStream == null) { if (isOptional) { LOG.missingSchemaResource(resourceName, operation); } else { throw LOG.missingSchemaResourceException(resourceName, operation); } } else { executeSchemaResource(operation, component, resourceName, inputStream); } } finally { IoUtil.closeSilently(inputStream); } }
@Deployment public void testGetBpmnXmlFileThroughService() { String deploymentId = repositoryService.createDeploymentQuery().singleResult().getId(); List<String> deploymentResources = repositoryService.getDeploymentResourceNames(deploymentId); // verify bpmn file name assertEquals(1, deploymentResources.size()); String bpmnResourceName = "org/camunda/bpm/engine/test/bpmn/deployment/BpmnDeploymentTest.testGetBpmnXmlFileThroughService.bpmn20.xml"; assertEquals(bpmnResourceName, deploymentResources.get(0)); ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult(); assertEquals(bpmnResourceName, processDefinition.getResourceName()); assertNull(processDefinition.getDiagramResourceName()); assertFalse(processDefinition.hasStartFormKey()); ReadOnlyProcessDefinition readOnlyProcessDefinition = ((RepositoryServiceImpl)repositoryService).getDeployedProcessDefinition(processDefinition.getId()); assertNull(readOnlyProcessDefinition.getDiagramResourceName()); // verify content InputStream deploymentInputStream = repositoryService.getResourceAsStream(deploymentId, bpmnResourceName); String contentFromDeployment = readInputStreamToString(deploymentInputStream); assertTrue(contentFromDeployment.length() > 0); assertTrue(contentFromDeployment.contains("process id=\"emptyProcess\"")); InputStream fileInputStream = ReflectUtil.getResourceAsStream("org/camunda/bpm/engine/test/bpmn/deployment/BpmnDeploymentTest.testGetBpmnXmlFileThroughService.bpmn20.xml"); String contentFromFile = readInputStreamToString(fileInputStream); assertEquals(contentFromFile, contentFromDeployment); }