|
43 | 43 | import org.apache.hc.core5.http.ProtocolException; |
44 | 44 | import org.apache.hc.core5.http.io.entity.EntityUtils; |
45 | 45 | import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.DeserializationException; |
| 46 | +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultAssetAdministrationShell; |
46 | 47 | import org.eclipse.digitaltwin.basyx.http.Base64UrlEncodedIdentifier; |
47 | 48 | import org.eclipse.digitaltwin.basyx.http.HttpBaSyxHeader; |
48 | 49 | import org.eclipse.digitaltwin.basyx.http.pagination.Base64UrlEncodedCursor; |
@@ -148,19 +149,49 @@ public void getAllAasWhenEmpty() throws IOException { |
148 | 149 |
|
149 | 150 | assertEquals(HttpStatus.OK.value(), retrievalResponse.getCode()); |
150 | 151 | } |
151 | | - |
| 152 | + |
152 | 153 | @Test |
153 | 154 | public void getAllPaginatedAas() throws IOException, ParseException { |
154 | 155 | createMultipleAasOnServer(); |
155 | | - |
| 156 | + |
156 | 157 | CloseableHttpResponse retrievalResponse = getAllAas(); |
157 | 158 | assertEquals(HttpStatus.OK.value(), retrievalResponse.getCode()); |
158 | | - |
| 159 | + |
159 | 160 | String actualJsonFromServer = BaSyxHttpTestUtils.getResponseAsString(retrievalResponse); |
160 | | - |
| 161 | + |
161 | 162 | BaSyxHttpTestUtils.assertSameJSONContent(getPaginatedAasJSONString(), getJSONWithoutCursorInfo(actualJsonFromServer)); |
162 | 163 | } |
163 | 164 |
|
| 165 | + @Test |
| 166 | + public void getAllAasWithAssetIds() throws IOException, ParseException { |
| 167 | + createMultipleAasOnServer(); |
| 168 | + CloseableHttpResponse retrievalResponse = getAllAasAssetIdsParam(); |
| 169 | + assertEquals(HttpStatus.OK.value(), retrievalResponse.getCode()); |
| 170 | + |
| 171 | + String actualJsonFromServer = BaSyxHttpTestUtils.getResponseAsString(retrievalResponse); |
| 172 | + BaSyxHttpTestUtils.assertSameJSONContent(getPaginatedAas1JSONString(), getJSONWithoutCursorInfo(actualJsonFromServer)); |
| 173 | + } |
| 174 | + |
| 175 | + @Test |
| 176 | + public void getAllAasWithGlobalAssetIds() throws IOException, ParseException { |
| 177 | + createMultipleAasOnServer(); |
| 178 | + CloseableHttpResponse retrievalResponse = getAllAasGlobalAssetIdsParam(); |
| 179 | + assertEquals(HttpStatus.OK.value(), retrievalResponse.getCode()); |
| 180 | + |
| 181 | + String actualJsonFromServer = BaSyxHttpTestUtils.getResponseAsString(retrievalResponse); |
| 182 | + BaSyxHttpTestUtils.assertSameJSONContent(getPaginatedAas1JSONString(), getJSONWithoutCursorInfo(actualJsonFromServer)); |
| 183 | + } |
| 184 | + |
| 185 | + @Test |
| 186 | + public void getAllAasWithIdShort() throws IOException, ParseException { |
| 187 | + createMultipleAasOnServer(); |
| 188 | + CloseableHttpResponse retrievalResponse = getAllAasIdShortParam(); |
| 189 | + assertEquals(HttpStatus.OK.value(), retrievalResponse.getCode()); |
| 190 | + |
| 191 | + String actualJsonFromServer = BaSyxHttpTestUtils.getResponseAsString(retrievalResponse); |
| 192 | + BaSyxHttpTestUtils.assertSameJSONContent(getPaginatedAas1JSONString(), getJSONWithoutCursorInfo(actualJsonFromServer)); |
| 193 | + } |
| 194 | + |
164 | 195 | @Test |
165 | 196 | public void deleteAas() throws IOException { |
166 | 197 | createDummyAasOnServer(getAas1JSONString()); |
@@ -450,6 +481,18 @@ protected CloseableHttpResponse getAllAas() throws IOException { |
450 | 481 | return BaSyxHttpTestUtils.executeGetOnURL(getURL()); |
451 | 482 | } |
452 | 483 |
|
| 484 | + protected CloseableHttpResponse getAllAasAssetIdsParam() throws IOException { |
| 485 | + return BaSyxHttpTestUtils.executeGetOnURL(getURL()+"?assetIds=ew0KIm5hbWUiOiJ0ZXN0SWQiLA0KInZhbHVlIjoidGVzdFZhbHVlIg0KfQ"); |
| 486 | + } |
| 487 | + |
| 488 | + protected CloseableHttpResponse getAllAasGlobalAssetIdsParam() throws IOException { |
| 489 | + return BaSyxHttpTestUtils.executeGetOnURL(getURL()+"?assetIds=ew0KIm5hbWUiOiJnbG9iYWxBc3NldElkIiwNCiJ2YWx1ZSI6Imdsb2JhbEFzc2V0SWQiDQp9"); |
| 490 | + } |
| 491 | + |
| 492 | + protected CloseableHttpResponse getAllAasIdShortParam() throws IOException { |
| 493 | + return BaSyxHttpTestUtils.executeGetOnURL(getURL()+"?idShort=ExampleMotor"); |
| 494 | + } |
| 495 | + |
453 | 496 | private CloseableHttpResponse getSpecificAas(String aasId) throws IOException { |
454 | 497 | String url = getSpecificAasAccessURL(aasId); |
455 | 498 | return BaSyxHttpTestUtils.executeGetOnURL(url); |
|
0 commit comments