SpringBeanService { public <T> T getBeanDefinition(File configFile, Project project, String id, Class<T> type) { LSParser parser = XMLUtils.createLSParser(); GetSpringBeanFilter filter = new GetSpringBeanFilter(id, type); parser.setFilter(filter); List<File> configFiles = new ArrayList<>(); configFiles.add(configFile); configFiles.addAll(getConfigImports(configFile, project)); for (File file : configFiles) { parser.parseURI(file.toURI().toString()); if (filter.getBeanDefinition() != null) { return createJaxbObjectFromElement(filter.getBeanDefinition()); } } return null; }  List<File> getConfigImports(File configFile, Project project); T getBeanDefinition(File configFile, Project project, String id, Class<T> type); List<T> getBeanDefinitions(File configFile, Project project, Class<T> type); List<T> getBeanDefinitions(File configFile, Project project, Class<T> type, Map<String, String> attributes); List<String> getBeanNames(File configFile, Project project, String beanType); void addBeanDefinition(File configFile, Project project, Object jaxbElement); void removeBeanDefinition(File configFile, Project project, String id); void removeBeanDefinitions(File configFile, Project project, Class<?> type); void removeBeanDefinitions(File configFile, Project project, Class<?> type, String attributeName, String attributeValue); void updateBeanDefinition(File configFile, Project project, String id, Object jaxbElement); void updateBeanDefinitions(File configFile, Project project, Class<?> type, Object jaxbElement); void updateBeanDefinitions(File configFile, Project project, Class<?> type, Object jaxbElement, String attributeName, String attributeValue); void setSpringBeanMarshaller(SpringBeanMarshaller springBeanMarshaller); static final String FAILED_TO_UPDATE_BEAN_DEFINITION; static final String UNABLE_TO_READ_TRANSFORMATION_SOURCE; }
@Test public void testGetBeanDefinition() throws Exception { File tempFile = createTempContextFile("citrus-context-find"); SchemaModel schema = springBeanConfigService.getBeanDefinition(tempFile, project, "helloSchema", SchemaModel.class); Assert.assertEquals(schema.getId(), "helloSchema"); Assert.assertEquals(schema.getLocation(), "classpath:com/consol/citrus/demo/sayHello.xsd"); schema = springBeanConfigService.getBeanDefinition(tempFile, project, "helloSchemaExtended", SchemaModel.class); Assert.assertEquals(schema.getId(), "helloSchemaExtended"); Assert.assertEquals(schema.getLocation(), "classpath:com/consol/citrus/demo/sayHelloExtended.xsd"); }