Examples of YComponentInfo


Examples of de.hybris.yfaces.YComponentInfo

      {
        final URL url = _file.toURL();
        final Matcher m = pattern.matcher(url.toExternalForm());
        if (m.matches())
        {
          final YComponentInfo cmp = new YComponentInfo(url);
          this.componentMap.put(cmp.getSpecificationClassName(), new YCmpXsdElement(cmp));
        }
      }
    }
    catch (Exception e)
    {
View Full Code Here

Examples of de.hybris.yfaces.component.YComponentInfo

    // FIXME: isRendered is never evaluated here; super call can be removed
    super.encodeBegin(context);

    // retrieve some meta information
    YComponentInfo cmpInfo = this.getYComponentInfo();

    YComponent cmp = this.getOrCreateYComponent(cmpInfo);

    // generate some html debug output when enabled
    if (YFacesConfig.ENABLE_HTML_DEBUG.getBoolean()) {
View Full Code Here

Examples of de.hybris.yfaces.component.YComponentInfo

   *
   * @return {@link YComponentInfo}
   */
  private YComponentInfo getYComponentInfo() {
    // validation
    YComponentInfo cmpInfo = new YComponentInfo(getId(), getVarName(), this.getSpec(), this
        .getImpl());
    Set<ERROR_STATE> errors = new HashSet<ERROR_STATE>(cmpInfo.verifyComponent());
    errors.remove(ERROR_STATE.VIEW_ID_NOT_SPECIFIED);
    errors.remove(ERROR_STATE.SPEC_IS_MISSING);

    String errorString = ERROR_STATE.getFormattedErrorMessage(errors, cmpInfo, null);
    if (errorString != null) {
View Full Code Here

Examples of de.hybris.yfaces.component.YComponentInfo

   * @param prefix
   *            general prefix
   */
  private void generateHtmlDebug(YComponent cmp, String prefix) {
    if (this.debugHtmlOut == null) {
      YComponentInfo yInfo = YComponentRegistry.getInstance().getComponent(cmp.getId());
      debugHtmlOut = "???";
      if (yInfo != null) {
        String _file = yInfo.getURL().toExternalForm();
        String _frame = cmp.getFrame() != null ? cmp.getFrame().getId() : "unbound";
        debugHtmlOut = "Component: " + _file + " (Frame:" + _frame + ")";
      }
    }
    try {
View Full Code Here

Examples of de.hybris.yfaces.component.YComponentInfo

            if (ns.endsWith("/")) {
              ns = ns.substring(0, ns.length() - 1);
            }
            ns = NAMESPACE_BASE + ns;
            YComponentInfo cmpInfo = new YComponentInfo(ns, url);
            this.componentSet.add(cmpInfo);
          } catch (MalformedURLException e) {
            log.error(e);
          }
        }
View Full Code Here

Examples of de.hybris.yfaces.component.YComponentInfo

            + 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.YComponentInfo

    log.info("---------------------------------");

    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.