File tree 2 files changed +33
-0
lines changed
java/io/apicurio/registry/operator/api/v1
2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 1
1
package io .apicurio .registry .operator .api .v1 ;
2
2
3
+ import com .fasterxml .jackson .core .type .TypeReference ;
3
4
import com .fasterxml .jackson .databind .ObjectMapper ;
4
5
import com .fasterxml .jackson .dataformat .yaml .YAMLFactory ;
5
6
import org .junit .jupiter .api .Test ;
@@ -22,4 +23,21 @@ public void basicReadOfCRs() throws Exception {
22
23
assertEquals ("test" , registry .getMetadata ().getName ());
23
24
assertEquals ("test-namespace" , registry .getMetadata ().getNamespace ());
24
25
}
26
+
27
+ @ Test
28
+ public void basicReadOfMultipleCRs () throws Exception {
29
+ // Arrange
30
+ var resource = getClass ().getResourceAsStream ("/demo-crs.yaml" );
31
+
32
+ // Act
33
+ var registries = MAPPER
34
+ .readValues (MAPPER .createParser (resource ), new TypeReference <ApicurioRegistry3 >() {
35
+ }).readAll ();
36
+
37
+ // Assert
38
+ assertEquals ("test1" , registries .get (0 ).getMetadata ().getName ());
39
+ assertEquals ("test-namespace1" , registries .get (0 ).getMetadata ().getNamespace ());
40
+ assertEquals ("test2" , registries .get (1 ).getMetadata ().getName ());
41
+ assertEquals ("test-namespace2" , registries .get (1 ).getMetadata ().getNamespace ());
42
+ }
25
43
}
Original file line number Diff line number Diff line change
1
+ apiVersion : registry.apicur.io/v1
2
+ kind : ApicurioRegistry3
3
+ metadata :
4
+ name : test1
5
+ namespace : test-namespace1
6
+ spec :
7
+ { }
8
+ ---
9
+ apiVersion : registry.apicur.io/v1
10
+ kind : ApicurioRegistry3
11
+ metadata :
12
+ name : test2
13
+ namespace : test-namespace2
14
+ spec :
15
+ { }
You can’t perform that action at this time.
0 commit comments