Package org.codehaus.enunciate.examples.objc.schema.structures

Examples of org.codehaus.enunciate.examples.objc.schema.structures.House


    if (this.skipObjCTests) {
      System.out.println("C tests have been disabled.");
      return;
    }

    House house = new House();
    Rectangle base = new Rectangle();
    base.setColor(Color.BLUE);
    base.setHeight(80);
    base.setWidth(80);
    base.setLineStyle(LineStyle.solid);
    base.setId("baseid");
    house.setBase(base);
    Rectangle door = new Rectangle();
    door.setColor(Color.YELLOW);
    door.setHeight(35);
    door.setWidth(20);
    door.setLineStyle(LineStyle.solid);
    door.setId("doorId");
    house.setDoor(door);
    Circle knob = new Circle();
    knob.setColor(Color.RED);
    knob.setId("knobId");
    knob.setLineStyle(LineStyle.dashed);
    knob.setRadius(2);
    house.setDoorKnob(knob);
    Label label1 = new Label();
    label1.setValue("bachelor-pad");
    Label label2 = new Label();
    label2.setValue("single-family-dwelling");
    house.setLabels(Arrays.asList(label1, label2));
    Triangle roof = new Triangle();
    roof.setBase(84);
    roof.setHeight(20);
    roof.setColor(Color.YELLOW);
    roof.setLineStyle(LineStyle.solid);
    house.setRoof(roof);
    Rectangle window = new Rectangle();
    window.setColor(Color.YELLOW);
    window.setHeight(10);
    window.setWidth(10);
    window.setLineStyle(LineStyle.solid);
    house.setWindows(Arrays.asList(window));
    Date date = new Date();
    house.setConstructedDate(new DateTime(date, DateTimeZone.UTC));
    house.setType(XmlQNameEnumUtil.toQName(HouseType.brick));
    house.setStyle(XmlQNameEnumUtil.toQName(HouseStyle.latin));
    house.setColor(XmlQNameEnumUtil.toURI(HouseColor.blue));
    house = processThroughXml(house);

    base = house.getBase();
    assertSame(Color.BLUE, base.getColor());
    assertSame(LineStyle.solid, base.getLineStyle());
    assertEquals(80, base.getHeight());
    assertEquals(80, base.getWidth());
    assertEquals("baseid", base.getId());
    door = house.getDoor();
    assertSame(Color.YELLOW, door.getColor());
    assertSame(LineStyle.solid, door.getLineStyle());
    assertEquals(35, door.getHeight());
    assertEquals(20, door.getWidth());
    assertEquals("doorId", door.getId());
    knob = house.getDoorKnob();
    assertSame(Color.RED, knob.getColor());
    assertSame(LineStyle.dashed, knob.getLineStyle());
    assertEquals(2, knob.getRadius());
    assertEquals("knobId", knob.getId());
    List<String> labels = Arrays.asList("bachelor-pad", "single-family-dwelling");
    house.getLabels().size();
    for (Object l : house.getLabels()) {
      Label label = (Label) l;
      assertTrue(labels.contains(label.getValue()));
    }
    roof = house.getRoof();
    assertSame(Color.YELLOW, roof.getColor());
    assertSame(LineStyle.solid, roof.getLineStyle());
    assertNull(roof.getId());
    assertEquals(84, roof.getBase());
    assertEquals(20, roof.getHeight());
    assertEquals(1, house.getWindows().size());
    window = house.getWindows().get(0);
    assertSame(Color.YELLOW, window.getColor());
    assertSame(LineStyle.solid, window.getLineStyle());
    assertEquals(10, window.getHeight());
    assertEquals(10, window.getWidth());
    assertNull(window.getId());
    assertNotNull(house.getConstructedDate());
    assertEquals(date.getTime() - (date.getTime() % 1000), house.getConstructedDate().getMillis());
    assertEquals(XmlQNameEnumUtil.toQName(HouseType.brick), house.getType());
    assertEquals(XmlQNameEnumUtil.toQName(HouseStyle.latin), house.getStyle());
    assertEquals(XmlQNameEnumUtil.toURI(HouseColor.blue), house.getColor());
  }
