Package org.kite9.framework.serialization

Examples of org.kite9.framework.serialization.XMLHelper


  @Test
  public void test_1_14_AnnotationReference() throws Exception {
    Set<AnnotationHandle> refs = pm.getAnnotationReferences(convertName(Refs.Referenced.class));
    Method m = Refs.class.getMethod("referencer");
    MethodHandle mh = new MethodHandle(m);
    Reference ref = m.getAnnotation(Reference.class);
    AnnotationHandle expected = new AnnotationHandle(ref, mh, "refs");
    Assert.assertTrue(refs.contains(expected));
  }
View Full Code Here


 
  private MemberHandle createHandle(String owner, String name, String desc) {
    if (name.equals("<init>")) {
      return new ConstructorHandle(owner, desc);     
    } else {
      return new MethodHandle(owner, name, desc);
    }
  }
View Full Code Here

    Assert.assertFalse(deps.contains(convertName(Map.class)));
  }

  @Test
  public void test_1_13_PackageDependency() throws IOException {
    PackageHandle sub1 = new PackageHandle(SubPackageDependency.class);
    PackageHandle sub2 = new PackageHandle(SubPackageDependency2.class);
    PackageHandle current = new PackageHandle(this.getClass());

    Assert.assertTrue(pm.getDependsOnPackages(sub1).contains(current));
    Assert.assertTrue(pm.getDependsOnPackages(sub2).contains(current));
    Assert.assertTrue(pm.getDependedOnPackages(current).contains(sub1));
    Assert.assertTrue(pm.getDependedOnPackages(current).contains(sub2))
View Full Code Here

  pmi.addClass(convertClassName(Test4Package.class))
  Package p = this.getClass().getPackage();
  pmi.addPackageClass(convertPackageName(p), convertClassName(Test3Field.class));
  pmi.addPackageClass(convertPackageName(p), convertClassName(Test4Package.class));
  Package pack2= PropositionFormat.class.getPackage();
  PackageHandle p1 = new PackageHandle(convertPackageName(p), convertClassName(Test4Package.class));
  PackageHandle p2 = new PackageHandle(convertPackageName(pack2), convertClassName(PropositionFormat.class));
  pmi.addPackageDependency(p1, p2);
    }
View Full Code Here

      getContext().getLogger().send("Found: "+resources.length+" matches");

    }

    ProjectModelImpl model = cfmb.getModel();
   
    getContext().getLogger().send(
        "Created project model from \"" + getContext().getClassPath() + "\" with " + fileCount + " files and "
            + model.getClassCount() + " classes");

    return model;

  }
View Full Code Here

  protected Kite9Context ctx = createContext();

  protected static Kite9Context createContext() {
    Aliaser a = new PropertyAliaser();
    Repository<File> r = new BasicFileRepository();
    Kite9ContextImpl out = new Kite9ContextImpl(a, r);
    out.setClassPath("target/classes" + File.pathSeparator + "target/test-classes");
//    out.setProjectId(35);
//    out.setSecretKey("PFB9T1V97AK96WFK");
    out.afterPropertiesSet();
View Full Code Here

  }

  public void serve(WorkItem item, OutputStream os) throws IOException {

    try {
      XMLHelper helper = new XMLHelper();
      String xml = helper.toXML(item);

      URL u = new URL(url);
      URLConnection conn = createConnection(u);

      OutputStream params = conn.getOutputStream();
View Full Code Here

public class AbstractBuilderTest extends HelpMethods {

  public void renderDiagram(Diagram d) throws IOException {
    Method m = StackHelp.getAnnotatedMethod(Test.class);

    XMLHelper helper = new XMLHelper();
    String xml = helper.toXML(d);
    DiagramTestingEngine.writeOutput(this.getClass(), m.getName(), "diagram.xml", xml);
   
    System.out.println(xml);

    try {
      // validate the xml against the schema
      InputSource is = new InputSource(new StringReader(xml));

      SchemaFactory factory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");

      // load a WXS schema, represented by a Schema instance
      Source schemaFile = new StreamSource(Diagram.class.getResourceAsStream("/adl_1.0.xsd"));
      Schema schema = factory.newSchema(schemaFile);

      Validator validator = schema.newValidator();

      SAXSource source = new SAXSource(is);
      validator.validate(source);
     
      helper.fromXML(xml);
    } catch (SAXParseException e) {
      e.printStackTrace();
      Assert.fail("Line: "+ e.getLineNumber()+" Failed validation: " + e.getMessage() + "\n" + xml);
    } catch (SAXException e) {
      e.printStackTrace();
View Full Code Here

      failed ++;
      throw new Kite9ProcessingException("Could not process server response: " + e);
    } finally {
      try {
        OutputStream fos = getRepository().store(i.getSubjectId(), i.getName(), "xml");
        XMLHelper xh = new XMLHelper();
        String xml = xh.toXML(i);
        OutputStreamWriter w = new OutputStreamWriter(fos);
        w.write(xml);
        w.close();
      } catch (IOException e) {
        throw new Kite9ProcessingException("Could not store request XML in local repository: " + e);
View Full Code Here

 
  protected ServerCallingBuildListener createServerCallingListener() {
    ServerCallingBuildListener scbl = new ServerCallingBuildListener();
    scbl.setContext(ctx);
    scbl.setServer(new AbstractLocalServer() {
      @Override
      protected void processItem(WorkItem workItem, ZipOutputStream zos) throws IOException {
        // just returns 'canned' responses from the test artifacts
        // directory
        File png = getFileFromWorkItem(workItem, "png");
View Full Code Here

TOP

Related Classes of org.kite9.framework.serialization.XMLHelper

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.