Package org.kite9.framework.serialization

Examples of org.kite9.framework.serialization.XMLHelper$Field


    @Test
    public void record_error_for_field()
    {
        ValidationTracker tracker = mockValidationTracker();
        String message = "A recorded message.";
        Field field = mockField();

        tracker.recordError(field, message);

        replay();
View Full Code Here


  }
 
  void onValidateFromGenericField(String value) {
    if (value == null || !value.toLowerCase().startsWith("a")) {
      String fieldName = getFieldName(genericField.getControlName());
      Field fieldSnapshot = new FieldSnapshot(genericField);
      form.recordError(fieldSnapshot, fieldName + " must start with 'a'");
    }
  }
View Full Code Here

public class FieldTranslatorSourceImplTest extends InternalBaseTestCase
{
    @Test
    public void create_default_property_type_null()
    {
        Field field = mockField();
        Messages messages = mockMessages();
        Locale locale = Locale.ENGLISH;

        replay();
View Full Code Here

    }

    @Test
    public void create_default_translator_not_found_for_type()
    {
        Field field = mockField();
        Messages messages = mockMessages();
        Locale locale = Locale.ENGLISH;
        Class propertyType = Map.class;
        TranslatorSource ts = mockTranslatorSource();
        AnnotationProvider ap = mockAnnotationProvider(null);
View Full Code Here

    }

    @Test
    public void create_default_translator_with_name()
    {
        Field field = mockField();
        Messages messages = mockMessages();
        Locale locale = Locale.ENGLISH;
        Class propertyType = Map.class;
        TranslatorSource ts = mockTranslatorSource();
        FormSupport fs = mockFormSupport();
View Full Code Here

    }

    @Test
    public void create_default_translator_with_override_message()
    {
        Field field = mockField();
        Messages messages = mockMessages();
        Locale locale = Locale.ENGLISH;
        Class propertyType = Map.class;
        TranslatorSource ts = mockTranslatorSource();
        FormSupport fs = mockFormSupport();
View Full Code Here

    }

    @Test
    public void create_default_translator_with_per_form_override_message()
    {
        Field field = mockField();
        Messages messages = mockMessages();
        Locale locale = Locale.ENGLISH;
        Class propertyType = Map.class;
        TranslatorSource ts = mockTranslatorSource();
        FormSupport fs = mockFormSupport();
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

TOP

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

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.