@@ -54,11 +54,13 @@ public void testCreateArtifactDryRun() throws Exception {
54
54
createRule .setConfig (ValidityLevel .FULL .name ());
55
55
clientV3 .groups ().byGroupId (groupId ).rules ().post (createRule );
56
56
57
- // Dry run: valid artifact that should be created.
58
- CreateArtifact createArtifact = TestUtils .clientCreateArtifact ("valid-artifact" , ArtifactType .AVRO , SCHEMA_SIMPLE , ContentTypes .APPLICATION_JSON );
59
- CreateArtifactResponse car = clientV3 .groups ().byGroupId (groupId ).artifacts ().post (createArtifact , config -> {
60
- config .queryParameters .dryRun = true ;
61
- });
57
+ // Dry run: valid artifact that should be created.
58
+ CreateArtifact createArtifact = TestUtils .clientCreateArtifact ("valid-artifact" , ArtifactType .AVRO ,
59
+ SCHEMA_SIMPLE , ContentTypes .APPLICATION_JSON );
60
+ CreateArtifactResponse car = clientV3 .groups ().byGroupId (groupId ).artifacts ().post (createArtifact ,
61
+ config -> {
62
+ config .queryParameters .dryRun = true ;
63
+ });
62
64
Assertions .assertNotNull (car );
63
65
Assertions .assertEquals (groupId , car .getArtifact ().getGroupId ());
64
66
Assertions .assertEquals ("valid-artifact" , car .getArtifact ().getArtifactId ());
@@ -72,11 +74,14 @@ public void testCreateArtifactDryRun() throws Exception {
72
74
Error error = Assertions .assertThrows (Error .class , () -> {
73
75
clientV3 .groups ().byGroupId (groupId ).artifacts ().byArtifactId ("valid-artifact" ).get ();
74
76
});
75
- Assertions .assertEquals ("No artifact with ID 'valid-artifact' in group 'testCreateArtifactDryRun' was found." , error .getMessageEscaped ());
77
+ Assertions .assertEquals (
78
+ "No artifact with ID 'valid-artifact' in group 'testCreateArtifactDryRun' was found." ,
79
+ error .getMessageEscaped ());
76
80
77
- // Dry run: invalid artifact that should NOT be created.
81
+ // Dry run: invalid artifact that should NOT be created.
78
82
error = Assertions .assertThrows (Error .class , () -> {
79
- CreateArtifact ca = TestUtils .clientCreateArtifact ("invalid-artifact" , ArtifactType .AVRO , INVALID_SCHEMA , ContentTypes .APPLICATION_JSON );
83
+ CreateArtifact ca = TestUtils .clientCreateArtifact ("invalid-artifact" , ArtifactType .AVRO ,
84
+ INVALID_SCHEMA , ContentTypes .APPLICATION_JSON );
80
85
clientV3 .groups ().byGroupId (groupId ).artifacts ().post (ca , config -> {
81
86
config .queryParameters .dryRun = true ;
82
87
});
@@ -94,25 +99,32 @@ public void testCreateArtifactDryRun() throws Exception {
94
99
error = Assertions .assertThrows (Error .class , () -> {
95
100
clientV3 .groups ().byGroupId (groupId ).artifacts ().byArtifactId ("invalid-artifact" ).get ();
96
101
});
97
- Assertions .assertEquals ("No artifact with ID 'invalid-artifact' in group 'testCreateArtifactDryRun' was found." , error .getMessageEscaped ());
102
+ Assertions .assertEquals (
103
+ "No artifact with ID 'invalid-artifact' in group 'testCreateArtifactDryRun' was found." ,
104
+ error .getMessageEscaped ());
98
105
99
106
// Actually create an artifact in the group.
100
- createArtifact (groupId , "actual-artifact" , ArtifactType .AVRO , SCHEMA_SIMPLE , ContentTypes .APPLICATION_JSON );
107
+ createArtifact (groupId , "actual-artifact" , ArtifactType .AVRO , SCHEMA_SIMPLE ,
108
+ ContentTypes .APPLICATION_JSON );
101
109
results = clientV3 .groups ().byGroupId (groupId ).artifacts ().get ();
102
110
Assertions .assertEquals (1 , results .getCount ());
103
111
Assertions .assertEquals (1 , results .getArtifacts ().size ());
104
112
105
113
// DryRun: Try to create the *same* artifact (conflict)
106
114
error = Assertions .assertThrows (Error .class , () -> {
107
- CreateArtifact ca = TestUtils .clientCreateArtifact ("actual-artifact" , ArtifactType .AVRO , SCHEMA_SIMPLE , ContentTypes .APPLICATION_JSON );
115
+ CreateArtifact ca = TestUtils .clientCreateArtifact ("actual-artifact" , ArtifactType .AVRO ,
116
+ SCHEMA_SIMPLE , ContentTypes .APPLICATION_JSON );
108
117
clientV3 .groups ().byGroupId (groupId ).artifacts ().post (ca , config -> {
109
118
config .queryParameters .dryRun = true ;
110
119
});
111
120
});
112
- Assertions .assertEquals ("An artifact with ID 'actual-artifact' in group 'testCreateArtifactDryRun' already exists." , error .getMessageEscaped ());
121
+ Assertions .assertEquals (
122
+ "An artifact with ID 'actual-artifact' in group 'testCreateArtifactDryRun' already exists." ,
123
+ error .getMessageEscaped ());
113
124
114
125
// DryRun: Try to create the *same* artifact but with ifExists set (success)
115
- createArtifact = TestUtils .clientCreateArtifact ("actual-artifact" , ArtifactType .AVRO , SCHEMA_SIMPLE , ContentTypes .APPLICATION_JSON );
126
+ createArtifact = TestUtils .clientCreateArtifact ("actual-artifact" , ArtifactType .AVRO , SCHEMA_SIMPLE ,
127
+ ContentTypes .APPLICATION_JSON );
116
128
car = clientV3 .groups ().byGroupId (groupId ).artifacts ().post (createArtifact , config -> {
117
129
config .queryParameters .dryRun = true ;
118
130
config .queryParameters .ifExists = IfArtifactExists .CREATE_VERSION ;
@@ -127,7 +139,8 @@ public void testCreateArtifactDryRun() throws Exception {
127
139
results = clientV3 .groups ().byGroupId (groupId ).artifacts ().get ();
128
140
Assertions .assertEquals (1 , results .getCount ());
129
141
Assertions .assertEquals (1 , results .getArtifacts ().size ());
130
- VersionSearchResults vresults = clientV3 .groups ().byGroupId (groupId ).artifacts ().byArtifactId ("actual-artifact" ).versions ().get ();
142
+ VersionSearchResults vresults = clientV3 .groups ().byGroupId (groupId ).artifacts ()
143
+ .byArtifactId ("actual-artifact" ).versions ().get ();
131
144
Assertions .assertEquals (2 , vresults .getCount ());
132
145
Assertions .assertEquals (2 , vresults .getVersions ().size ());
133
146
}
@@ -153,20 +166,24 @@ public void testCreateVersionDryRun() throws Exception {
153
166
154
167
// DryRun: try to create an invalid version
155
168
Error error = Assertions .assertThrows (Error .class , () -> {
156
- CreateVersion createVersion = TestUtils .clientCreateVersion (INVALID_SCHEMA , ContentTypes .APPLICATION_JSON );
157
- clientV3 .groups ().byGroupId (groupId ).artifacts ().byArtifactId (artifactId ).versions ().post (createVersion , config -> {
158
- config .queryParameters .dryRun = true ;
159
- });
169
+ CreateVersion createVersion = TestUtils .clientCreateVersion (INVALID_SCHEMA ,
170
+ ContentTypes .APPLICATION_JSON );
171
+ clientV3 .groups ().byGroupId (groupId ).artifacts ().byArtifactId (artifactId ).versions ()
172
+ .post (createVersion , config -> {
173
+ config .queryParameters .dryRun = true ;
174
+ });
160
175
});
161
176
Assertions .assertEquals ("Syntax violation for Avro artifact." , error .getMessageEscaped ());
162
177
163
178
// DryRun: try to create a valid version (appears to work)
164
179
{
165
- CreateVersion createVersion = TestUtils .clientCreateVersion (SCHEMA_SIMPLE , ContentTypes .APPLICATION_JSON );
180
+ CreateVersion createVersion = TestUtils .clientCreateVersion (SCHEMA_SIMPLE ,
181
+ ContentTypes .APPLICATION_JSON );
166
182
createVersion .setName ("DryRunVersion" );
167
- VersionMetaData vmd = clientV3 .groups ().byGroupId (groupId ).artifacts ().byArtifactId (artifactId ).versions ().post (createVersion , config -> {
168
- config .queryParameters .dryRun = true ;
169
- });
183
+ VersionMetaData vmd = clientV3 .groups ().byGroupId (groupId ).artifacts ().byArtifactId (artifactId )
184
+ .versions ().post (createVersion , config -> {
185
+ config .queryParameters .dryRun = true ;
186
+ });
170
187
Assertions .assertNotNull (vmd );
171
188
Assertions .assertEquals ("DryRunVersion" , vmd .getName ());
172
189
Assertions .assertEquals ("2" , vmd .getVersion ());
@@ -176,7 +193,8 @@ public void testCreateVersionDryRun() throws Exception {
176
193
ArtifactSearchResults results = clientV3 .groups ().byGroupId (groupId ).artifacts ().get ();
177
194
Assertions .assertEquals (1 , results .getCount ());
178
195
Assertions .assertEquals (1 , results .getArtifacts ().size ());
179
- VersionSearchResults vresults = clientV3 .groups ().byGroupId (groupId ).artifacts ().byArtifactId (artifactId ).versions ().get ();
196
+ VersionSearchResults vresults = clientV3 .groups ().byGroupId (groupId ).artifacts ()
197
+ .byArtifactId (artifactId ).versions ().get ();
180
198
Assertions .assertEquals (1 , vresults .getCount ());
181
199
Assertions .assertEquals (1 , vresults .getVersions ().size ());
182
200
}
0 commit comments