@@ -65,7 +65,7 @@ public class CallManagerTest {
6565
6666 private final static Map <String , Format > NODE_FORMATS = new HashMap <>();
6767
68- private DatabaseClient db = Common .connectDataService ();
68+ private DatabaseClient db = Common .connect ();
6969 private CallManager callMgr = CallManager .on (db );
7070
7171 private JacksonHandle serviceHandle ;
@@ -86,7 +86,7 @@ public static void setup() {
8686 NODE_FORMATS .put ("textDocument" , Format .TEXT );
8787 NODE_FORMATS .put ("xmlDocument" , Format .XML );
8888
89- DatabaseClient adminClient = Common .newServerAdminClient ("DBFUnitTestModules " );
89+ DatabaseClient adminClient = Common .newServerAdminClient ("java-unittest-modules " );
9090 JSONDocumentManager docMgr = adminClient .newJSONDocumentManager ();
9191
9292 DocumentMetadataHandle docMeta = new DocumentMetadataHandle ();
@@ -131,13 +131,11 @@ public static void setup() {
131131 setupNoParamReturnEndpoint (docMgr , docMeta , "noParamReturn" , "double" , "5.6" );
132132 setupNoParamNoReturnEndpoint (docMgr , docMeta , "noParamNoReturn" );
133133
134- // TODO: negative tests
135-
136134 adminClient .release ();
137135 }
138136 @ AfterClass
139137 public static void teardown () {
140- DatabaseClient adminClient = Common .newServerAdminClient ("DBFUnitTestModules " );
138+ DatabaseClient adminClient = Common .newServerAdminClient ("java-unittest-modules " );
141139
142140 QueryManager queryMgr = adminClient .newQueryManager ();
143141 DeleteQueryDefinition deletedef = queryMgr .newDeleteDefinition ();
@@ -792,13 +790,19 @@ public void testBinaryDocument() {
792790
793791 testNode (functionName , callableEndpoint , values );
794792
795- // TODO: File
796-
797793 BytesHandle [] values2 = convert (values , CallManagerTest ::BytesHandle , BytesHandle .class );
798- CallManager .ManyCaller <BinaryReadHandle > caller4 = makeManyCaller (callableEndpoint , BinaryReadHandle .class );
794+ CallManager .ManyCaller <BinaryReadHandle > caller2 = makeManyCaller (callableEndpoint , BinaryReadHandle .class );
795+ testConvertedCall (
796+ functionName , caller2 , caller2 .args ().param ("param1" , values2 ), values , CallManagerTest ::string
797+ );
798+
799+ /* TODO:
800+ File value3 = new File("src/test/resources/test.bin");
801+ CallManager.ManyCaller<File> caller3 = makeManyCaller(callableEndpoint, File.class);
799802 testConvertedCall(
800- functionName , caller4 , caller4 .args ().param ("param1" , values2 ), values , CallManagerTest ::string
803+ functionName, caller3, caller3 .args().param("param1", value3 ), new String[]{CallManagerTest.string(value3)} , CallManagerTest::string
801804 );
805+ */
802806 }
803807 @ Test
804808 public void testJsonDocument () {
@@ -810,8 +814,6 @@ public void testJsonDocument() {
810814
811815 testCharacterNode (functionName , callableEndpoint , values );
812816
813- // TODO: File
814-
815817 JsonNode [] values2 = convert (values , CallManagerTest ::jsonNode , JsonNode .class );
816818 CallManager .ManyCaller <JsonNode > caller2 = makeManyCaller (callableEndpoint , JsonNode .class );
817819 testConvertedCall (
@@ -829,6 +831,15 @@ public void testJsonDocument() {
829831 testConvertedCall (
830832 functionName , caller4 , caller4 .args ().param ("param1" , values4 ), values , CallManagerTest ::string
831833 );
834+
835+ /* TODO:
836+ File value5 = new File("src/test/resources/basic1.json");
837+ CallManager.ManyCaller<File> caller5 = makeManyCaller(callableEndpoint, File.class);
838+ testConvertedCall(
839+ functionName, caller3, caller3.args().param("param1", value5),
840+ new String[]{CallManagerTest.string(value5)}, CallManagerTest::string
841+ );
842+ */
832843 }
833844 @ Test
834845 public void testArray () {
@@ -941,13 +952,20 @@ public void testTextDocument() {
941952
942953 testCharacterNode (functionName , callableEndpoint , values );
943954
944- // TODO: File
945-
946955 StringHandle [] values2 = convert (values , StringHandle ::new , StringHandle .class );
947956 CallManager .ManyCaller <TextReadHandle > caller2 = makeManyCaller (callableEndpoint , TextReadHandle .class );
948957 testConvertedCall (
949958 functionName , caller2 , caller2 .args ().param ("param1" , values2 ), values , CallManagerTest ::string
950959 );
960+
961+ /* TODO:
962+ File value3 = new File("src/test/resources/hola.txt");
963+ CallManager.ManyCaller<File> caller3 = makeManyCaller(callableEndpoint, File.class);
964+ testConvertedCall(
965+ functionName, caller3, caller3.args().param("param1", value3),
966+ new String[]{CallManagerTest.string(value3)}, CallManagerTest::string
967+ );
968+ */
951969 }
952970 @ Test
953971 public void testMultipleNullNode () {
@@ -973,8 +991,6 @@ public void testXmlDocument() {
973991 functionName , caller2 , caller2 .args ().param ("param1" , values2 ), values , CallManagerTest ::xmlString
974992 );
975993
976- // TODO: File
977-
978994 InputStream [] values3 = convert (values , CallManagerTest ::inputStream , InputStream .class );
979995 CallManager .ManyCaller <InputStream > caller3 = makeManyCaller (callableEndpoint , InputStream .class );
980996 testConvertedCall (
@@ -1027,6 +1043,15 @@ public void testXmlDocument() {
10271043 testConvertedCall (
10281044 functionName , caller11 , caller11 .args ().param ("param1" , values11 ), values , CallManagerTest ::xmlString
10291045 );
1046+
1047+ /* TODO:
1048+ File value12 = new File("src/test/resources/test.xml");
1049+ CallManager.ManyCaller<File> caller12 = makeManyCaller(callableEndpoint, File.class);
1050+ testConvertedCall(
1051+ functionName, caller3, caller3.args().param("param1", value12),
1052+ new String[]{CallManagerTest.string(value12)}, CallManagerTest::string
1053+ );
1054+ */
10301055 }
10311056 @ Test
10321057 public void testNullNode () {
@@ -1166,6 +1191,13 @@ private static String string(byte[] value) {
11661191 private static String string (Document value ) {
11671192 return string (new DOMSource (value ));
11681193 }
1194+ private static String string (File value ) {
1195+ try {
1196+ return string (new FileInputStream (value ));
1197+ } catch (FileNotFoundException e ) {
1198+ throw new RuntimeException (e );
1199+ }
1200+ }
11691201 private static String string (InputStreamHandle value ) {
11701202 return string (value .get ());
11711203 }
0 commit comments