Ejemplo n.º 1
0
  /**
   * Opens an existing data network from a string and saves as a stream.
   *
   * @throws UdmException
   * @throws IOException
   */
  public void testOpenExistingFromStringSaveToStream() throws UdmException, IOException {
    String xml = new String("");

    RandomAccessFile raf = new RandomAccessFile(BM_FILE_IN, "r");
    String line = null;

    while ((line = raf.readLine()) != null) {
      xml += (line + "\n");
    }

    raf.close();

    ContainerStringFactory gtf = FactoryRepository.getTimeSeriesContainerStringFactory();
    UdmPseudoObject rootUPO = gtf.open(xml);
    Container con = null;

    if (rootUPO instanceof Container) {
      con = (Container) rootUPO;
    } else {
      fail("Unexpected root type: " + rootUPO.getType());
    }

    InputStream a = gtf.saveAsStream();
    System.out.println("\ntestOpenExistingFromStringSaveToStream():\n" + a);
    printInputStream(a);
  }
Ejemplo n.º 2
0
  /**
   * Creates a new data network in a stream.
   *
   * @throws UdmException
   */
  public void testCreateToStreamBlankInstance() throws UdmException {
    ContainerStringFactory gtf = FactoryRepository.getTimeSeriesContainerStringFactory();
    Container con = gtf.create();

    fillContainer(con);

    InputStream a = gtf.saveAsStream();
    System.out.println("\ntestCreateToStreamBlankInstance():\n" + a);
  }