Package org.eclipse.wst.xml.core.internal.document

Examples of org.eclipse.wst.xml.core.internal.document.AttrImpl


public class AddConstructorArgQuickFixProposalTest extends AbstractBeanFileQuickfixTestCase {

  private IDOMNode getBeanAndApplyProposal(String beanName, int addition, int original) {
    IDOMNode beanNode = QuickfixTestUtil.getNode(BeansSchemaConstants.ELEM_BEAN, beanName, beansNode
        .getChildNodes());
    AttrImpl classAttr = (AttrImpl) beanNode.getAttributes().getNamedItem(BeansSchemaConstants.ATTR_CLASS);
    ITextRegion valueRegion = classAttr.getValueRegion();

    int offset = getOffset(valueRegion, beanNode);
    int length = getLength(valueRegion, false);

    AddConstructorArgQuickFixProposal proposal = new AddConstructorArgQuickFixProposal(offset, length, false,
View Full Code Here


  private boolean hasError(String beanName) {
    NodeList children = beansNode.getChildNodes();
    IDOMNode node = QuickfixTestUtil.getNode(BeansSchemaConstants.ELEM_BEAN, beanName, children);

    AttrImpl classAttr = (AttrImpl) node.getAttributes().getNamedItem(BeansSchemaConstants.ATTR_CLASS);

    String className = classAttr.getNodeValue();

    IBeansConfig config = BeansCorePlugin.getModel().getConfig(file);
    Set<IResourceModelElement> contextElements = getContextElements(config);
    for (IResourceModelElement contextElement : contextElements) {
      if (classAttrValidator.validateAttributeWithConfig(config, contextElement, file, classAttr, node, reporter,
View Full Code Here

  private boolean hasError(String beanName) {
    NodeList children = beansNode.getChildNodes();
    IDOMNode node = QuickfixTestUtil.getNode(BeansSchemaConstants.ELEM_ALIAS, beanName, children);

    AttrImpl aliasAttr = (AttrImpl) node.getAttributes().getNamedItem(BeansSchemaConstants.ATTR_ALIAS);

    String alias = aliasAttr.getNodeValue();

    IBeansConfig config = BeansCorePlugin.getModel().getConfig(file);
    Set<IResourceModelElement> contextElements = getContextElements(config);

    for (IResourceModelElement contextElement : contextElements) {
View Full Code Here

  private BeanReferenceValidator beanRefAttrValidator;

  private boolean hasBeanRefError(String beanName) {
    NodeList children = beansNode.getChildNodes();
    IDOMNode beanNode = QuickfixTestUtil.getNode(BeansSchemaConstants.ELEM_BEAN, beanName, children);
    AttrImpl attr = (AttrImpl) beanNode.getAttributes().getNamedItem(BeansSchemaConstants.ATTR_REF);
    if (attr == null) {
      attr = (AttrImpl) beanNode.getAttributes().getNamedItem(BeansSchemaConstants.ATTR_PARENT);
    }

    IBeansConfig config = BeansCorePlugin.getModel().getConfig(file);
View Full Code Here

    NodeList beanChildren = beanNode.getChildNodes();
    IDOMNode constructorArgNode = QuickfixTestUtil.getFirstNode(BeansSchemaConstants.ELEM_CONSTRUCTOR_ARG,
        beanChildren);

    AttrImpl attr = (AttrImpl) constructorArgNode.getAttributes().getNamedItem(BeansSchemaConstants.ATTR_REF);

    IBeansConfig config = BeansCorePlugin.getModel().getConfig(file);
    Set<IResourceModelElement> contextElements = getContextElements(config);
    for (IResourceModelElement contextElement : contextElements) {
      if (beanRefAttrValidator.validateAttributeWithConfig(config, contextElement, attr, constructorArgNode,
View Full Code Here

    NodeList beanChildren = beanNode.getChildNodes();
    IDOMNode propertyNode = QuickfixTestUtil
        .getNode(BeansSchemaConstants.ELEM_PROPERTY, propertyName, beanChildren);

    AttrImpl attr = (AttrImpl) propertyNode.getAttributes().getNamedItem(BeansSchemaConstants.ATTR_REF);

    IBeansConfig config = BeansCorePlugin.getModel().getConfig(file);
    Set<IResourceModelElement> contextElements = getContextElements(config);
    for (IResourceModelElement contextElement : contextElements) {
      if (beanRefAttrValidator.validateAttributeWithConfig(config, contextElement, attr, propertyNode, reporter,
View Full Code Here

  private boolean hasError(String beanName) {
    NodeList children = beansNode.getChildNodes();
    IDOMNode beanNode = QuickfixTestUtil.getNode(BeansSchemaConstants.ELEM_BEAN, beanName, children);
    NodeList beanChildren = beanNode.getChildNodes();
    IDOMNode propertyNode = QuickfixTestUtil.getFirstNode(BeansSchemaConstants.ELEM_PROPERTY, beanChildren);
    AttrImpl attr = (AttrImpl) propertyNode.getAttributes().getNamedItem(BeansSchemaConstants.ATTR_NAME);

    IBeansConfig config = BeansCorePlugin.getModel().getConfig(file);
    Set<IResourceModelElement> contextElements = getContextElements(config);
    for (IResourceModelElement contextElement : contextElements) {
      if (propertyAttrValidator.validateAttributeWithConfig(config, contextElement, attr, propertyNode, reporter,
View Full Code Here

  }

  public void testCreateNewBean() {
    IDOMNode beanNode = QuickfixTestUtil.getNode(BeansSchemaConstants.ELEM_BEAN, "createBeanTest2", beansNode
        .getChildNodes());
    AttrImpl factoryBeanAttr = (AttrImpl) beanNode.getAttributes().getNamedItem(
        BeansSchemaConstants.ATTR_FACTORY_BEAN);

    applyProposal(factoryBeanAttr, beanNode, "account");
    assertNotNull("Expects new bean account to be created", QuickfixTestUtil.getNode(
        BeansSchemaConstants.ELEM_BEAN, "account", beansNode.getChildNodes()));
View Full Code Here

  private InitDestroyMethodValidator initDestroyAttrValidator;

  private boolean hasMethodError(String beanName, String attrName, BeanValidator beanValidator) {
    NodeList children = beansNode.getChildNodes();
    IDOMNode beanNode = QuickfixTestUtil.getNode(BeansSchemaConstants.ELEM_BEAN, beanName, children);
    AttrImpl attr = (AttrImpl) beanNode.getAttributes().getNamedItem(attrName);

    IBeansConfig config = BeansCorePlugin.getModel().getConfig(file);
    Set<IResourceModelElement> contextElements = getContextElements(config);
    for (IResourceModelElement contextElement : contextElements) {
      if (beanValidator.validateAttributeWithConfig(config, contextElement, attr, beanNode, reporter, true,
View Full Code Here

  public void testCreateNewBeanInChild() {
    IDOMNode beanNode = QuickfixTestUtil.getNode(BeansSchemaConstants.ELEM_BEAN, "createBeanTest1", beansNode
        .getChildNodes());
    IDOMNode constructorArgNode = QuickfixTestUtil.getFirstNode(BeansSchemaConstants.ELEM_CONSTRUCTOR_ARG, beanNode
        .getChildNodes());
    AttrImpl refAttr = (AttrImpl) constructorArgNode.getAttributes().getNamedItem(BeansSchemaConstants.ATTR_REF);

    applyProposal(refAttr, beanNode, "accountManager");
    assertNotNull("Expects new bean account to be created", QuickfixTestUtil.getNode(
        BeansSchemaConstants.ELEM_BEAN, "accountManager", beansNode.getChildNodes()));
  }
View Full Code Here

TOP

Related Classes of org.eclipse.wst.xml.core.internal.document.AttrImpl

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.