View Full Code Here


    Cat cat = new Cat();
    cat.setId("catId");
    Circle catFace = new Circle();
    catFace.setRadius(30);
    cat.setFace(catFace);
    House house = new House();
    house.setId("houseId");
    Rectangle houseBase = new Rectangle();
    houseBase.setWidth(76);
    house.setBase(houseBase);
    canvas.setFigures(Arrays.asList(bus, cat, house));
    Rectangle rectangle = new Rectangle();
    rectangle.setHeight(50);
    rectangle.setId("rectId");
    Circle circle = new Circle();
    circle.setRadius(10);
    circle.setId("circleId");
    Triangle triangle = new Triangle();
    triangle.setBase(80);
    triangle.setId("triId");
    canvas.setShapes(Arrays.asList(rectangle, circle, triangle));
//    byte[] swaRefBytes = "This is a bunch of random bytes that are to be used as an SWA ref attachment.".getBytes();
//    byte[] explicitBase64Bytes = "This is some more random bytes that are to be used as a base 64 encoded attachment.".getBytes();
//    byte[] attachment1Bytes = "This is some more random bytes that are to be used as the first MTOM attachment.".getBytes();
//    byte[] attachment2Bytes = "This is some more random bytes that are to be used as the second MTOM attachment.".getBytes();
//    byte[] attachment3Bytes = "This is some more random bytes that are to be used as the third MTOM attachment.".getBytes();
//    CanvasAttachment attachment1 = new CanvasAttachment();
//    attachment1.setValue(attachment1Bytes);
//    CanvasAttachment attachment2 = new CanvasAttachment();
//    attachment2.setValue(attachment2Bytes);
//    CanvasAttachment attachment3 = new CanvasAttachment();
//    attachment3.setValue(attachment3Bytes);
//    ByteArrayDataSource dataSource = new ByteArrayDataSource(swaRefBytes, "application/octet-stream");
//    dataSource.setName("somename");
//    canvas.setBackgroundImage(new DataHandler(dataSource));
//    canvas.setExplicitBase64Attachment(explicitBase64Bytes);
//    canvas.setOtherAttachments(Arrays.asList(attachment1, attachment2, attachment3));

    canvas = processThroughXml(canvas);

    Collection shapes = canvas.getShapes();
    assertEquals(3, shapes.size());
    for (Object Shape : shapes) {
      if (Shape instanceof Circle) {
        assertEquals("circleId", ((Circle) Shape).getId());
        assertEquals(10, ((Circle) Shape).getRadius());
      }
      else if (Shape instanceof Rectangle) {
        assertEquals("rectId", ((Rectangle) Shape).getId());
        assertEquals(50, ((Rectangle) Shape).getHeight());
      }
      else if (Shape instanceof Triangle) {
        assertEquals("triId", ((Triangle) Shape).getId());
        assertEquals(80, ((Triangle) Shape).getBase());
      }
      else {
        fail("Unknown shape: " + Shape);
      }
    }

    Collection figures = canvas.getFigures();
    assertEquals(3, figures.size());
    for (Object Figure : figures) {
      if (Figure instanceof Bus) {
        bus = (Bus) Figure;
        assertEquals("busId", bus.getId());
        Rectangle BusFrame = bus.getFrame();
        assertNotNull(BusFrame);
        assertEquals(100, busFrame.getWidth());
      }
      else if (Figure instanceof Cat) {
        cat = (Cat) Figure;
        assertEquals("catId", cat.getId());
        Circle CatFace = cat.getFace();
        assertNotNull(CatFace);
        assertEquals(30, CatFace.getRadius());
      }
      else if (Figure instanceof House) {
        house = (House) Figure;
        assertEquals("houseId", house.getId());
        Rectangle HouseBase = house.getBase();
        assertNotNull(HouseBase);
        assertEquals(76, HouseBase.getWidth());
      }
      else {
        fail("Unknown figure: " + Figure);
View Full Code Here

TOP

Related Classes of org.codehaus.enunciate.examples.objc.schema.structures.House

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.