Package KFM.GUI

Examples of KFM.GUI.HttpParams


    String aName1=  "anchor";
    assertTrue("Anchor missing, expected #" + aName1, httpparams.getAnchor().equals(aName1));
  }

  public void testSetAnchor() {
    HttpParams httpparams = new HttpParams("https://www.siemens.com/pfad/zum/servlet/SieMap");
    String aName1=  "anchor";
    httpparams.setAnchor(aName1);
    assertTrue("Setting Anchor failed, expected #" + aName1, httpparams.getAnchor().equals(aName1));
  }
View Full Code Here


  }



  public void testToUrlEncodedQueryString() {
    HttpParams httpparams = new HttpParams("https://www.siemens.com/pfad/zum/servlet/SieMap?a=B+e%72nd&a=%2520");
    String stringRet = httpparams.toUrlEncodedQueryString();
    boolean tAssertion = stringRet.equals("a=B%20ernd&a=%2520") || stringRet.equals("a=%2520&a=B%20ernd");
    assertTrue("Got wrong QueryString, expected 'a=Bernd&c=abc%20def&a=%2520', found: " + stringRet, tAssertion);
  }
View Full Code Here

         XmlWithSchemaMapper tMapper = new XmlWithSchemaMapper(tSchemaLocation, "KB.community");

         // Test 1: buildXmlWithSchema
         System.out.println("buildXmlWithSchema:\n-------------------");

         RequestUrl tParams = new HttpParams();
         tParams.addParam("KB.community.membershipPolicy", "restricted");
         tParams.addParam("KB.community.communication", "FaceToFace");
         tParams.addParam("KB.community.contact.name", "Hans");
         //tParams.addParam("KB.community.contact.email", "a@siemens.com");
         tParams.addParam("KB.community.contact.email", "a@siemens.com");
         tParams.addParam("KB.community.sponsor$1.name", "ICM");
         tParams.addParam("KB.community.sponsor$1.url", "http://www.icm.de");
         tParams.addParam("KB.community.sponsor$2.name", "CIO");
         tParams.addParam("KB.community.sponsor$2.url", "http://www.cio.com");
         tParams.addParam("KB.community.hasSubCoPs$1", "subCoP1");
         tParams.addParam("KB.community.hasSubCoPs$2", "subCoP2");
         tParams.addParam("KB.community.hasSubCoPs$3", "subCoP3");
         tParams.addParam("KB.community.since", "20x02-12-02");

         Document tGenDoc = tMapper.buildXmlWithSchema(tParams, true /*complete*/, false /*CDATA as text*/);
         System.out.println(DOM.serializeToString(tGenDoc, "ISO-8859-1"));

         KFMSystem.log.setLogLevel(KFMLog.DEBUG_LEVEL);
         XmlValidator tValidator = new XmlValidator(KFMSystem.log);
         tValidator.reparseDom(tGenDoc, "KB.community");


         // Test 2: serializeToHttpParams
         System.out.println("\n\nserializeToHttpParams:\n----------------------");

         String tXmlFile = "O:/KFM/www-docs/public/Portal/SieMap/DTD/KB_Community.xml";
         Document tXmlDoc = DOM.parseToDOM(new File(tXmlFile), true);
         HttpParams tParamsGen = (HttpParams)tMapper.serializeToHttpParams(
                 tXmlDoc,
                 "KnowledgeBean");

         Enumeration tParamNames = tParamsGen.getParameterNames();
         String tName = null;
         while (tParamNames.hasMoreElements()) {
             tName = (String)tParamNames.nextElement();
             System.out.println(tName + " = " + tParamsGen.getParam(tName));
         }
     }
View Full Code Here

     {
         // The currently worked parameter (called path because we use here the parameter's
         // dot-syntax that represents the path in the tree from the root down to the leaf.
         String tCurrentPath;

         RequestUrl tParams = new HttpParams();

         String tElementValue = null;
         String tNewPath = null;
         String tXPathExpression = null;
         for (int i = 0; i < mKeyOrder.size(); i++) {
             tCurrentPath = (String)mKeyOrder.get(i);

             // map mKeyPrefix to aDocPrefix in aCurrentPath
             // e.g. "KB.community.sponsor$2.url" -> "KnowledgeBean.sponsor$2.url"
             tNewPath = aDocPrefix + "." + tCurrentPath.substring(mKeyPrefix.length() + 1);
             tXPathExpression = constructXPathFromParam(tNewPath);
             tElementValue = DOM.applyXPath(aDocument, tXPathExpression);

             // Value exists corresponding to the possible Key.
             // (null means: element is missing, "" means: empty element)
             if (! (tElementValue == null || "".equals(tElementValue))) {
                 tParams.addParam(tCurrentPath, tElementValue);
                 // System.out.println("* " + tCurrentPath + " = " + tElementValue);
             }
         }

         return tParams;
View Full Code Here

TOP

Related Classes of KFM.GUI.HttpParams

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.