11package io .simplelocalize .cli .command ;
22
3- import com .jayway .jsonpath .DocumentContext ;
3+ import com .jayway .jsonpath .JsonPath ;
44import io .simplelocalize .cli .client .SimpleLocalizeClient ;
55import io .simplelocalize .cli .client .dto .proxy .AutoTranslationConfiguration ;
66import io .simplelocalize .cli .client .dto .proxy .Configuration ;
7- import io .simplelocalize .cli .io .JsonReader ;
87import org .slf4j .Logger ;
98import org .slf4j .LoggerFactory ;
109
1110import java .io .IOException ;
12- import java .util .LinkedList ;
1311import java .util .List ;
1412import java .util .Optional ;
1513
@@ -19,13 +17,11 @@ public class AutoTranslationCommand implements CliCommand
1917
2018 private final SimpleLocalizeClient client ;
2119 private final Configuration configuration ;
22- private final JsonReader jsonReader ;
2320
2421 public AutoTranslationCommand (SimpleLocalizeClient client , Configuration configuration )
2522 {
2623 this .configuration = configuration ;
2724 this .client = client ;
28- this .jsonReader = new JsonReader ();
2925 }
3026
3127 public void invoke () throws IOException , InterruptedException
@@ -66,9 +62,7 @@ public void invoke() throws IOException, InterruptedException
6662 public int getRunningJobsCount () throws IOException , InterruptedException
6763 {
6864 String responseData = client .getAutoTranslationJobs ();
69- DocumentContext json = jsonReader .read (responseData );
70- LinkedList <?> runningJobs = json .read ("$.data[*]" , LinkedList .class );
71- return runningJobs .size ();
65+ return JsonPath .read (responseData , "$.data.length()" );
7266 }
7367
7468}
0 commit comments