示例#1
0
  public void test_regression_145465() throws Exception {
    openDesign(REPORT);

    String outputLib = getTempFolder() + File.separator + INPUT_FOLDER + File.separator + LIB;

    DesignEngine engine = new DesignEngine(new DesignConfig());
    SessionHandle session = engine.newSessionHandle(ULocale.ENGLISH);
    session.setResourceFolder(getTempFolder() + File.separator + OUTPUT_FOLDER); // $NON-NLS-1$

    // session.setResourceFolder(this.getFullQualifiedClassName( ) //$NON-NLS-1$
    //		+ File.separator + OUTPUT_FOLDER );
    ReportDesignHandle designHandle =
        session.openDesign(getTempFolder() + "/" + INPUT_FOLDER + "/" + REPORT);
    LibraryHandle libHandle = designHandle.getLibrary("regression_145465_lib"); // $NON-NLS-1$
    LabelHandle label = (LabelHandle) libHandle.findElement("NewLabel"); // $NON-NLS-1$

    ElementFactory factory = designHandle.getElementFactory();
    LabelHandle extendsLabel =
        (LabelHandle) factory.newElementFrom(label, "extendsLabel"); // $NON-NLS-1$

    designHandle.getBody().add(extendsLabel);
    designHandle.save();

    // remove the library from resource folder.

    boolean deleted = new File(outputLib).delete();

    assertTrue(deleted);

    // refresh the report, make sure no exception is throwed out.

    designHandle.reloadLibraries();
  }
示例#2
0
  protected void tearDown() throws Exception {
    if (beforeSerializedDesignHandle != null) designHandle = beforeSerializedDesignHandle;

    if (designHandle != null) designHandle.close();

    if (libraryHandle != null) libraryHandle.close();

    if (os != null) os.close();

    super.tearDown();
  }