@@ -79,6 +79,31 @@ void testOfJenaModelHandler() throws IOException,
7979 );
8080 }
8181
82+ /**
83+ * @deprecated covers the deprecated JenaBodyHandlers::ofModel function. To be removed when removing the function
84+ * from the API.
85+ */
86+ @ Test
87+ void testOfModelHandler () throws IOException ,
88+ InterruptedException {
89+ final Request request = Request .newBuilder ()
90+ .uri (URI .create (config .get ("rdf_uri" ) + "/oneTriple" ))
91+ .GET ()
92+ .build ();
93+
94+ final var response = client .send (request , JenaBodyHandlers .ofModel ())
95+ .toCompletableFuture ().join ();
96+
97+ assertEquals (200 , response .statusCode ());
98+ final var responseBody = response .body ();
99+ assertEquals (1 , responseBody .size ());
100+ assertTrue (responseBody .contains (
101+ null ,
102+ null ,
103+ ResourceFactory .createResource ("http://example.test/o" ))
104+ );
105+ }
106+
82107 @ Test
83108 void testOfJenaModelHandlerAsync () throws IOException ,
84109 InterruptedException , ExecutionException {
@@ -102,6 +127,33 @@ void testOfJenaModelHandlerAsync() throws IOException,
102127 );
103128 }
104129
130+ /**
131+ * @deprecated covers the deprecated JenaBodyHandlers::ofModel function. To be removed when removing the function
132+ * from the API.
133+ */
134+ @ Test
135+ void testOfModelHandlerAsync () throws IOException ,
136+ InterruptedException , ExecutionException {
137+ final Request request = Request .newBuilder ()
138+ .uri (URI .create (config .get ("rdf_uri" ) + "/oneTriple" ))
139+ .header ("Accept" , "text/turtle" )
140+ .GET ()
141+ .build ();
142+
143+ final var asyncResponse = client .send (request , JenaBodyHandlers .ofModel ());
144+
145+ final int statusCode = asyncResponse .thenApply (Response ::statusCode ).toCompletableFuture ().join ();
146+ assertEquals (200 , statusCode );
147+
148+ final var responseBody = asyncResponse .thenApply (Response ::body ).toCompletableFuture ().join ();
149+ assertEquals (1 , responseBody .size ());
150+ assertTrue (responseBody .contains (
151+ null ,
152+ null ,
153+ ResourceFactory .createResource ("http://example.test/o" ))
154+ );
155+ }
156+
105157 @ Test
106158 void testOfJenaModelHandlerWithURL () throws IOException , InterruptedException {
107159 final Request request = Request .newBuilder ()
@@ -121,6 +173,29 @@ void testOfJenaModelHandlerWithURL() throws IOException, InterruptedException {
121173 );
122174 }
123175
176+ /**
177+ * @deprecated covers the deprecated JenaBodyHandlers::ofModel function. To be removed when removing the function
178+ * from the API.
179+ */
180+ @ Test
181+ void testOfModelHandlerWithURL () throws IOException , InterruptedException {
182+ final Request request = Request .newBuilder ()
183+ .uri (URI .create (config .get ("rdf_uri" ) + "/example" ))
184+ .GET ()
185+ .build ();
186+
187+ final var response = client .send (request , JenaBodyHandlers .ofModel ())
188+ .toCompletableFuture ().join ();
189+
190+ assertEquals (200 , response .statusCode ());
191+ final var responseBody = response .body ();
192+ assertEquals (7 , responseBody .size ());
193+ assertTrue (responseBody .contains (
194+ null ,
195+ ResourceFactory .createProperty ("http://www.w3.org/ns/pim/space#preferencesFile" ))
196+ );
197+ }
198+
124199 @ Test
125200 void testOfJenaModelHandlerError () throws IOException ,
126201 InterruptedException {
@@ -152,16 +227,42 @@ void testOfJenaDatasetHandler() throws IOException,
152227 .build ();
153228
154229 final var response = client .send (request , JenaBodyHandlers .ofJenaDataset ())
155- .toCompletableFuture ().join ();
230+ .toCompletableFuture ().join ();
156231
157232 assertEquals (200 , response .statusCode ());
158233 final var responseBody = response .body ();
159234 assertEquals (1 , responseBody .asDatasetGraph ().stream ().count ());
160235 assertTrue (responseBody .asDatasetGraph ().contains (
161- null ,
162- NodeFactory .createURI ("http://example.test/s" ),
163- null ,
164- null )
236+ null ,
237+ NodeFactory .createURI ("http://example.test/s" ),
238+ null ,
239+ null )
240+ );
241+ }
242+
243+ /**
244+ * @deprecated covers the deprecated JenaBodyHandlers::ofDataset function. To be removed when removing the function
245+ * from the API.
246+ */
247+ @ Test
248+ void testOfDatasetHandler () throws IOException ,
249+ InterruptedException {
250+ final Request request = Request .newBuilder ()
251+ .uri (URI .create (config .get ("rdf_uri" ) + "/oneTriple" ))
252+ .GET ()
253+ .build ();
254+
255+ final var response = client .send (request , JenaBodyHandlers .ofDataset ())
256+ .toCompletableFuture ().join ();
257+
258+ assertEquals (200 , response .statusCode ());
259+ final var responseBody = response .body ();
260+ assertEquals (1 , responseBody .asDatasetGraph ().stream ().count ());
261+ assertTrue (responseBody .asDatasetGraph ().contains (
262+ null ,
263+ NodeFactory .createURI ("http://example.test/s" ),
264+ null ,
265+ null )
165266 );
166267 }
167268
@@ -186,6 +287,31 @@ void testOfJenaDatasetHandlerWithURL() throws IOException, InterruptedException
186287 );
187288 }
188289
290+ /**
291+ * @deprecated covers the deprecated JenaBodyHandlers::ofDataset function. To be removed when removing the function
292+ * from the API.
293+ */
294+ @ Test
295+ void testOfDatasetHandlerWithURL () throws IOException , InterruptedException {
296+ final Request request = Request .newBuilder ()
297+ .uri (URI .create (config .get ("rdf_uri" ) + "/example" ))
298+ .GET ()
299+ .build ();
300+
301+ final var response = client .send (request , JenaBodyHandlers .ofDataset ())
302+ .toCompletableFuture ().join ();
303+
304+ assertEquals (200 , response .statusCode ());
305+ final var responseBody = response .body ();
306+ assertEquals (7 , responseBody .asDatasetGraph ().stream ().count ());
307+ assertTrue (responseBody .asDatasetGraph ().contains (
308+ null ,
309+ null ,
310+ NodeFactory .createURI ("http://www.w3.org/ns/pim/space#preferencesFile" ),
311+ null )
312+ );
313+ }
314+
189315 @ Test
190316 void testOfJenaDatasetHandlerError () throws IOException ,
191317 InterruptedException {
@@ -231,6 +357,33 @@ void testOfJenaGraphHandlerAsync() throws IOException,
231357 );
232358 }
233359
360+ /**
361+ * @deprecated covers the deprecated JenaBodyHandlers::ofGraph function. To be removed when removing the function
362+ * from the API.
363+ */
364+ @ Test
365+ void testOfGraphHandlerAsync () throws IOException ,
366+ InterruptedException , ExecutionException {
367+ final Request request = Request .newBuilder ()
368+ .uri (URI .create (config .get ("rdf_uri" ) + "/oneTriple" ))
369+ .header ("Accept" , "text/turtle" )
370+ .GET ()
371+ .build ();
372+
373+ final var asyncResponse = client .send (request , JenaBodyHandlers .ofGraph ());
374+
375+ final int statusCode = asyncResponse .thenApply (Response ::statusCode ).toCompletableFuture ().join ();
376+ assertEquals (200 , statusCode );
377+
378+ final var responseBody = asyncResponse .thenApply (Response ::body ).toCompletableFuture ().join ();
379+ assertEquals (1 , responseBody .size ());
380+ assertTrue (responseBody .contains (
381+ NodeFactory .createURI ("http://example.test/s" ),
382+ null ,
383+ null )
384+ );
385+ }
386+
234387 @ Test
235388 void testOfJenaGraphHandler () throws IOException ,
236389 InterruptedException {
@@ -252,6 +405,31 @@ void testOfJenaGraphHandler() throws IOException,
252405 );
253406 }
254407
408+ /**
409+ * @deprecated covers the deprecated JenaBodyHandlers::ofGraph function. To be removed when removing the function
410+ * from the API.
411+ */
412+ @ Test
413+ void testOfGraphHandler () throws IOException ,
414+ InterruptedException {
415+ final Request request = Request .newBuilder ()
416+ .uri (URI .create (config .get ("rdf_uri" ) + "/oneTriple" ))
417+ .GET ()
418+ .build ();
419+
420+ final var response = client .send (request , JenaBodyHandlers .ofGraph ())
421+ .toCompletableFuture ().join ();
422+
423+ assertEquals (200 , response .statusCode ());
424+ final var responseBody = response .body ();
425+ assertEquals (1 , responseBody .size ());
426+ assertTrue (responseBody .contains (
427+ NodeFactory .createURI ("http://example.test/s" ),
428+ null ,
429+ null )
430+ );
431+ }
432+
255433 @ Test
256434 void testOfJenaGraphHandlerWithURL () throws IOException , InterruptedException {
257435 final Request request = Request .newBuilder ()
@@ -272,6 +450,30 @@ void testOfJenaGraphHandlerWithURL() throws IOException, InterruptedException {
272450 );
273451 }
274452
453+ /**
454+ * @deprecated covers the deprecated JenaBodyHandlers::ofGraph function. To be removed when removing the function
455+ * from the API.
456+ */
457+ @ Test
458+ void testOfGraphHandlerWithURL () throws IOException , InterruptedException {
459+ final Request request = Request .newBuilder ()
460+ .uri (URI .create (config .get ("rdf_uri" ) + "/example" ))
461+ .GET ()
462+ .build ();
463+
464+ final var response = client .send (request , JenaBodyHandlers .ofGraph ())
465+ .toCompletableFuture ().join ();
466+
467+ assertEquals (200 , response .statusCode ());
468+ final var responseBody = response .body ();
469+ assertEquals (7 , responseBody .size ());
470+ assertTrue (responseBody .contains (
471+ null ,
472+ NodeFactory .createURI ("http://www.w3.org/ns/pim/space#preferencesFile" ),
473+ null )
474+ );
475+ }
476+
275477 @ Test
276478 void testOfJenaGraphHandlerError () throws IOException ,
277479 InterruptedException {
0 commit comments