1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
package com.mysql.grt.modules;
import junit.framework.TestCase;
import junit.framework.Assert;
import junit.framework.Test;
import junit.framework.TestSuite;
import com.mysql.grt.*;
//import com.mysql.grt.db.oracle.*;
/**
* Test of MyxReverseEngineeringOracle class
*
* @author Mike
* @version 1.0, 11/29/04
*/
public class ReverseEngineeringOracleTest extends TestCase {
public ReverseEngineeringOracleTest(String name) {
super(name);
}
/**
* main function so the test can be executed
*/
public static void main(String[] args) {
junit.textui.TestRunner.run(ReverseEngineeringOracleTest.class);
}
/**
* The suite function builds the testsuite
*/
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(new ReverseEngineeringOracleTest("testGetModuleInfo"));
suite.addTest(new ReverseEngineeringOracleTest("testGetSchemata"));
suite.addTest(new ReverseEngineeringOracleTest("testReverseEngineer"));
return suite;
}
/**
* Test of the getModuleInfo function
*/
public void testGetModuleInfo() {
String xml = ReverseEngineeringOracle.getModuleInfo();
GrtHashMap moduleInfo = (GrtHashMap) Grt.getObjectsFromGrtXml(xml);
Assert.assertNotNull(moduleInfo);
//Check if functions are there
GrtStringList functionList = (GrtStringList) moduleInfo
.getObject("functions");
Assert.assertNotNull(functionList);
Assert.assertTrue(functionList
.contains("getSchemata:(Ljava/lang/String;):"));
Assert
.assertTrue(functionList
.contains("reverseEngineer:(Ljava/lang/String;Lcom/mysql/grt/GrtStringList;):"));
//Check if extens is set correctly
Assert.assertEquals(moduleInfo.getObject("extends"),
"ReverseEngineering");
}
public void testGetSchemata() {
/*GrtStringList schemataList = null;
try {
schemataList = ReverseEngineeringOracle.getSchemata(
"oracle.jdbc.OracleDriver",
"jdbc:oracle:thin:system/sys@mikesthinkpad:1521:mtt");
} catch (Exception e) {
e.printStackTrace();
}
Assert.assertNotNull(schemataList);*/
}
public void testReverseEngineer() {
/*Catalog catalog = null;
String xml = "<?xml version=\"1.0\"?>"
+ " <data>"
+ " <value type=\"list\" content-type=\"\">"
+ " <value type=\"string\">jdbc:oracle:thin:system/sys@mikesthinkpad:1521:mtt</value>"
+ " <value type=\"list\" content-type=\"string\">"
+ " <value type=\"string\">SCOTT</value>" + " </value>"
+ " </value>" + "</data>";
String res = Grt.callModuleFunction(ReverseEngineeringOracle.class,
"reverseEngineer",
"(Ljava/lang/String;Lcom/mysql/grt/GrtStringList;)", xml);
//System.out.println(res);
//try a regular call
GrtStringList schemata = new GrtStringList();
schemata.add("SCOTT");
try {
catalog = (Catalog) ReverseEngineeringOracle.reverseEngineer(
"oracle.jdbc.OracleDriver",
"jdbc:oracle:thin:system/sys@mikesthinkpad:1521:mtt",
schemata);
} catch (Exception e) {
e.printStackTrace();
}
Assert.assertNotNull(catalog);*/
}
}
|