openLibrary( "LibraryToReload.xml" );
String libFilePath = (String) filePaths.get( 1 );  openLibrary( libFilePath, false );
	public void testReloadLibrary( ) throws Exception	{		openDesign( "DesignToReloadLibrary.xml" ); //$NON-NLS-1$		// tests in name sapces,		NameSpace ns = designHandle.getModule( ).getNameSpace(				ReportDesign.ELEMENT_NAME_SPACE );		assertEquals( 7, ns.getCount( ) );		// tests element references.		TableHandle table1 = (TableHandle) designHandle.findElement( "table1" ); //$NON-NLS-1$		LabelHandle label1 = (LabelHandle) designHandle.findElement( "label1" ); //$NON-NLS-1$		assertEquals( ColorPropertyType.RED, table1				.getStringProperty( Style.COLOR_PROP ) );		assertEquals( ColorPropertyType.RED, label1				.getStringProperty( Style.COLOR_PROP ) );		assertEquals( ColorPropertyType.RED, label1				.getStringProperty( Style.COLOR_PROP ) );		// verify resolved element references.		TableHandle parent = (TableHandle) table1.getExtends( );		assertNotNull( parent );		RowHandle rowHandle = (RowHandle) table1.getHeader( ).get( 0 );		CellHandle cellHandle = (CellHandle) rowHandle.getCells( ).get( 0 );		assertEquals( cellHandle.getStringProperty( StyleHandle.COLOR_PROP ),				ColorPropertyType.BLUE );		TableHandle table2 = (TableHandle) designHandle.findElement( "table2" );//$NON-NLS-1$		assertNotNull( table2.getExtends( ) );		assertEquals( table2.getStringProperty( StyleHandle.COLOR_PROP ),				ColorPropertyType.LIME );		// make modification on its library.		openLibrary( "LibraryToReload.xml" );//$NON-NLS-1$		TableHandle libTable1 = (TableHandle) libraryHandle				.findElement( "libTable1" ); //$NON-NLS-1$		// drop the style1 in the theme		( (ThemeHandle) libraryHandle.getThemes( ).get( 0 ) ).getStyles( )				.drop( 0 );		// drop 1st and 2nd rows in table detail.		libTable1.getDetail( ).drop( 0 );		libTable1.getDetail( ).drop( 0 );		assertEquals( 0, libTable1.getDetail( ).getCount( ) );		// parent element is removed		TableHandle libTable2 = (TableHandle) libraryHandle				.findElement( "libTable2" ); //$NON-NLS-1$		libTable2.drop( );				libraryHandle.save( );		// setup the listener		MyLibraryListener libraryListener = new MyLibraryListener( );		designHandle.addListener( libraryListener );		designHandle.reloadLibrary( libraryHandle );		assertEquals( 1, libraryListener.events.size( ) );		assertTrue( libraryListener.events.get( 0 ) instanceof LibraryReloadedEvent );		// test the count in namespace		assertEquals( 3, ns.getCount( ) );		// test element references. Theme was dropped so that cannot get color.		assertEquals( ColorPropertyType.BLACK, table1				.getStringProperty( Style.COLOR_PROP ) );		assertEquals( ColorPropertyType.BLACK, label1				.getStringProperty( Style.COLOR_PROP ) );		assertNull( label1.getStyle( ) );		assertEquals( "style1", label1 //$NON-NLS-1$				.getStringProperty( StyledElement.STYLE_PROP ) );		// test the structure change.		assertEquals( 0, table1.getDetail( ).getCount( ) );		assertEquals( 1, table1.getHeader( ).getCount( ) );		// test undo/redo, activity stack is flused after reloadLibrary.		assertFalse( designHandle.getCommandStack( ).canRedo( ) );		assertFalse( designHandle.getCommandStack( ).canUndo( ) );		// recover the original library file.		recoverOriginalLibrary( "LibraryToReload_backup.xml", //$NON-NLS-1$				"LibraryToReload.xml" ); //$NON-NLS-1$		save( ); 		compareTextFile( "DesignToReloadLibrary_golden.xml" ); //$NON-NLS-1$	}