Author: veithen
Date: Sat Oct 27 20:12:32 2018
New Revision: 1844985

URL: http://svn.apache.org/viewvc?rev=1844985&view=rev
Log:
Simplify test case.

Added:
    axis/axis2/java/core/trunk/modules/jaxbri-codegen/src/test/java/org/apache/
    
axis/axis2/java/core/trunk/modules/jaxbri-codegen/src/test/java/org/apache/axis2/
    
axis/axis2/java/core/trunk/modules/jaxbri-codegen/src/test/java/org/apache/axis2/jaxbri/
    
axis/axis2/java/core/trunk/modules/jaxbri-codegen/src/test/java/org/apache/axis2/jaxbri/CodeGenerationUtilityTest.java
      - copied, changed from r1844984, 
axis/axis2/java/core/trunk/modules/jaxbri-codegen/src/test/java/org/temp/CodeGenerationUtilityTest.java
    axis/axis2/java/core/trunk/modules/jaxbri-codegen/src/test/resources/
    axis/axis2/java/core/trunk/modules/jaxbri-codegen/src/test/resources/org/
    
axis/axis2/java/core/trunk/modules/jaxbri-codegen/src/test/resources/org/apache/
    
axis/axis2/java/core/trunk/modules/jaxbri-codegen/src/test/resources/org/apache/axis2/
    
axis/axis2/java/core/trunk/modules/jaxbri-codegen/src/test/resources/org/apache/axis2/jaxbri/
    
axis/axis2/java/core/trunk/modules/jaxbri-codegen/src/test/resources/org/apache/axis2/jaxbri/sampleSchema1.xsd
      - copied unchanged from r1844984, 
axis/axis2/java/core/trunk/modules/jaxbri-codegen/src/test/schemas/custom_schemas/sampleSchema1.xsd
Removed:
    
axis/axis2/java/core/trunk/modules/jaxbri-codegen/src/test/java/org/temp/CodeGenerationUtilityTest.java
    
axis/axis2/java/core/trunk/modules/jaxbri-codegen/src/test/schemas/custom_schemas/sampleSchema1.xsd
Modified:
    
axis/axis2/java/core/trunk/modules/jaxbri-codegen/src/test/java/org/temp/XMLSchemaTest.java

Copied: 
axis/axis2/java/core/trunk/modules/jaxbri-codegen/src/test/java/org/apache/axis2/jaxbri/CodeGenerationUtilityTest.java
 (from r1844984, 
axis/axis2/java/core/trunk/modules/jaxbri-codegen/src/test/java/org/temp/CodeGenerationUtilityTest.java)
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxbri-codegen/src/test/java/org/apache/axis2/jaxbri/CodeGenerationUtilityTest.java?p2=axis/axis2/java/core/trunk/modules/jaxbri-codegen/src/test/java/org/apache/axis2/jaxbri/CodeGenerationUtilityTest.java&p1=axis/axis2/java/core/trunk/modules/jaxbri-codegen/src/test/java/org/temp/CodeGenerationUtilityTest.java&r1=1844984&r2=1844985&rev=1844985&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/jaxbri-codegen/src/test/java/org/temp/CodeGenerationUtilityTest.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/jaxbri-codegen/src/test/java/org/apache/axis2/jaxbri/CodeGenerationUtilityTest.java
 Sat Oct 27 20:12:32 2018
@@ -17,30 +17,37 @@
  * under the License.
  */
 
-package org.temp;
+package org.apache.axis2.jaxbri;
+
+import static org.junit.Assert.assertEquals;
 
 import java.io.File;
-import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
 import java.util.Map;
 
 import javax.xml.namespace.QName;
+import javax.xml.transform.stream.StreamSource;
 
 import org.apache.axis2.jaxbri.CodeGenerationUtility;
 import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
 import org.apache.axis2.wsdl.databinding.TypeMapper;
 import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
 import org.junit.Test;
 
-public class CodeGenerationUtilityTest extends XMLSchemaTest {
+public class CodeGenerationUtilityTest {
+    private static List<XmlSchema> loadSampleSchemaFile() throws Exception {
+        return Collections.singletonList(new XmlSchemaCollection().read(new 
StreamSource(
+                
CodeGenerationUtilityTest.class.getResource("sampleSchema1.xsd").toString())));
+    }
 
     @Test
     public void testProcessSchemas() throws Exception {
-        ArrayList<XmlSchema> list = new ArrayList<XmlSchema>();
-        loadSampleSchemaFile(list);
         CodeGenConfiguration codeGenConfiguration = new CodeGenConfiguration();
         codeGenConfiguration.setBaseURI("localhost/test");
         codeGenConfiguration.setOutputLocation(new File("target"));
-        TypeMapper mapper = CodeGenerationUtility.processSchemas(list, null, 
codeGenConfiguration);
+        TypeMapper mapper = 
CodeGenerationUtility.processSchemas(loadSampleSchemaFile(), null, 
codeGenConfiguration);
         Map map = mapper.getAllMappedNames();
         String s = map.get(new QName("http://www.w3schools.com";, 
"note")).toString();
         assertEquals("com.w3schools.Note", s);

Modified: 
axis/axis2/java/core/trunk/modules/jaxbri-codegen/src/test/java/org/temp/XMLSchemaTest.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxbri-codegen/src/test/java/org/temp/XMLSchemaTest.java?rev=1844985&r1=1844984&r2=1844985&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/jaxbri-codegen/src/test/java/org/temp/XMLSchemaTest.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/jaxbri-codegen/src/test/java/org/temp/XMLSchemaTest.java
 Sat Oct 27 20:12:32 2018
@@ -29,7 +29,6 @@ import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.InputStream;
-import java.util.ArrayList;
 
 public abstract class XMLSchemaTest extends TestCase {
 
@@ -63,24 +62,6 @@ public abstract class XMLSchemaTest exte
 
     }
 
-    public void loadSampleSchemaFile(ArrayList<XmlSchema> schemas) throws 
Exception{
-        File file = null;
-        int i = 1;
-       
-            file = new File(SampleSchemasDirectory + "sampleSchema" + i
-                    + ".xsd");
-            while (file.exists()) {
-                InputStream is = new FileInputStream(file);
-                XmlSchemaCollection schemaCol = new XmlSchemaCollection();
-                XmlSchema schema = schemaCol.read(new StreamSource(is));
-                schemas.add(schema);
-                i++;
-                file = new File(SampleSchemasDirectory + "sampleSchema" + i
-                        + ".xsd");
-            }
-       
-    }
-    
     public String readXMLfromSchemaFile(String path) throws Exception {
         InputStream is = new FileInputStream(path);
         XmlSchemaCollection schemaCol = new XmlSchemaCollection();


Reply via email to