Package org.jboss.forge.roaster.model.source

Examples of org.jboss.forge.roaster.model.source.EnumConstantSource$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


   public void testSetConstructorArguments()
   {
      int i = javaEnum.getMethods().size();
      javaEnum.addMethod().setConstructor(true).setParameters("int n, String s");
      assertEquals("int", javaEnum.getMethods().get(i).getParameters().get(0).getType().getName());
      EnumConstantSource foo = javaEnum.getEnumConstant("FOO");
      assertTrue(foo.getConstructorArguments().isEmpty());
      foo.setConstructorArguments("666", "null");
      assertEquals(2, foo.getConstructorArguments().size());
      assertEquals("666", foo.getConstructorArguments().get(0));
      assertEquals("null", foo.getConstructorArguments().get(1));
      foo.setConstructorArguments((String[]) null);
      assertTrue(foo.getConstructorArguments().isEmpty());
      foo.setConstructorArguments("0", "\"foo\"");
      assertEquals(2, foo.getConstructorArguments().size());
      assertEquals("0", foo.getConstructorArguments().get(0));
      assertEquals("\"foo\"", foo.getConstructorArguments().get(1));
      foo.setConstructorArguments();
      assertTrue(foo.getConstructorArguments().isEmpty());
   }
View Full Code Here

   }

   @Test
   public void testAddRemoveBody()
   {
      EnumConstantSource foo = javaEnum.getEnumConstant("FOO");
      final Pattern emptyBody = Pattern.compile("\\{\\s*\\}$");
      assertFalse(emptyBody.matcher(foo.toString()).find());
      foo.getBody();
      assertTrue(emptyBody.matcher(foo.toString()).find());
      foo.removeBody();
      assertFalse(emptyBody.matcher(foo.toString()).find());
   }
View Full Code Here

   }

   @Test
   public void testBodyAssertions()
   {
      EnumConstantSource foo = javaEnum.getEnumConstant("FOO");
      EnumConstantSource.Body body = foo.getBody();
      assertTrue(body.isClass());
      assertFalse(body.isInterface());
      assertFalse(body.isEnum());
      assertFalse(body.isAnnotation());
      assertEquals(javaEnum, body.getEnclosingType());
View Full Code Here

   }

   @Test
   public void testAddRemoveBodyImports()
   {
      EnumConstantSource foo = javaEnum.getEnumConstant("FOO");
      EnumConstantSource.Body body = foo.getBody();
      assertFalse(body.hasImport(Strings.class));
      assertFalse(javaEnum.hasImport(Strings.class));
      body.addImport(Strings.class);
      assertTrue(body.hasImport(Strings.class));
      assertTrue(javaEnum.hasImport(Strings.class));
View Full Code Here

   }

   @Test
   public void testAddRemoveBodyMethod()
   {
      EnumConstantSource foo = javaEnum.getEnumConstant("FOO");
      EnumConstantSource.Body body = foo.getBody();
      MethodSource<EnumConstantSource.Body> fooAction = body.addMethod().setName("fooAction").setReturnType(Void.TYPE);
      assertEquals(fooAction, body.getMethods().get(0));
      assertEquals(fooAction, body.getMembers().get(0));
      body.removeMethod(fooAction);
      assertTrue(body.getMethods().isEmpty());
View Full Code Here

   }

   @Test
   public void testAddRemoveBodyField()
   {
      EnumConstantSource foo = javaEnum.getEnumConstant("FOO");
      EnumConstantSource.Body body = foo.getBody();
      FieldSource<EnumConstantSource.Body> fooField = body.addField().setName("fooField").setType(String.class);
      assertEquals(fooField, body.getFields().get(0));
      assertEquals(fooField, body.getMembers().get(0));
      body.removeField(fooField);
      assertTrue(body.getFields().isEmpty());
View Full Code Here

   @Override
   public void resetTests()
   {
      InputStream stream = EnumConstantAnnotationTest.class
               .getResourceAsStream("/org/jboss/forge/grammar/java/MockAnnotatedEnumConstant.java");
      EnumConstantSource field = Roaster.parse(JavaEnumSource.class, stream).getEnumConstants().get(0);
      setTarget(field);
   }
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.jboss.forge.roaster.model.source.EnumConstantSource$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.