Examples of YComponentFactory


Examples of de.hybris.yfaces.component.YComponentFactory

        return o1.getURL().toExternalForm().compareTo(o2.getURL().toExternalForm());
      }
    });

    // create componentinfo for each component resource and add to registry
    YComponentFactory cmpFac = new YComponentFactory();
    for (YComponentInfo cmpInfo : cmpInfoList) {
      cmpInfo = cmpFac.createComponentInfo(cmpInfo.getURL(), cmpInfo.getNamespace());
      boolean added = YComponentRegistry.getInstance().addComponent(cmpInfo);

      if (added) {
        YFacesTaglib tagLib = getTagLib(cmpInfo);
        tagLib.addUserTag(cmpInfo.getComponentName(), cmpInfo.getURL());
View Full Code Here

Examples of de.hybris.yfaces.component.YComponentFactory

        "<yf:component  id  =  \"id1\"  impl  =  \"" + impl + "\"  spec=\"" + spec + "\"  var  =\""
            + var + "\" >",
        "<yf:component  id  = \" id1\"  impl=  \"    " + impl + "\"  spec=\"" + spec + "\" var=\""
            + var + "  \" >", };

    YComponentFactory cmpFac = new YComponentFactory();
    for (String s : cmps1) {
      // System.out.println(count++ + ": " + s);
      YComponentInfo cmpInfo = cmpFac.createComponentInfo(s);
      assertEquals(spec, cmpInfo.getSpecificationClassName());
      assertEquals(impl, cmpInfo.getImplementationClassName());
      assertEquals(var, cmpInfo.getVarName());
      assertEquals(id, cmpInfo.getId());
      assertEquals(0, cmpInfo.getInjectableProperties().size());
    }

    // test 'injectable' properties (boths styles)
    String[] cmps2 = new String[] {
        "<yf:component impl=\"" + impl + "\" injectable=\"prop1,prop2,prop3,prop4\">",
        "<yf:component impl=\"" + impl + "\" injectable=\"  prop1 ,prop2  ,prop3,  prop4\">",
        "<yf:component impl=\""
            + impl
            + "\" prop1=\"#{prop1}\" prop2=\"#{prop2}\" prop3=\"#{prop3}\" prop4=\"#{prop4}\">",
        "<yf:component impl=\""
            + impl
            + "\" prop1=\"#{prop1}\" prop2=\"#{prop1}\" prop3=\"#{prop1}\" prop4=\"#{prop1}\">",
        "<yf:component impl=\"" + impl
            + "\" injectable=\"prop1,prop2\" prop3=\"#{prop1}\" prop4=\"#{prop1}\">",
        "<yf:component impl=\""
            + impl
            + "\" injectable=\"prop1,prop2,prop3\" prop3=\"#{prop1}\" prop4=\"#{prop1}\">",
        "<yf:component impl=\"" + impl
            + "\" injectable=\"prop1,prop2,prop3\" prop4 =  \" #{prop4}  \">", };
    for (String s : cmps2) {
      // System.out.println(count++ + ": " + s);
      YComponentInfo cmpInfo = cmpFac.createComponentInfo(s);
      Collection<String> props = cmpInfo.getInjectableProperties();
      assertEquals(4, props.size());
      assertTrue("Got properties " + props.toString(), props.containsAll(properties));
    }
  }
View Full Code Here

Examples of de.hybris.yfaces.component.YComponentFactory

    String spec = TEST_COMPONENT;
    String impl = TEST_COMPONENT_IMPL;
    String var = "adBannerCmpVar";
    YComponentInfo cmpInfo = null;
    YComponentFactory cmpFac = new YComponentFactory();

    // test various errors
    int count = -1;
    while (++count >= 0) {
      String cmp = null;
      Collection<ERROR_STATE> expected = null;
      switch (count) {
      case 0:
        cmp = "<yf:component impl=\"" + impl + "\"  spec=\"" + spec + "\" var=\"" + var
            + "\">";
        expected = Arrays.asList(ERROR_STATE.VIEW_ID_NOT_SPECIFIED);
        break;
      case 1:
        cmp = "<yf:component impl=\"" + impl + "\" >";
        expected = Arrays.asList(ERROR_STATE.VIEW_ID_NOT_SPECIFIED,
            ERROR_STATE.VIEW_VAR_NOT_SPECIFIED, ERROR_STATE.SPEC_IS_MISSING);
        break;
      case 2:
        cmp = "<yf:component id=\"id\" impl=\"java.util.List\" var=\"var\">";
        expected = Arrays.asList(ERROR_STATE.SPEC_IS_MISSING,
            ERROR_STATE.IMPL_IS_INTERFACE, ERROR_STATE.IMPL_IS_NO_YCMP);
        break;
      case 3:
        cmp = "<yf:component id=\"id\" impl=\"java.util.ArrayList\" var=\"var\">";
        expected = Arrays.asList(ERROR_STATE.SPEC_IS_MISSING, ERROR_STATE.IMPL_IS_NO_YCMP);
        break;
      case 4:
        cmp = "<yf:component id=\"id\" spec=\"java.util.List\" impl=\"java.util.ArrayList\" var=\"var\">";
        expected = Arrays.asList(ERROR_STATE.SPEC_IS_NO_YCMP, ERROR_STATE.IMPL_IS_NO_YCMP);
        break;
      case 5:
        cmp = "<yf:component id=\"id\" spec=\"java.util.ArrayList\" impl=\"java.util.ArrayList\" var=\"var\">";
        expected = Arrays.asList(ERROR_STATE.SPEC_IS_NO_INTERFACE,
            ERROR_STATE.SPEC_IS_NO_YCMP, ERROR_STATE.IMPL_IS_NO_YCMP);
        break;
      case 6:
        cmp = "<yf:component id=\"id\" spec=\"java.util.Listxxx\" impl=\"java.util.ArrayListxxx\" var=\"var\">";
        expected = Arrays.asList(ERROR_STATE.SPEC_NOT_LOADABLE,
            ERROR_STATE.IMPL_NOT_LOADABLE);
        break;

      default:
        count = -5;
      }

      if (count >= 0) {
        log.info("Asserting: " + cmp);
        log.info("Expecting: " + expected);
        cmpInfo = cmpFac.createComponentInfo(cmp);
        Set<ERROR_STATE> errors = cmpInfo.verifyComponent();
        assertEquals(new HashSet<ERROR_STATE>(expected), errors);
      }
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.