2929
3030import org .eclipse .tracecompass .incubator .internal .trace .server .jersey .rest .core .services .DataProviderService ;
3131import org .eclipse .tracecompass .incubator .internal .trace .server .jersey .rest .core .services .EndpointConstants ;
32+ import org .eclipse .tracecompass .incubator .internal .trace .server .jersey .rest .core .services .ErrorResponseImpl ;
3233import org .eclipse .tracecompass .incubator .trace .server .jersey .rest .core .tests .stubs .DataProviderDescriptorStub ;
3334import org .eclipse .tracecompass .incubator .trace .server .jersey .rest .core .tests .stubs .ExperimentModelStub ;
3435import org .eclipse .tracecompass .incubator .trace .server .jersey .rest .core .tests .stubs .TestDataProviderFactory ;
@@ -93,29 +94,29 @@ public void testDataProviderConfigTypesErrors() {
9394 try (Response response = configTypesEndpoint .request (MediaType .APPLICATION_JSON ).get ()) {
9495 assertNotNull (response );
9596 assertEquals (Status .NOT_FOUND .getStatusCode (), response .getStatus ());
96- assertEquals (EndpointConstants .NO_SUCH_TRACE , response .readEntity (String .class ));
97+ assertEquals (EndpointConstants .NO_SUCH_TRACE , response .readEntity (ErrorResponseImpl .class ). getMessage ( ));
9798 }
9899
99100 WebTarget singleTypeEndpoint = configTypesEndpoint .path (TestSchemaConfigurationSource .TYPE .getId ());
100101 try (Response response = singleTypeEndpoint .request (MediaType .APPLICATION_JSON ).get ()) {
101102 assertNotNull (response );
102103 assertEquals (Status .NOT_FOUND .getStatusCode (), response .getStatus ());
103- assertEquals (EndpointConstants .NO_SUCH_TRACE , response .readEntity (String .class ));
104+ assertEquals (EndpointConstants .NO_SUCH_TRACE , response .readEntity (ErrorResponseImpl .class ). getMessage ( ));
104105 }
105106
106107 // Unknown data provider
107108 configTypesEndpoint = getConfigEndpoint (exp .getUUID ().toString (), UNKNOWN_DP_ID );
108109 try (Response response = configTypesEndpoint .request (MediaType .APPLICATION_JSON ).get ()) {
109110 assertNotNull (response );
110111 assertEquals (Status .NOT_FOUND .getStatusCode (), response .getStatus ());
111- assertEquals (EndpointConstants .NO_SUCH_PROVIDER , response .readEntity (String .class ));
112+ assertEquals (EndpointConstants .NO_SUCH_PROVIDER , response .readEntity (ErrorResponseImpl .class ). getMessage ( ));
112113 }
113114
114115 singleTypeEndpoint = configTypesEndpoint .path (TestSchemaConfigurationSource .TYPE .getId ());
115116 try (Response response = singleTypeEndpoint .request (MediaType .APPLICATION_JSON ).get ()) {
116117 assertNotNull (response );
117118 assertEquals (Status .NOT_FOUND .getStatusCode (), response .getStatus ());
118- assertEquals (EndpointConstants .NO_SUCH_PROVIDER , response .readEntity (String .class ));
119+ assertEquals (EndpointConstants .NO_SUCH_PROVIDER , response .readEntity (ErrorResponseImpl .class ). getMessage ( ));
119120 }
120121
121122 // Test config type is not applicable for another data provider
@@ -124,15 +125,15 @@ public void testDataProviderConfigTypesErrors() {
124125 try (Response response = singleTypeEndpoint .request (MediaType .APPLICATION_JSON ).get ()) {
125126 assertNotNull (response );
126127 assertEquals (Status .NOT_FOUND .getStatusCode (), response .getStatus ());
127- assertEquals (EndpointConstants .NO_SUCH_PROVIDER , response .readEntity (String .class ));
128+ assertEquals (EndpointConstants .NO_SUCH_PROVIDER , response .readEntity (ErrorResponseImpl .class ). getMessage ( ));
128129 }
129130
130131 configTypesEndpoint = getConfigEndpoint (exp .getUUID ().toString (), TestDataProviderFactory .ID );
131132 singleTypeEndpoint = configTypesEndpoint .path (UNKNOWN_TYPE_ID );
132133 try (Response response = singleTypeEndpoint .request (MediaType .APPLICATION_JSON ).get ()) {
133134 assertNotNull (response );
134135 assertEquals (Status .NOT_FOUND .getStatusCode (), response .getStatus ());
135- assertEquals (EndpointConstants .NO_SUCH_CONFIGURATION_TYPE , response .readEntity (String .class ));
136+ assertEquals (EndpointConstants .NO_SUCH_CONFIGURATION_TYPE , response .readEntity (ErrorResponseImpl .class ). getMessage ( ));
136137 }
137138 }
138139
@@ -194,21 +195,21 @@ public void testCreationOfDerivedDataProvidersErrors() throws IOException, URISy
194195 // Unknown experiment
195196 try (Response response = assertDpPostWithErrors (dpCreationEndpoint , configuration )) {
196197 assertEquals (Status .NOT_FOUND .getStatusCode (), response .getStatus ());
197- assertEquals (EndpointConstants .NO_SUCH_TRACE , response .readEntity (String .class ));
198+ assertEquals (EndpointConstants .NO_SUCH_TRACE , response .readEntity (ErrorResponseImpl .class ). getMessage ( ));
198199 }
199200
200201 // Unknown data provider
201202 dpCreationEndpoint = getDpCreationEndpoint (exp .getUUID ().toString (), UNKNOWN_DP_ID );
202203 try (Response response = assertDpPostWithErrors (dpCreationEndpoint , configuration )) {
203204 assertEquals (Status .NOT_FOUND .getStatusCode (), response .getStatus ());
204- assertEquals (EndpointConstants .NO_SUCH_PROVIDER + ": " + UNKNOWN_DP_ID , response .readEntity (String .class ));
205+ assertEquals (EndpointConstants .NO_SUCH_PROVIDER + ": " + UNKNOWN_DP_ID , response .readEntity (ErrorResponseImpl .class ). getMessage ( ));
205206 }
206207
207208 // Test config type is not applicable for another data provider
208209 dpCreationEndpoint = getDpCreationEndpoint (exp .getUUID ().toString (), CALL_STACK_DATAPROVIDER_ID );
209210 try (Response response = assertDpPostWithErrors (dpCreationEndpoint , configuration )) {
210211 assertEquals (Status .NOT_FOUND .getStatusCode (), response .getStatus ());
211- assertEquals (EndpointConstants .NO_SUCH_PROVIDER , response .readEntity (String .class ));
212+ assertEquals (EndpointConstants .NO_SUCH_PROVIDER , response .readEntity (ErrorResponseImpl .class ). getMessage ( ));
212213 }
213214
214215 // Invalid config type ID
@@ -222,7 +223,7 @@ public void testCreationOfDerivedDataProvidersErrors() throws IOException, URISy
222223 configuration = builder .build ();
223224 try (Response response = assertDpPostWithErrors (dpCreationEndpoint , configuration )) {
224225 assertEquals (Status .NOT_FOUND .getStatusCode (), response .getStatus ());
225- assertEquals (EndpointConstants .NO_SUCH_CONFIGURATION_TYPE , response .readEntity (String .class ));
226+ assertEquals (EndpointConstants .NO_SUCH_CONFIGURATION_TYPE , response .readEntity (ErrorResponseImpl .class ). getMessage ( ));
226227 }
227228 }
228229
@@ -244,7 +245,7 @@ public void testDeletionOfDerivedDataProvidersErrors() throws IOException, URISy
244245 try (Response response = dpDeletionEndpoint .request ().delete ()) {
245246 assertNotNull (response );
246247 assertEquals (Status .NOT_FOUND .getStatusCode (), response .getStatus ());
247- assertEquals (EndpointConstants .NO_SUCH_TRACE , response .readEntity (String .class ));
248+ assertEquals (EndpointConstants .NO_SUCH_TRACE , response .readEntity (ErrorResponseImpl .class ). getMessage ( ));
248249 }
249250
250251 // Unknown input data provider
@@ -253,7 +254,7 @@ public void testDeletionOfDerivedDataProvidersErrors() throws IOException, URISy
253254 try (Response response = dpDeletionEndpoint .request ().delete ()) {
254255 assertNotNull (response );
255256 assertEquals (Status .NOT_FOUND .getStatusCode (), response .getStatus ());
256- assertEquals (EndpointConstants .NO_SUCH_PROVIDER + ": " + UNKNOWN_DP_ID , response .readEntity (String .class ));
257+ assertEquals (EndpointConstants .NO_SUCH_PROVIDER + ": " + UNKNOWN_DP_ID , response .readEntity (ErrorResponseImpl .class ). getMessage ( ));
257258 }
258259
259260 // Unknown derived data provider
@@ -262,7 +263,7 @@ public void testDeletionOfDerivedDataProvidersErrors() throws IOException, URISy
262263 try (Response response = dpDeletionEndpoint .request ().delete ()) {
263264 assertNotNull (response );
264265 assertEquals (Status .NOT_FOUND .getStatusCode (), response .getStatus ());
265- assertEquals (EndpointConstants .NO_SUCH_DERIVED_PROVIDER + ": " + UNKNOWN_DP_ID , response .readEntity (String .class ));
266+ assertEquals (EndpointConstants .NO_SUCH_DERIVED_PROVIDER + ": " + UNKNOWN_DP_ID , response .readEntity (ErrorResponseImpl .class ). getMessage ( ));
266267 }
267268
268269 Map <String , Object > params = readParametersFromJson (VALID_JSON_FILENAME );
@@ -283,7 +284,7 @@ public void testDeletionOfDerivedDataProvidersErrors() throws IOException, URISy
283284 try (Response response = dpDeletionEndpoint .request ().delete ()) {
284285 assertNotNull (response );
285286 assertEquals (Status .NOT_FOUND .getStatusCode (), response .getStatus ());
286- assertEquals (EndpointConstants .NO_SUCH_PROVIDER , response .readEntity (String .class ));
287+ assertEquals (EndpointConstants .NO_SUCH_PROVIDER , response .readEntity (ErrorResponseImpl .class ). getMessage ( ));
287288 }
288289
289290 // Successful deletion
0 commit comments