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

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


    allowedRefs.put("xy", new Integer[] { 188, 206 });
    allowedRefs.put("beanFactory", new Integer[] { 193 });

    AutowireDependencyProvider provider = new AutowireDependencyProvider(config, config);
    Map<IBean, Set<IBeanReference>> references = provider.resolveAutowiredDependencies();
    IBean bean = BeansModelUtils.getBean("annotatedBean", config);

    assertTrue(references.size() == 1);
    assertTrue(references.containsKey(bean));

    Set<IBeanReference> refs = references.get(bean);
View Full Code Here


      // Lazily initialization of this config
      readConfig();

      try {
        r.lock();
        IBean bean = beans.get(name);
        if (bean != null) {
          return bean;
        }

        for (IBeansImport beansImport : imports) {
View Full Code Here

      // Lazily initialization of this config
      readConfig();

      try {
        r.lock();
        IBean bean = beans.get(name);
        if (bean != null) {
          return true;
        }

        for (IBeansImport beansImport : imports) {
View Full Code Here

  private Set<PropertyValue> beanProperties;

  private String elemenetId;

  public Set<IBeanProperty> getBeanProperties() {
    IBean bean = (IBean) BeansCorePlugin.getModel().getElement(getElemenetId());
    Set<IBeanProperty> properties = new LinkedHashSet<IBeanProperty>();
    for (PropertyValue property : beanProperties) {
      RuntimeBeanReference rbr = new RuntimeBeanReference(
          ((SerializableRuntimeBeanReference) property.getValue()).getBeanName());
      rbr.setSource(((SerializableRuntimeBeanReference) property.getValue()).getSource());
View Full Code Here

    beansConfig = BeansCorePlugin.getModel().getConfig((IFile) resource);
  }

  @Test
  public void testCorrectArgumentCount() throws Exception {
    IBean bean = BeansModelUtils.getBean("correct", beansConfig);
    assertNotNull(bean);
    int severity = MarkerUtils.getHighestSeverityFromMarkersInRange(resource, bean
        .getElementStartLine(), bean.getElementEndLine());
    assertTrue("No error expected for bean", severity != IMarker.SEVERITY_ERROR
        && severity != IMarker.SEVERITY_WARNING);

  }
View Full Code Here

  }

  @Test
  public void testCorrectArgumentCountOnChildBean() throws Exception {
    IBean bean = BeansModelUtils.getBean("correctChild", beansConfig);
    assertNotNull(bean);
    int severity = MarkerUtils.getHighestSeverityFromMarkersInRange(resource, bean
        .getElementStartLine(), bean.getElementEndLine());
    assertTrue("No error expected for bean", severity != IMarker.SEVERITY_ERROR
        && severity != IMarker.SEVERITY_WARNING);

  }
View Full Code Here

  @Test
  public void testNoArgumentValues() throws Exception {
    String[] errorMessages = new String[] { "No constructor with 0 arguments defined in class 'org.springframework.Factory'" };

    IBean bean = BeansModelUtils.getBean("incorrect", beansConfig);
    assertNotNull(bean);
    int severity = MarkerUtils.getHighestSeverityFromMarkersInRange(resource, bean
        .getElementStartLine(), bean.getElementEndLine());
    assertEquals(IMarker.SEVERITY_ERROR, severity);

    Set<IMarker> markers = MarkerUtils.getAllMarkersInRange(resource, bean
        .getElementStartLine(), bean.getElementEndLine());
    assertEquals(1, markers.size());
    for (IMarker marker : markers) {
      String msg = (String) marker.getAttribute(IMarker.MESSAGE);
      assertTrue("Error message not expected '" + msg + "'", Arrays.asList(errorMessages)
          .contains(msg));
View Full Code Here

  @Test
  public void testTooFewArgumentValues() throws Exception {
    String[] errorMessages = new String[] { "No constructor with 3 arguments defined in class 'org.springframework.Factory'" };
   
    IBean bean = BeansModelUtils.getBean("incorrectWithArgs", beansConfig);
    assertNotNull(bean);
    int severity = MarkerUtils.getHighestSeverityFromMarkersInRange(resource, bean
        .getElementStartLine(), bean.getElementEndLine());
    assertEquals(IMarker.SEVERITY_ERROR, severity);
   
    Set<IMarker> markers = MarkerUtils.getAllMarkersInRange(resource, bean
        .getElementStartLine(), bean.getElementEndLine());
    assertEquals(1, markers.size());
    for (IMarker marker : markers) {
      String msg = (String) marker.getAttribute(IMarker.MESSAGE);
      assertTrue("Error message not expected '" + msg + "'", Arrays.asList(errorMessages)
          .contains(msg));
View Full Code Here

    beansConfig = BeansCorePlugin.getModel().getConfig((IFile) resource);
  }

  @Test
  public void testCorrectInitAndDestroyMethodUsage() throws Exception {
    IBean bean = BeansModelUtils.getBean("correct", beansConfig);
    assertNotNull(bean);
    int severity = MarkerUtils.getHighestSeverityFromMarkersInRange(resource, bean
        .getElementStartLine(), bean.getElementEndLine());
    assertTrue("No error expected for bean", severity != IMarker.SEVERITY_ERROR
        && severity != IMarker.SEVERITY_WARNING);
   
  }
View Full Code Here

    String[] errorMessages = new String[] {
        "Destroy-method 'notExisting' not found in bean class 'org.springframework.Base'",
        "Init-method 'notExisting' not found in bean class 'org.springframework.Base'",
        "Static factory method 'notExisting' with 0 arguments not found in factory bean class 'org.springframework.Base'" };

    IBean bean = BeansModelUtils.getBean("incorrect", beansConfig);
    assertNotNull(bean);
    int severity = MarkerUtils.getHighestSeverityFromMarkersInRange(resource, bean
        .getElementStartLine(), bean.getElementEndLine());
    assertTrue(severity == IMarker.SEVERITY_ERROR);

    Set<IMarker> markers = MarkerUtils.getAllMarkersInRange(resource, bean
        .getElementStartLine(), bean.getElementEndLine());
    assertTrue(markers.size() == 3);
    for (IMarker marker : markers) {
      String msg = (String) marker.getAttribute(IMarker.MESSAGE);
      assertTrue("Error message not expected '" + msg + "'", Arrays.asList(errorMessages)
          .contains(msg));
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.