59
59
import java .nio .file .Files ;
60
60
import java .nio .file .Path ;
61
61
import java .nio .file .Paths ;
62
+ import java .util .Arrays ;
62
63
import java .util .Comparator ;
63
64
import java .util .HashSet ;
64
65
import java .util .Set ;
@@ -412,7 +413,13 @@ public void testGetMappingDocumentByIdWithInvalidMapping() throws UnsupportedEnc
412
413
public void testUpdateMapping () throws JsonProcessingException , Exception {
413
414
System .out .println ("updateMapping" );
414
415
testCreateMapping ();
415
- File mappingsDir = Paths .get (TEMP_DIR_4_MAPPING ).toFile ();
416
+
417
+ System .out .println ("mapp" );
418
+
419
+ String schemaDir = TEMP_DIR_4_MAPPING + "mappingSchemas/" ;
420
+ File mappingsDir = Paths .get (schemaDir ).toFile ();
421
+ System .out .println ("DIR " + mappingsDir );
422
+ System .out .println ("LIST " + Arrays .asList (mappingsDir .list ()));
416
423
String mappingId = MAPPING_ID ;
417
424
String mappingType = MAPPING_TYPE ;
418
425
String getMappingIdUrl = "/api/v1/mappingAdministration/" + mappingId ;
@@ -434,6 +441,8 @@ public void testUpdateMapping() throws JsonProcessingException, Exception {
434
441
result = this .mockMvc .perform (MockMvcRequestBuilders .multipart (putMappingIdUrl ).
435
442
file (recordFile ).
436
443
file (mappingFile ).header ("If-Match" , etag ).with (putMultipart ())).andDo (print ()).andExpect (status ().isOk ()).andReturn ();
444
+ System .out .println ("LIST AF " + Arrays .asList (mappingsDir .list ()));
445
+
437
446
assertEquals (2 , mappingsDir .list ().length );
438
447
ObjectMapper map = new ObjectMapper ();
439
448
MappingRecord resultRecord = map .readValue (result .getResponse ().getContentAsString (), MappingRecord .class );
@@ -774,7 +783,7 @@ public void testDeleteMappingUnknownMappingId() throws JsonProcessingException,
774
783
result = this .mockMvc .perform (delete (deleteMappingIdUrl ).header ("If-Match" , etag )).andDo (print ()).andExpect (status ().isNotFound ()).andReturn ();
775
784
assertEquals (1 , mappingsDir .list ().length );
776
785
String expectedFilename = mappingId + "_" + mappingType + ".mapping" ;
777
- assertEquals ("my_dc_GEMMA.mapping" , mappingsDir . list ()[ 0 ] );
786
+ assertEquals ("my_dc_GEMMA.mapping" , expectedFilename );
778
787
assertEquals (1 , mappingRecordDao .count ());
779
788
}
780
789
@@ -820,7 +829,7 @@ public void testDeleteMappingMissingEtag() throws JsonProcessingException, Excep
820
829
result = this .mockMvc .perform (delete (deleteMappingIdUrl )).andDo (print ()).andExpect (status ().isPreconditionRequired ()).andReturn ();
821
830
assertEquals (1 , mappingsDir .list ().length );
822
831
String expectedFilename = mappingId + "_" + mappingType + ".mapping" ;
823
- assertEquals ("my_dc_GEMMA.mapping" , mappingsDir . list ()[ 0 ] );
832
+ assertEquals ("my_dc_GEMMA.mapping" , expectedFilename );
824
833
result = this .mockMvc .perform (get (getMappingIdUrl ).header ("Accept" , MappingRecord .MAPPING_RECORD_MEDIA_TYPE )).andDo (print ()).andExpect (status ().isOk ()).andReturn ();
825
834
assertEquals (1 , mappingRecordDao .count ());
826
835
}
@@ -844,7 +853,7 @@ public void testDeleteMappingWrongEtag() throws JsonProcessingException, Excepti
844
853
result = this .mockMvc .perform (delete (deleteMappingIdUrl ).header ("If-Match" , etag )).andDo (print ()).andExpect (status ().isPreconditionFailed ()).andReturn ();
845
854
assertEquals (1 , mappingsDir .list ().length );
846
855
String expectedFilename = mappingId + "_" + mappingType + ".mapping" ;
847
- assertEquals ("my_dc_GEMMA.mapping" , mappingsDir . list ()[ 0 ] );
856
+ assertEquals ("my_dc_GEMMA.mapping" , expectedFilename );
848
857
result = this .mockMvc .perform (get (getMappingIdUrl ).header ("Accept" , MappingRecord .MAPPING_RECORD_MEDIA_TYPE )).andDo (print ()).andExpect (status ().isOk ()).andReturn ();
849
858
assertEquals (1 , mappingRecordDao .count ());
850
859
}
0 commit comments