Package org.apache.hadoop.yarn.webapp.hamlet

Examples of org.apache.hadoop.yarn.webapp.hamlet.Hamlet$BODY


    sourceDesc.getSources().add(source);
    fileDesc.setSourceDesc(sourceDesc);   
    meiHead.setFileDesc(fileDesc)
    mei.setMeiHead(meiHead);
    Music music = new Music();
    Body body = new Body();
    Mdiv mdiv = new Mdiv();
    Score score = new Score();
    ScoreDef scoreDef = createScoreDef(stavesCount);
    score.getGapsAndSbsAndCorrs().add(scoreDef);
    Section section = new Section();
    Measure measureFirst = new Measure();
    Staff staffFirst = new Staff();
    Layer layerFirst = new Layer();
    staffFirst.getSbsAndSymbolsAndOrigs().add(layerFirst);
    measureFirst.getAnnotsAndSlursAndTupletSpen().add(staffFirst);
    for (int stavesIter = 1; stavesIter < stavesCount; stavesIter++) {
      Staff staff = new Staff();
      Layer layer = new Layer();
      staff.getSbsAndSymbolsAndOrigs().add(layer);
      measureFirst.getAnnotsAndSlursAndTupletSpen().add(staff);
    }
    section.getUnclearsAndSbsAndApps().add(measureFirst);

    for (int measureIter = 1; measureIter < measureCount; measureIter++) {
      Measure measure = new Measure();
      for (int stavesIter = 0; stavesIter < stavesCount; stavesIter++) {
        Staff staff = new Staff();
        Layer layer = new Layer();
        staff.getSbsAndSymbolsAndOrigs().add(layer);
        measure.getAnnotsAndSlursAndTupletSpen().add(staff);
      }
      section.getUnclearsAndSbsAndApps().add(measure);
    }
    score.getGapsAndSbsAndCorrs().add(section);
    mdiv.setScore(score);
    body.getMdivs().add(mdiv);
    music.setBody(body);
    mei.setMusic(music);
    mei.setId(DEFAULT_MEI_TREE);
    return mei;
  }
View Full Code Here


import static org.apache.hadoop.yarn.webapp.hamlet.HamletSpec.*;

public class TestHamlet {

  @Test public void testHamlet() {
    Hamlet h = newHamlet().
        title("test").
        h1("heading 1").
        p("#id.class").
          b("hello").
          em("world!")._().
        div("#footer").
          _("Brought to you by").
          a("http://hostname/", "Somebody")._();

    PrintWriter out = h.getWriter();
    out.flush();
    assertEquals(0, h.nestLevel);
    verify(out).print("<title");
    verify(out).print("test");
    verify(out).print("</title>");
View Full Code Here

    verify(out).print("</div>");
    verify(out, never()).print("</p>");
  }

  @Test public void testTable() {
    Hamlet h = newHamlet().
        title("test table").
        link("style.css");

    TABLE t = h.table("#id");

    for (int i = 0; i < 3; ++i) {
      t.tr().td("1").td("2")._();
    }
    t._();

    PrintWriter out = h.getWriter();
    out.flush();
    assertEquals(0, h.nestLevel);
    verify(out).print("<table");
    verify(out).print("</table>");
    verify(out, never()).print("</td>");
View Full Code Here

    verify(out, never()).print("</td>");
    verify(out, never()).print("</tr>");
  }

  @Test public void testEnumAttrs() {
    Hamlet h = newHamlet().
        meta_http("Content-type", "text/html; charset=utf-8").
        title("test enum attrs").
        link().$rel("stylesheet").
          $media(EnumSet.of(Media.screen, Media.print)).
          $type("text/css").$href("style.css")._().
        link().$rel(EnumSet.of(LinkType.index, LinkType.start)).
          $href("index.html")._();

    h.div("#content")._("content")._();

    PrintWriter out = h.getWriter();
    out.flush();
    assertEquals(0, h.nestLevel);
    verify(out).print(" media=\"screen, print\"");
    verify(out).print(" rel=\"start index\"");
  }
View Full Code Here

    verify(out).print(" media=\"screen, print\"");
    verify(out).print(" rel=\"start index\"");
  }

  @Test public void testScriptStyle() {
    Hamlet h = newHamlet().
        script("a.js").script("b.js").
        style("h1 { font-size: 1.2em }");

    PrintWriter out = h.getWriter();
    out.flush();
    assertEquals(0, h.nestLevel);
    verify(out, times(2)).print(" type=\"text/javascript\"");
    verify(out).print(" type=\"text/css\"");
  }
View Full Code Here

    verify(out, times(2)).print(" type=\"text/javascript\"");
    verify(out).print(" type=\"text/css\"");
  }

  @Test public void testPreformatted() {
    Hamlet h = newHamlet().
        div().
          i("inline before pre").
          pre().
            _("pre text1\npre text2").
            i("inline in pre").
            _("pre text after inline")._().
          i("inline after pre")._();

    PrintWriter out = h.getWriter();
    out.flush();
    assertEquals(5, h.indents);
  }
View Full Code Here

  static class TestView2 implements SubView {
    @Override public void renderPartial() {}
  }

  @Test public void testSubViews() {
    Hamlet h = newHamlet().
        title("test sub-views").
        div("#view1")._(TestView1.class)._().
        div("#view2")._(TestView2.class)._();

    PrintWriter out = h.getWriter();
    out.flush();
    assertEquals(0, h.nestLevel);
    verify(out).print("["+ TestView1.class.getName() +"]");
    verify(out).print("["+ TestView2.class.getName() +"]");
  }
View Full Code Here

    verify(out).print("["+ TestView2.class.getName() +"]");
  }

  static Hamlet newHamlet() {
    PrintWriter out = spy(new PrintWriter(System.out));
    return new Hamlet(out, 0, false);
  }
View Full Code Here

    @SuppressWarnings("unchecked")
    protected Envelope buildSOAPMessage(SAMLMessageContext samlMsgCtx, SAMLObject samlMessage) {
        Envelope envelope = null;
        if (samlMsgCtx.getOutboundMessage() != null && samlMsgCtx.getOutboundMessage() instanceof Envelope) {
            envelope = (Envelope) samlMsgCtx.getOutboundMessage();
            Body body = envelope.getBody();
            if (body == null) {
                XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory();
                SOAPObjectBuilder<Body> bodyBuilder = (SOAPObjectBuilder<Body>) builderFactory
                        .getBuilder(Body.DEFAULT_ELEMENT_NAME);
                body = bodyBuilder.buildObject();
                envelope.setBody(body);
            } else if (!body.getUnknownXMLObjects().isEmpty()) {
                log.warn("Supplied SOAP Envelope Body was not empty. Existing contents will be removed.");
                body.getUnknownXMLObjects().clear();
            }
            body.getUnknownXMLObjects().add(samlMessage);
        } else {
            envelope = buildSOAPMessage(samlMessage);
            samlMsgCtx.setOutboundMessage(envelope);
        }
        return envelope;
View Full Code Here

        Envelope envelope = envBuilder.buildObject();

        log.debug("Adding SAML message to the SOAP message's body");
        SOAPObjectBuilder<Body> bodyBuilder = (SOAPObjectBuilder<Body>) builderFactory
                .getBuilder(Body.DEFAULT_ELEMENT_NAME);
        Body body = bodyBuilder.buildObject();
        body.getUnknownXMLObjects().add(samlMessage);
        envelope.setBody(body);

        return envelope;
    }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.yarn.webapp.hamlet.Hamlet$BODY

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.