Example #1
0
  /** @throws java.lang.Exception */
  @Before
  public void setUp() throws Exception {
    Vector<Parameter> v = new Vector<Parameter>();

    // missing one required attribute
    v.add(new Parameter(SMLConstants.PROTOCOL_NAME_ATTRIBUTE_NODE, "MyProtocol"));
    v.add(new Parameter(SMLConstants.PROTOCOL_TYPE_ATTRIBUTE_NODE, "MyProtocolType"));
    v.add(new Parameter("shoudNOT", "goTHROUGH"));
    p1 = new Parameters(v);

    v.removeAllElements();
    // missing two required attributes
    v.add(new Parameter(SMLConstants.PROTOCOL_NAME_ATTRIBUTE_NODE, "MyProtocol"));
    v.add(new Parameter("shoudNOT", "goTHROUGH"));
    p2 = new Parameters(v);

    v.removeAllElements();
    // should be ok
    v.add(new Parameter(SMLConstants.PROTOCOL_NAME_ATTRIBUTE_NODE, "MyProtocol"));
    v.add(new Parameter(SMLConstants.PROTOCOL_TYPE_ATTRIBUTE_NODE, "MyProtocolType"));
    v.add(new Parameter(SMLConstants.SENSOR_ADDRESS_ATTRIBUTE_NODE, "MySensorAddress"));
    p3 = new Parameters(v);

    try {
      d1 = XMLhelper.createDocument(sml1);
      d2 = XMLhelper.createDocument(sml2);
      d3 = XMLhelper.createDocument(sml3);
      d4 = XMLhelper.createDocument(sml4);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Example #2
0
 /**
  * Test method for {@link jcu.sal.common.sml.SMLDescription#SMLDescription(org.w3c.dom.Document)}.
  *
  * @throws ConfigurationException
  */
 @Test
 public void testSMLDescriptionDocument() throws SALDocumentException {
   try {
     new SMLDescription(d1);
     fail("shoudnt be here");
   } catch (SALDocumentException e) {
   }
   try {
     new SMLDescription(d2);
     fail("shoudnt be here");
   } catch (SALDocumentException e) {
   }
   try {
     new SMLDescription(d3);
     fail("shoudnt be here");
   } catch (SALDocumentException e) {
   }
   System.out.println("Checking d4:" + XMLhelper.toString(d4));
   new SMLDescription(d4);
 }