11package nl .vpro .api .client .utils ;
22
3+ import jakarta .ws .rs .client .Client ;
4+ import jakarta .ws .rs .core .*;
35import lombok .extern .slf4j .Slf4j ;
46
57import java .io .IOException ;
911import java .time .Instant ;
1012import java .util .*;
1113
12- import jakarta .ws .rs .client .Client ;
13- import jakarta .ws .rs .core .*;
14-
1514import org .apache .commons .io .IOUtils ;
1615import org .apache .commons .lang3 .time .StopWatch ;
1716import org .apache .http .HttpResponse ;
3029import nl .vpro .domain .api .Order ;
3130import nl .vpro .domain .api .media .*;
3231import nl .vpro .domain .api .profile .Profile ;
33- import nl .vpro .domain .media .MediaType ;
3432import nl .vpro .domain .media .*;
33+ import nl .vpro .domain .media .MediaType ;
3534import nl .vpro .util .CloseableIterator ;
3635import nl .vpro .util .CountedIterator ;
3736
@@ -50,7 +49,7 @@ public class NpoApiClientUtilTest {
5049
5150
5251 @ BeforeEach
53- public void setUp () {
52+ void setUp () {
5453
5554 util = new NpoApiMediaUtil (NpoApiClients .configured ().warnThreshold (Duration .ofMillis (1 )).build (), new NpoApiRateLimiter ());
5655
@@ -61,12 +60,12 @@ public void setUp() {
6160 log .info ("Testing {}" , util );
6261 }
6362 @ AfterEach
64- public void after () {
63+ void after () {
6564 log .info ("Test took {}" , Duration .between (start , Instant .now ()));
6665 }
6766
6867 @ Test
69- public void testLoadMultiple () throws Exception {
68+ void testLoadMultiple () throws Exception {
7069 MediaObject [] result = util .load ("AVRO_1656037" , "AVRO_1656037" , "POMS_VPRO_487567" );
7170 assertThat (result [0 ].getMid ()).isEqualTo ("AVRO_1656037" );
7271 assertThat (result [1 ].getMid ()).isEqualTo ("AVRO_1656037" );
@@ -81,7 +80,7 @@ public void testLoadMultiple() throws Exception {
8180
8281
8382 @ Test
84- public void testLoadMultipleWithTimeout () {
83+ void testLoadMultipleWithTimeout () {
8584 assertThatThrownBy (() -> {
8685 MediaObject [] result = utilShortTimeout .load ("AVRO_1656037" , "AVRO_1656037" , "POMS_VPRO_487567" );
8786 log .info ("{}" , Arrays .asList (result ));
@@ -90,21 +89,21 @@ public void testLoadMultipleWithTimeout() {
9089
9190
9291 @ Test
93- public void testLoad () throws Exception {
92+ void testLoad () throws Exception {
9493 MediaObject result = util .loadOrNull ("AVRO_1656037" );
9594 assertThat (result .getMid ()).isEqualTo ("AVRO_1656037" );
9695 }
9796
9897
9998 @ Test
100- public void testLoadNotFound () throws Exception {
99+ void testLoadNotFound () throws Exception {
101100 MediaObject result = util .loadOrNull ("bestaat niet" );
102101 assertThat (result ).isNull ();
103102 }
104103
105104
106105 @ Test
107- public void testLoadWithTimeout () {
106+ void testLoadWithTimeout () {
108107 assertThatThrownBy (() -> {
109108
110109 MediaObject result = utilShortTimeout .loadOrNull ("AVRO_1656037" );
@@ -118,7 +117,7 @@ public void testLoadWithTimeout() {
118117 @ SuppressWarnings ("deprecation" )
119118 @ Test
120119 @ Disabled ("Takes long!!" )
121- public void testChanges () throws Exception {
120+ void testChanges () throws Exception {
122121 try (CloseableIterator <MediaChange > result = util .changes ("woord" , 1433329965809L , Order .ASC , Integer .MAX_VALUE )) {
123122 long i = 0 ;
124123 while (result .hasNext ()) {
@@ -136,7 +135,7 @@ public void testChanges() throws Exception {
136135
137136 @ Test
138137 @ Disabled ("Takes long!!" )
139- public void testChangesEpoch () throws Exception {
138+ void testChangesEpoch () throws Exception {
140139 try (CountedIterator <MediaChange > result = util .changes ("woord" , Instant .EPOCH , Order .ASC , null )) {
141140 long i = 0 ;
142141 while (result .hasNext ()) {
@@ -153,7 +152,7 @@ public void testChangesEpoch() throws Exception {
153152
154153 @ Test
155154 @ Disabled ("Takes long!!" )
156- public void testChangesVpronl () throws Exception {
155+ void testChangesVpronl () throws Exception {
157156 try (CountedIterator <MediaChange > result = util .changes ("vpro-predictions" , Instant .now ().minus (Duration .ofHours (6 )), Order .ASC , null )) {
158157 long i = 0 ;
159158 while (result .hasNext ()) {
@@ -167,7 +166,7 @@ public void testChangesVpronl() throws Exception {
167166
168167 @ Test
169168 @ Disabled ("Takes long!" )
170- public void testIterate () throws Exception {
169+ void testIterate () throws Exception {
171170 Instant start = Instant .now ();
172171 try (CloseableIterator <MediaObject > result = util .iterate (new MediaForm (), null )) {
173172 long i = 0 ;
@@ -190,15 +189,15 @@ public void testIterate() throws Exception {
190189
191190
192191 @ Test
193- public void testListDescendants () {
192+ void testListDescendants () {
194193 MediaResult result = util .listDescendants ("RBX_S_NTR_553927" , Order .DESC , input -> input .getMediaType () == MediaType .BROADCAST , 123 );
195194 assertThat (result .getSize ()).isEqualTo (123 );
196195
197196
198197 }
199198
200199 @ Test
201- public void testListRelated () {
200+ void testListRelated () {
202201 MediaSearchResult result = util .getClients ().getMediaService ().findRelated (MediaFormBuilder .emptyForm (), "VPWON_1174495" , "vpro" , null , 10 , null );
203202 log .info ("{}" , result .asList ().get (0 ).getDescendantOf ().iterator ().next ().getMidRef ());
204203 }
@@ -209,7 +208,7 @@ public void testListRelated() {
209208 //@Test
210209 @ Disabled ("This doesn't test the api, but httpclient" )
211210 // this does indeed timeout
212- public void timeout () {
211+ void timeout () {
213212 assertThatThrownBy (() -> {
214213 HttpClient client ;
215214 {
@@ -245,7 +244,7 @@ public void timeout() {
245244 //@Test(expected = IOException.class)
246245 @ Test
247246 @ Disabled ("Doesn't test api, but httpclient" )
248- public void timeoutWithInvoke () throws URISyntaxException {
247+ void timeoutWithInvoke () throws URISyntaxException {
249248 ApacheHttpClient43Engine engine = (ApacheHttpClient43Engine ) utilShortTimeout .getClients ().getClientHttpEngine ();
250249 String host = utilShortTimeout .getClients ().getBaseUrl () + "/media/AVRO_1656037" ;
251250 URI uri = new URI (host );
@@ -271,13 +270,13 @@ public void timeoutWithInvoke() throws URISyntaxException {
271270
272271
273272 @ Test
274- public void testLoadProfile () {
273+ void testLoadProfile () {
275274 Profile profile = util .getClients ().getProfileService ().load ("human" );
276275 System .out .println (profile .getMediaProfile ());
277276 }
278277
279278 @ Test
280- public void badRequest () {
279+ void badRequest () {
281280 assertThatThrownBy (() -> {
282281
283282 //MediaForm form = Jackson2Mapper.getInstance().readValue("{\"searches\":{\"mediaIds\":[{\"value\":\"VPWON_1181924\",\"match\":\"not\"}],\"types\":[{\"value\":\"BROADCAST\",\"match\":\"should\"},{\"value\":\"CLIP\",\"match\":\"should\"},{\"value\":\"SEGMENT\",\"match\":\"should\"},{\"value\":\"TRACK\",\"match\":\"should\"}]}}", MediaForm.class);
@@ -288,7 +287,7 @@ public void badRequest() {
288287 }
289288
290289 @ Test
291- public void loadSubtiles () {
290+ void loadSubtiles () {
292291
293292 System .out .println (util .getClients ().getSubtitlesRestService ().get ("WO_VPRO_025700" , Locale .JAPAN ));
294293 }
0 commit comments