net.sf.mpxj.mspdi.MSPDIWriter Java Examples
The following examples show how to use
net.sf.mpxj.mspdi.MSPDIWriter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BasicTest.java From mpxj with GNU Lesser General Public License v2.1 | 6 votes |
/** * Exercise field alias code for MSPDI files. * * @throws Exception */ @Test public void testMSPDIAliases() throws Exception { MSPDIReader reader = new MSPDIReader(); MSPDIWriter writer = new MSPDIWriter(); File in = new File(MpxjTestData.filePath("legacy/alias.xml")); ProjectFile xml = reader.read(in); validateAliases(xml); File out = File.createTempFile("junit", ".xml"); writer.write(xml, out); xml = reader.read(out); validateAliases(xml); out.deleteOnExit(); }
Example #2
Source File: BasicTest.java From mpxj with GNU Lesser General Public License v2.1 | 6 votes |
/** * This test ensures that the task and resource extended attributes are * read and written correctly for MSPDI files. * * @throws Exception */ @Test public void testMspdiExtendedAttributes() throws Exception { MSPDIReader reader = new MSPDIReader(); MSPDIWriter writer = new MSPDIWriter(); ProjectFile xml = reader.read(MpxjTestData.filePath("legacy/mspextattr.xml")); commonMspdiExtendedAttributeTests(xml); File out = File.createTempFile("junit", ".xml"); writer.write(xml, out); xml = reader.read(out); commonMspdiExtendedAttributeTests(xml); out.deleteOnExit(); }
Example #3
Source File: BasicTest.java From mpxj with GNU Lesser General Public License v2.1 | 5 votes |
/** * This method performs a simple data driven test to read then write * the contents of a single MPX file. Assuming the MPX file contains * at least one example of each type of record, this test will be able * to exercise a large part of the MPX library. */ @Test public void testRewrite2() throws Exception { File in = new File(MpxjTestData.filePath("legacy/sample1.xml")); ProjectFile xml = new MSPDIReader().read(in); File out = File.createTempFile("junit", ".xml"); new MSPDIWriter().write(xml, out); boolean success = FileUtility.equals(in, out); assertTrue("Files are not identical", success); out.deleteOnExit(); }
Example #4
Source File: BasicTest.java From mpxj with GNU Lesser General Public License v2.1 | 5 votes |
/** * This method tests two stages of conversion, MPP->MPX->MSPDI. This * has been designed to exercise bug 896189, which was exhibited * when an MSPDI file was generated from an MPX file which did not * have the same set of attributes as a native MPP file. * * @throws Exception */ @Test public void testConversion4() throws Exception { File in = new File(MpxjTestData.filePath("legacy/sample.mpp")); ProjectFile mpp = new MPPReader().read(in); File out = File.createTempFile("junit", ".mpx"); new MPXWriter().write(mpp, out); ProjectFile mpx = new MPXReader().read(out); out.deleteOnExit(); out = File.createTempFile("junit", ".xml"); new MSPDIWriter().write(mpx, out); out.deleteOnExit(); }
Example #5
Source File: BasicTest.java From mpxj with GNU Lesser General Public License v2.1 | 5 votes |
/** * Test read and write of priority information. * * @throws Exception */ @Test public void testPriority() throws Exception { ProjectFile mpx = new MPXReader().read(MpxjTestData.filePath("legacy/mpxpriority.mpx")); validatePriority(mpx); ProjectFile mpp8 = new MPPReader().read(MpxjTestData.filePath("legacy/mpp8priority.mpp")); validatePriority(mpp8); ProjectFile mpp9 = new MPPReader().read(MpxjTestData.filePath("legacy/mpp9priority.mpp")); validatePriority(mpp9); ProjectFile xml = new MSPDIReader().read(MpxjTestData.filePath("legacy/mspdipriority.xml")); validatePriority(xml); File out = File.createTempFile("junit", ".mpx"); new MPXWriter().write(mpx, out); ProjectFile mpx2 = new MPXReader().read(out); validatePriority(mpx2); out.deleteOnExit(); out = File.createTempFile("junit", ".xml"); new MSPDIWriter().write(mpx, out); ProjectFile xml3 = new MSPDIReader().read(out); validatePriority(xml3); out.deleteOnExit(); }
Example #6
Source File: CustomerDataTest.java From mpxj with GNU Lesser General Public License v2.1 | 5 votes |
/** * Generate new files from the file under test and compare them to a baseline * we have previously created. This potentially allows us to capture unintended * changes in functionality. If we do not have a baseline for this particular * file, we'll generate one. * * @param name name of the project under test * @param project ProjectFile instance * @param baselineDirectory directory in which baseline files are held * @return true if the baseline test is successful */ private boolean testBaseline(String name, ProjectFile project, File baselineDirectory) throws Exception { if (baselineDirectory == null) { return true; } boolean mspdi = testBaseline(name, project, new File(baselineDirectory, "mspdi"), MSPDIWriter.class); boolean pmxml = testBaseline(name, project, new File(baselineDirectory, "pmxml"), PrimaveraPMFileWriter.class); boolean json = testBaseline(name, project, new File(baselineDirectory, "json"), JsonWriter.class); return mspdi && pmxml && json; }
Example #7
Source File: BasicTest.java From mpxj with GNU Lesser General Public License v2.1 | 4 votes |
/** * This ensures that values in the project properties are read and written * as expected. * * @throws Exception */ @Test public void testProjectProperties() throws Exception { MPXReader reader = new MPXReader(); MPXWriter writer = new MPXWriter(); // // Read the MPX file and ensure that the project properties // have the expected values. // ProjectFile mpx = reader.read(MpxjTestData.filePath("legacy/headertest.mpx")); testProperties(mpx); // // Write the file, re-read it and test to ensure that // the project properties have the expected values // File out = File.createTempFile("junit", ".mpx"); writer.write(mpx, out); mpx = reader.read(out); testProperties(mpx); out.deleteOnExit(); // // Read the MPP8 file and ensure that the project properties // have the expected values. // mpx = new MPPReader().read(MpxjTestData.filePath("legacy/headertest8.mpp")); testProperties(mpx); // // Read the MPP9 file and ensure that the project properties // have the expected values. // mpx = new MPPReader().read(MpxjTestData.filePath("legacy/headertest9.mpp")); testProperties(mpx); // // Read the MSPDI file and ensure that the project properties // have the expected values. // mpx = new MSPDIReader().read(MpxjTestData.filePath("legacy/headertest9.xml")); testMspdiProperties(mpx); // // Write the file, re-read it and test to ensure that // the project properties have the expected values // out = File.createTempFile("junit", ".xml"); new MSPDIWriter().write(mpx, out); mpx = new MSPDIReader().read(out); testMspdiProperties(mpx); out.deleteOnExit(); }
Example #8
Source File: ExportMSProject.java From projectforge-webapp with GNU General Public License v3.0 | 4 votes |
public static byte[] exportXml(final GanttChart ganttChart) { return export(new MSPDIWriter(), ganttChart); }