Changeset 7929 for mauRepo/newmoon
- Timestamp:
- 05/07/11 16:46:59 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
mauRepo/newmoon/src/test/java/ndg/services/newmoon/XMIEncoderTest.java
r7848 r7929 1 1 package ndg.services.newmoon; 2 2 3 import java.io.File; 4 import java.io.FilenameFilter; 3 5 import java.net.URL; 6 import java.util.ArrayList; 7 import java.util.Collections; 4 8 import java.util.HashMap; 9 import java.util.List; 5 10 import java.util.Map; 6 11 … … 9 14 10 15 import org.apache.commons.io.FilenameUtils; 16 import org.apache.commons.io.filefilter.AndFileFilter; 17 import org.apache.commons.io.filefilter.FileFilterUtils; 11 18 import org.junit.After; 12 19 import org.junit.Before; … … 29 36 public void encodeXMI() throws NewmoonException { 30 37 XMIEncoder encoder = new XMIEncoder(); 31 String registryPath = "sampleXML/csml_local_PackageRegister.xml"; 32 String sample = "sampleXML/CSML3.xml"; 38 String executionPath = "xmi-samples/zippedSample"; 39 String registryPath = "my-registry.xml"; 40 String sample = "dfc.xml"; 33 41 GML_VERSION gmlVersion = GML_VERSION.v3_2; 34 String RESOURCE_ID = " CSMLv3";42 String RESOURCE_ID = "TestASBase"; 35 43 String workingPath = XMIEncoder.class.getClassLoader().getResource(".").getPath(); 44 URL testDir = XMIEncoder.class.getClassLoader().getResource("rules/conformance-test/ISO19136-V3.2-AnxE_XMI-V1.1"); 45 URL endodeDir = XMIEncoder.class.getClassLoader().getResource("rules/schema-encoding/xmi11ea"); 46 47 Map<NM_PARAM, String> params = new HashMap<NewmoonManager.NM_PARAM, String>(); 48 params.put(NM_PARAM.REPORT_NAME, NewmoonManager.DEFAULT_REPORT_NAME); 49 params.put(NM_PARAM.WORKING_DIRECTORY, "/" + FilenameUtils.getPathNoEndSeparator(workingPath)); 50 params.put(NM_PARAM.EXECUTION_DIR, params.get(NM_PARAM.WORKING_DIRECTORY) + "/" + executionPath); 51 params.put(NM_PARAM.DEPENDENCY_REGISTER_PATH, registryPath); 52 params.put(NM_PARAM.GLM_VERSION, gmlVersion.getVersion()); 53 params.put(NM_PARAM.CONFORMANCE_TEST_DIR, testDir.getPath()); 54 params.put(NM_PARAM.ENCODE_DIR, endodeDir.getPath()); 55 params.put(NM_PARAM.RESOURCE_NAME, RESOURCE_ID); 56 params.put(NM_PARAM.XMI_DOC, sample); 57 params.put(NM_PARAM.XMLDB_USER, "admin"); 58 params.put(NM_PARAM.XMLDB_PASSWORD, "newmoon"); 59 params.put(NM_PARAM.ROOT_COLLECTION_URI, "xmldb:exist://localhost:8080/exist/xmlrpc/db"); 60 encoder.doEncode(params); 61 System.out.println(encoder.getOutputdirPath()); 62 } 63 64 /* 65 @Test 66 public void encodeSamples() throws NewmoonException { 67 XMIEncoder encoder = new XMIEncoder(); 68 String workingPath = XMIEncoder.class.getClassLoader().getResource(".").getPath(); 69 File xmiDoc = new File(workingPath + "/xmi-samples"); 70 FilenameFilter filter = new AndFileFilter(FileFilterUtils.fileFileFilter(), FileFilterUtils.suffixFileFilter("xml")); 71 72 //List<String> samples = Arrays.asList(xmiDoc.list(filter)); 73 List<String> samples = new ArrayList(); 74 samples.add("mymodelXMI.xml"); 75 //samples.add("toEncode.zip"); 76 Collections.sort(samples); 77 for (String sample : samples){ 78 try { 79 doTheTest("xmi-samples/" + sample, workingPath, encoder); 80 } catch (Exception e) { 81 if (!sample.contains("_") 82 && !sample.equals("TestAS19.xml") 83 && !sample.equals("TestAS25.xml")) 84 throw new NewmoonException(e); 85 } finally { 86 System.out.println(sample); 87 } 88 } 89 } 90 */ 91 92 93 private void doTheTest(String sample, String workingPath, XMIEncoder encoder) throws NewmoonException { 94 GML_VERSION gmlVersion = GML_VERSION.v3_2; 95 String RESOURCE_ID = FilenameUtils.getBaseName(sample); 96 String registryPath = ""; 36 97 URL testDir = XMIEncoder.class.getClassLoader().getResource("rules/conformance-test/ISO19136-V3.2-AnxE_XMI-V1.1"); 37 98 URL endodeDir = XMIEncoder.class.getClassLoader().getResource("rules/schema-encoding/xmi11ea"); … … 52 113 System.out.println(encoder.getOutputdirPath()); 53 114 } 115 54 116 } 117
Note: See TracChangeset
for help on using the changeset viewer.