Package org.milyn.profile

Examples of org.milyn.profile.DefaultProfileSet


  public DefaultProfileSet profileSet;

  public MockUAContext(String commonName) {
    this.commonName = commonName;
    profileSet = new DefaultProfileSet(commonName);
  }
View Full Code Here


public class SmooksResourceConfigurationSortComparatorTest extends TestCase {

    private DefaultProfileSet profileSet;

    protected void setUp() throws Exception {
        profileSet = new DefaultProfileSet("uaCommonName");
        profileSet.addProfiles(new String[] {"profile1", "profile2", "profile3"});
  }
View Full Code Here

import junit.framework.TestCase;

public class UseragentExpressionTest extends TestCase {

    public void testUseragentExpression() {
        DefaultProfileSet profileSet1 = new DefaultProfileSet("device1");
        DefaultProfileSet profileSet2 = new DefaultProfileSet("device2");
    ProfileTargetingExpression expression;

    // Add a few profiles
    profileSet1.addProfile("profile1");
    profileSet1.addProfile("profile2");
    profileSet2.addProfile("profile2");
    profileSet2.addProfile("accept:application/xhtml+xml");
   
    // Match against exact device name
    expression = new ProfileTargetingExpression("device1");
    assertTrue(expression.isMatch(profileSet1));
    assertTrue(!expression.isMatch(profileSet2));
View Full Code Here

   */
  protected void setUp() throws Exception {
  }
 
  public void testGetEmptyAnyMixedEtcElements() {
        DefaultProfileSet profileSet = new DefaultProfileSet("device3");

        profileSet.addProfiles(new String[] {"prof1", "prof2", "prof3"});
    DTDStore.addDTD(profileSet, getClass().getResourceAsStream("xhtml1-transitional.dtd"));
    DTDStore.DTDObjectContainer dtdContainer = DTDStore.getDTDObject(profileSet);
   
    String[] elements = dtdContainer.getEmptyElements()
    assertTrue(Arrays.equals(new String[] {"basefont", "area", "link", "isindex", "col", "base", "meta", "img", "br", "hr", "param", "input"}, elements));
View Full Code Here

    elements = dtdContainer.getPCDataElements()
    assertTrue(Arrays.equals(new String[] {}, elements));
  }

  public void testChildElements() {
        DefaultProfileSet profileSet = new DefaultProfileSet("device3");

        profileSet.addProfiles(new String[] {"prof1", "prof2", "prof3"});
    DTDStore.addDTD(profileSet, getClass().getResourceAsStream("xhtml1-transitional.dtd"));
    DTDStore.DTDObjectContainer dtdContainer = DTDStore.getDTDObject(profileSet);
    List l1 = dtdContainer.getChildElements("html");
    List l2 = dtdContainer.getChildElements("html");
   
View Full Code Here

    assertEquals(40, dtdContainer.getChildElements("b").size());
    assertEquals(null, dtdContainer.getChildElements("xxxx"));
  }

  public void testElementAttributes() {
        DefaultProfileSet profileSet = new DefaultProfileSet("device3");

        profileSet.addProfiles(new String[] {"prof1", "prof2", "prof3"});
    DTDStore.addDTD(profileSet, getClass().getResourceAsStream("xhtml1-transitional.dtd"));
    DTDStore.DTDObjectContainer dtdContainer = DTDStore.getDTDObject(profileSet);
    List l1 = null;
    List l2 = null;
    try {
View Full Code Here

      // OK
    }
  }
 
  private void print(String name) {
        DefaultProfileSet profileSet = new DefaultProfileSet("device3");

        profileSet.addProfiles(new String[] {"prof1", "prof2", "prof3"});
    DTDStore.addDTD(profileSet, getClass().getResourceAsStream(name));
    DTDStore.DTDObjectContainer dtdContainer = DTDStore.getDTDObject(profileSet);
   
    log.debug("-------- " + name + " ---------");
    log.debug(Arrays.asList(dtdContainer.getEmptyElements()));
View Full Code Here

    public void testTransform() throws SAXException, IOException {
        Smooks smooks = new Smooks();

        // Configure Smooks
        SmooksUtil.registerProfileSet(new DefaultProfileSet("shipping-request"), smooks);
        SmooksUtil.registerProfileSet(new DefaultProfileSet("shipping-response"), smooks);
        smooks.addConfigurations("trans-request.cdrl", getClass().getResourceAsStream("trans-request.cdrl"));
        smooks.addConfigurations("trans-response.cdrl", getClass().getResourceAsStream("trans-response.cdrl"));
               
        InputStream requestStream = getClass().getResourceAsStream("../request.xml");
        ExecutionContext context = smooks.createExecutionContext("shipping-request");
View Full Code Here

        for (int i = 0; i < configNodes.getLength(); i++) {
            if(configNodes.item(i).getNodeType() == Node.ELEMENT_NODE) {
                Element profileNode = (Element) configNodes.item(i);
                String baseProfile = DomUtils.getAttributeValue(profileNode, "base-profile");
                String subProfiles = DomUtils.getAttributeValue(profileNode, "sub-profiles");
                DefaultProfileSet profileSet = new DefaultProfileSet(baseProfile);

                if (subProfiles != null) {
                    profileSet.addProfiles(subProfiles.split(","));
                }

                resourcelist.add(profileSet);
            }
        }
View Full Code Here

     */
    public static StandaloneApplicationContext createNewInstance(boolean registerInstalledResources) {
        StandaloneApplicationContext sac = new StandaloneApplicationContext();
        sac.resStore = new SmooksResourceConfigurationStore(sac, registerInstalledResources);
        // Add the open profile...
        sac.profileStore.addProfileSet(new DefaultProfileSet(Profile.DEFAULT_PROFILE));

        return sac;
    }
View Full Code Here

TOP

Related Classes of org.milyn.profile.DefaultProfileSet

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.