@@ -751,11 +751,15 @@ void repositoryWatcher_errorOnEntryNotFound_watchIsNotWorking() throws Exception
751
751
}
752
752
753
753
private static void revertTestFiles (ClientType clientType ) {
754
+ revertTestFiles (clientType .client (dogma ));
755
+ }
756
+
757
+ private static void revertTestFiles (CentralDogma client ) {
754
758
final Change <JsonNode > change1 = Change .ofJsonUpsert ("/test/test1.json" , "[ 1, 2, 3 ]" );
755
759
final Change <JsonNode > change2 = Change .ofJsonUpsert ("/test/test2.json" , "{ \" a\" : \" apple\" }" );
760
+ final Change <JsonNode > change3 = Change .ofJsonUpsert ("/test/test1.json5" , JSON5_CONTENTS );
756
761
757
- final List <Change <JsonNode >> changes = Arrays .asList (change1 , change2 );
758
- final CentralDogma client = clientType .client (dogma );
762
+ final List <Change <JsonNode >> changes = Arrays .asList (change1 , change2 , change3 );
759
763
760
764
if (!client .getPreviewDiffs (dogma .project (), dogma .repo1 (), Revision .HEAD , changes )
761
765
.join ().isEmpty ()) {
@@ -765,12 +769,12 @@ private static void revertTestFiles(ClientType clientType) {
765
769
.join ();
766
770
}
767
771
768
- final Change <Void > change3 = Change .ofRemoval ("/test_not_found/test.json" );
772
+ final Change <Void > change4 = Change .ofRemoval ("/test_not_found/test.json" );
769
773
final Map <String , EntryType > files = client .listFiles (dogma .project (), dogma .repo1 (), Revision .HEAD ,
770
774
PathPattern .of ("/test_not_found/**" )).join ();
771
- if (files .containsKey (change3 .path ())) {
775
+ if (files .containsKey (change4 .path ())) {
772
776
client .forRepo (dogma .project (), dogma .repo1 ())
773
- .commit ("Remove test files" , change3 )
777
+ .commit ("Remove test files" , change4 )
774
778
.push ()
775
779
.join ();
776
780
}
@@ -782,6 +786,7 @@ class WatchJson5Test {
782
786
@ Test
783
787
void watchJson5 () throws Exception {
784
788
final CentralDogma client = dogma .client ();
789
+ revertTestFiles (client );
785
790
786
791
final CompletableFuture <Entry <JsonNode >> future =
787
792
client .forRepo (dogma .project (), dogma .repo1 ())
@@ -814,6 +819,7 @@ void watchJson5() throws Exception {
814
819
@ Test
815
820
void watchJson5_notNotifiedIfJsonContentNotChanged () throws JsonParseException {
816
821
final CentralDogma client = dogma .client ();
822
+ revertTestFiles (client );
817
823
818
824
final CompletableFuture <Entry <JsonNode >> future =
819
825
client .forRepo (dogma .project (), dogma .repo1 ())
@@ -829,7 +835,7 @@ void watchJson5_notNotifiedIfJsonContentNotChanged() throws JsonParseException {
829
835
.join ();
830
836
831
837
// Watcher should not be notified since the JSON content is still the same.
832
- assertThatThrownBy (() -> future .get (1000 , TimeUnit .MILLISECONDS ))
838
+ assertThatThrownBy (() -> future .get (500 , TimeUnit .MILLISECONDS ))
833
839
.isInstanceOf (TimeoutException .class );
834
840
}
835
841
}
0 commit comments