|
| 1 | +/* Licensed under the Apache License, Version 2.0 (the "License"); |
| 2 | + * you may not use this file except in compliance with the License. |
| 3 | + * You may obtain a copy of the License at |
| 4 | + * |
| 5 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | + * |
| 7 | + * Unless required by applicable law or agreed to in writing, software |
| 8 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 9 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 10 | + * See the License for the specific language governing permissions and |
| 11 | + * limitations under the License. |
| 12 | + */ |
| 13 | + |
| 14 | +package org.flowable.rest.service.api.management; |
| 15 | + |
| 16 | +import static net.javacrumbs.jsonunit.assertj.JsonAssertions.assertThatJson; |
| 17 | + |
| 18 | +import org.apache.http.HttpStatus; |
| 19 | +import org.apache.http.client.methods.CloseableHttpResponse; |
| 20 | +import org.apache.http.client.methods.HttpGet; |
| 21 | +import org.flowable.rest.service.BaseSpringRestTestCase; |
| 22 | +import org.flowable.rest.service.api.RestUrls; |
| 23 | +import org.flowable.variable.service.impl.persistence.entity.VariableInstanceEntity; |
| 24 | +import org.junit.jupiter.api.Test; |
| 25 | + |
| 26 | +import com.fasterxml.jackson.databind.JsonNode; |
| 27 | + |
| 28 | +/** |
| 29 | + * @author Filip Hrisafov |
| 30 | + */ |
| 31 | +public class TableManagementDisabledTest extends BaseSpringRestTestCase { |
| 32 | + |
| 33 | + @Test |
| 34 | + public void tableResourcesAreNotRegisteredByDefault() throws Exception { |
| 35 | + String tableName = managementService.getTableName(VariableInstanceEntity.class); |
| 36 | + |
| 37 | + CloseableHttpResponse response = executeRequest(new HttpGet(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_TABLES_COLLECTION)), |
| 38 | + HttpStatus.SC_NOT_FOUND); |
| 39 | + JsonNode responseNode = objectMapper.readTree(response.getEntity().getContent()); |
| 40 | + closeResponse(response); |
| 41 | + assertThatJson(responseNode) |
| 42 | + .isEqualTo("{" |
| 43 | + + " message: 'Not Found'," |
| 44 | + + " exception: 'No endpoint GET /service/management/tables.'" |
| 45 | + + "}"); |
| 46 | + |
| 47 | + closeResponse(executeRequest(new HttpGet(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_TABLE, tableName)), |
| 48 | + HttpStatus.SC_NOT_FOUND)); |
| 49 | + closeResponse(executeRequest(new HttpGet(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_TABLE_COLUMNS, tableName)), |
| 50 | + HttpStatus.SC_NOT_FOUND)); |
| 51 | + closeResponse(executeRequest(new HttpGet(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_TABLE_DATA, tableName)), |
| 52 | + HttpStatus.SC_NOT_FOUND)); |
| 53 | + } |
| 54 | +} |
0 commit comments