@@ -23,10 +23,15 @@ public class TestBytesHandle extends BasicJavaClientREST{
2323private static String dbName = "BytesHandleDB" ;
2424private static String [] fNames = {"BytesHandleDB-1" };
2525private static String restServerName = "REST-Java-Client-API-Server" ;
26+ //Additional port to test for Uber port
27+ private static int uberPort = 8000 ;
28+
2629@ BeforeClass
2730public static void setUp () throws Exception {
2831 System .out .println ("In setup" );
2932 setupJavaRESTServer (dbName , fNames [0 ], restServerName ,8011 );
33+ createUserRolesWithPrevilages ("test-eval" ,"xdbc:eval" , "xdbc:eval-in" ,"xdmp:eval-in" ,"any-uri" ,"xdbc:invoke" );
34+ createRESTUser ("eval-user" , "x" , "test-eval" ,"rest-admin" ,"rest-writer" ,"rest-reader" );
3035 }
3136
3237@ Test
@@ -39,10 +44,10 @@ public void testXmlCRUD() throws IOException , SAXException, ParserConfiguration
3944 XMLUnit .setNormalizeWhitespace (true );
4045
4146 // connect the client
42- DatabaseClient client = DatabaseClientFactory .newClient ("localhost" , 8011 , "rest-writer " , "x" ,Authentication .DIGEST );
47+ DatabaseClient client = DatabaseClientFactory .newClient ("localhost" , uberPort , dbName , "eval-user " , "x" ,Authentication .DIGEST );
4348
4449 // write docs
45- writeDocumentUsingBytesHandle (client , filename , uri , null ,"XML" );//***********
50+ writeDocumentUsingBytesHandle (client , filename , uri , null ,"XML" );
4651
4752 //read docs
4853 BytesHandle contentHandle = readDocumentUsingBytesHandle (client , uri + filename ,"XML" );
@@ -101,7 +106,7 @@ public void testTextCRUD() throws IOException, ParserConfigurationException, SAX
101106 System .out .println ("Runing test TextCRUD" );
102107
103108 // connect the client
104- DatabaseClient client = DatabaseClientFactory .newClient ("localhost" , 8011 , "rest-writer " , "x" , Authentication .DIGEST );
109+ DatabaseClient client = DatabaseClientFactory .newClient ("localhost" , uberPort , dbName , "eval-user " , "x" , Authentication .DIGEST );
105110
106111 // write docs
107112 writeDocumentUsingBytesHandle (client , filename , uri , "Text" );
@@ -161,7 +166,7 @@ public void testJsonCRUD() throws IOException, ParserConfigurationException, SAX
161166 ObjectMapper mapper = new ObjectMapper ();
162167
163168 // connect the client
164- DatabaseClient client = DatabaseClientFactory .newClient ("localhost" , 8011 , "rest-writer " , "x" , Authentication .DIGEST );
169+ DatabaseClient client = DatabaseClientFactory .newClient ("localhost" , uberPort , dbName , "eval-user " , "x" , Authentication .DIGEST );
165170
166171 // write docs
167172 writeDocumentUsingBytesHandle (client , filename , uri , "JSON" );
@@ -220,7 +225,7 @@ public void testBinaryCRUD() throws IOException, ParserConfigurationException, S
220225 System .out .println ("Running testBinaryCRUD" );
221226
222227 // connect the client
223- DatabaseClient client = DatabaseClientFactory .newClient ("localhost" , 8011 , "rest-writer " , "x" , Authentication .DIGEST );
228+ DatabaseClient client = DatabaseClientFactory .newClient ("localhost" , uberPort , dbName , "eval-user " , "x" , Authentication .DIGEST );
224229
225230 // write docs
226231 writeDocumentUsingBytesHandle (client , filename , uri , "Binary" );
@@ -250,8 +255,8 @@ public void testBinaryCRUD() throws IOException, ParserConfigurationException, S
250255
251256 // get the binary size
252257 long sizeUpdate = getBinarySizeFromByte (fileReadUpdate );
253- long expectedSizeUpdate = 3290 ;
254- // long expectedSizeUpdate = 3322;
258+ // long expectedSizeUpdate = 3290;
259+ long expectedSizeUpdate = 3322 ;
255260 assertEquals ("Binary size difference" , expectedSizeUpdate , sizeUpdate );
256261
257262 // delete the document
0 commit comments