Package org.springframework.ide.eclipse.beans.core.model

Examples of org.springframework.ide.eclipse.beans.core.model.IBean


    BeansConfig config = new BeansConfig(beansProject, "basic-bean-config.xml", IBeansConfig.Type.MANUAL);
   
    Set<IBean> beans = BeansModelUtils.getBeans(config);
    assertEquals(1, beans.size());

    IBean bean = beans.iterator().next();
    assertEquals("simpleBean", bean.getElementName());
   
    IModelElement[] children = config.getElementChildren();
    assertEquals(1, children.length);
  }
View Full Code Here


    Set<IBean> beans = BeansModelUtils.getBeans(config);
    assertEquals(2, beans.size());

    assertNotNull(BeansModelUtils.getBean("simpleBean", config));
   
    IBean aspectjBean = BeansModelUtils.getBean("org.springframework.aop.config.internalAutoProxyCreator", config);
    assertNotNull(aspectjBean);
    assertEquals("org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator", aspectjBean.getClassName());
  }
View Full Code Here

  @Test
  public void testBasicComponentScanning() throws Exception {
    BeansConfig config = new BeansConfig(beansProject, "basic-component-scanning.xml", IBeansConfig.Type.MANUAL);
   
    IBean bean = BeansModelUtils.getBean("simpleScannedBean", config);
    assertEquals("simpleScannedBean", bean.getElementName());
  }
View Full Code Here

  @Test
  public void testComponentScanningWithEnableAnnotations() throws Exception {
    BeansConfig config = new BeansConfig(beansProject, "advanced-component-scanning.xml", IBeansConfig.Type.MANUAL);
   
    IBean simpleBean = BeansModelUtils.getBean("simpleScannedBean", config);
    assertEquals("simpleScannedBean", simpleBean.getElementName());

    IBean bean = BeansModelUtils.getBean("advancedConfigurationClass", config);
    assertEquals("advancedConfigurationClass", bean.getElementName());
   
    IBean transactionBean = BeansModelUtils.getBean("org.springframework.transaction.config.internalTransactionAdvisor", config);
    assertEquals("org.springframework.transaction.config.internalTransactionAdvisor", transactionBean.getElementName());

    IBean aspectjBean = BeansModelUtils.getBean("org.springframework.aop.config.internalAutoProxyCreator", config);
    assertNotNull(aspectjBean);
    assertEquals("org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator", aspectjBean.getClassName());
  }
View Full Code Here

  @Test
  public void testComponentScanningWithProfile() throws Exception {
    BeansConfig config = new BeansConfig(beansProject, "profile-component-scanning.xml", IBeansConfig.Type.MANUAL);
   
    IBean simpleBean = BeansModelUtils.getBean("simpleScannedBean", config);
    assertEquals("simpleScannedBean", simpleBean.getElementName());

    IBean configClassBean = BeansModelUtils.getBean("profileConfigurationClass", config);
    assertEquals("profileConfigurationClass", configClassBean.getElementName());
   
    assertEquals(1, getProfiles(simpleBean).size());
    assertEquals("testProfile", getProfiles(simpleBean).iterator().next());
   
    assertEquals(0, getProfiles(configClassBean).size());
View Full Code Here

  public Object getPropertyValue(Object id) {
    if (P_ID_NAME.equals(id)) {
      return property.getElementName();
    } else if (P_ID_BEAN.equals(id)) {
      IBean bean = (IBean) property.getElementParent();
      if (bean.isRootBean()) {
        return new RootBeanProperties(bean);
      } else if (bean.isChildBean()) {
        return new ChildBeanProperties(bean);
      } else {
        // FIXME add factory bean support
        // return new FactoryBeanProperties(bean);
      }
View Full Code Here

    else {
      // assume this is an external reference
      Iterator<?> beans = BeansEditorUtils.getBeansFromConfigSets(file)
          .iterator();
      while (beans.hasNext()) {
        IBean modelBean = (IBean) beans.next();
        if (modelBean.getElementName().equals(target)) {
          return new ExternalBeanHyperlink(modelBean, hyperlinkRegion);
        }
      }
    }
    return null;
View Full Code Here

      BeansCorePlugin.log(e);
    }

    String[] beanNames = beanNamesWrapper[0];
    for (final String beanName : beanNames) {
      IBean bean = autowireDependencyProvider.getBean(beanName);
      final IResource resource = bean.getElementResource();
      final int line = bean.getElementStartLine();
      if (resource instanceof IFile) {
        AutowireBeanHyperlink newHyperlink = new AutowireBeanHyperlink((IFile) resource, line, beanName);
        boolean found = false;

        for (AutowireBeanHyperlink hyperlink : hyperlinks) {
View Full Code Here

   * {@link IValidationContext}.
   * <p>
   * Skip IBeansMap because it's entries (IBeansMapEntry -> IBansValueHolder) are validated instead.
   */
  public boolean supports(IModelElement element, IValidationContext context) {
    IBean parentBean = BeansModelUtils.getParentOfClass(element, IBean.class);
    return (element instanceof Bean || element instanceof IBeansValueHolder || element instanceof IBeansList || element instanceof IBeansSet)
        && ((element instanceof IBean && !((IBean) element).isInfrastructure()) || (parentBean != null && !parentBean
            .isInfrastructure()));
  }
View Full Code Here

      List<ICompletionProposal> addToConfigSetProposals = new ArrayList<ICompletionProposal>();
      List<ICompletionProposal> addConfigSetProposals = new ArrayList<ICompletionProposal>();

      Set<IBeansConfig> configs = project.getConfigs();
      for (IBeansConfig config : configs) {
        IBean bean = config.getBean(beanName);
        if (bean != null) {
          importProposals.add(new CreateImportQuickFixProposal(offset, length, missingEndQuote, bean,
              beanNode, project, file));

          Set<IBeansConfigSet> configSets = project.getConfigSets();

          for (IBeansConfigSet configSet : configSets) {
            if (configSet.hasConfig((IFile) bean.getElementResource())) {
              addToConfigSetProposals.add(new AddToConfigSetQuickFixProposal(offset, length,
                  missingEndQuote, file, configSet, project));
            }
          }
          addConfigSetProposals.add(new AddConfigSetQuickFixProposal(offset, length, missingEndQuote, bean,
              file));
          foundResources.add(bean.getElementResource());
        }

      }

      proposals.addAll(importProposals);
View Full Code Here

TOP

Related Classes of org.springframework.ide.eclipse.beans.core.model.IBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.