|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | + * or more contributor license agreements. See the NOTICE file |
| 4 | + * distributed with this work for additional information |
| 5 | + * regarding copyright ownership. The ASF licenses this file |
| 6 | + * to you under the Apache License, Version 2.0 (the |
| 7 | + * "License"); you may not use this file except in compliance |
| 8 | + * with the License. You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, |
| 13 | + * software distributed under the License is distributed on an |
| 14 | + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | + * KIND, either express or implied. See the License for the |
| 16 | + * specific language governing permissions and limitations |
| 17 | + * under the License. |
| 18 | + */ |
| 19 | +package org.apache.iceberg.rest; |
| 20 | + |
| 21 | +import static org.assertj.core.api.Assertions.assertThat; |
| 22 | + |
| 23 | +import org.apache.iceberg.catalog.Catalog; |
| 24 | +import org.apache.iceberg.util.PropertyUtil; |
| 25 | +import org.apache.iceberg.view.ViewCatalogTests; |
| 26 | +import org.junit.jupiter.api.AfterAll; |
| 27 | +import org.junit.jupiter.api.BeforeAll; |
| 28 | +import org.junit.jupiter.api.BeforeEach; |
| 29 | +import org.junit.jupiter.api.extension.ExtendWith; |
| 30 | +import org.slf4j.Logger; |
| 31 | +import org.slf4j.LoggerFactory; |
| 32 | + |
| 33 | +@ExtendWith(RESTServerExtension.class) |
| 34 | +public class RESTCompatibilityKitViewCatalogTests extends ViewCatalogTests<RESTCatalog> { |
| 35 | + private static final Logger LOG = |
| 36 | + LoggerFactory.getLogger(RESTCompatibilityKitViewCatalogTests.class); |
| 37 | + private static RESTCatalog restCatalog; |
| 38 | + |
| 39 | + @BeforeAll |
| 40 | + static void beforeClass() throws Exception { |
| 41 | + restCatalog = RCKUtils.initCatalogClient(); |
| 42 | + |
| 43 | + assertThat(restCatalog.listNamespaces()) |
| 44 | + .withFailMessage("Namespaces list should not contain: %s", RCKUtils.TEST_NAMESPACES) |
| 45 | + .doesNotContainAnyElementsOf(RCKUtils.TEST_NAMESPACES); |
| 46 | + } |
| 47 | + |
| 48 | + @BeforeEach |
| 49 | + void before() { |
| 50 | + try { |
| 51 | + RCKUtils.purgeCatalogTestEntries(restCatalog); |
| 52 | + } catch (Exception e) { |
| 53 | + LOG.warn("Failure during test setup", e); |
| 54 | + } |
| 55 | + } |
| 56 | + |
| 57 | + @AfterAll |
| 58 | + static void afterClass() throws Exception { |
| 59 | + restCatalog.close(); |
| 60 | + } |
| 61 | + |
| 62 | + @Override |
| 63 | + protected RESTCatalog catalog() { |
| 64 | + return restCatalog; |
| 65 | + } |
| 66 | + |
| 67 | + @Override |
| 68 | + protected Catalog tableCatalog() { |
| 69 | + return restCatalog; |
| 70 | + } |
| 71 | + |
| 72 | + @Override |
| 73 | + protected boolean requiresNamespaceCreate() { |
| 74 | + return PropertyUtil.propertyAsBoolean( |
| 75 | + restCatalog.properties(), RESTCompatibilityKitSuite.RCK_REQUIRES_NAMESPACE_CREATE, true); |
| 76 | + } |
| 77 | + |
| 78 | + @Override |
| 79 | + protected boolean supportsServerSideRetry() { |
| 80 | + return PropertyUtil.propertyAsBoolean( |
| 81 | + restCatalog.properties(), RESTCompatibilityKitSuite.RCK_SUPPORTS_SERVERSIDE_RETRY, true); |
| 82 | + } |
| 83 | + |
| 84 | + @Override |
| 85 | + protected boolean overridesRequestedLocation() { |
| 86 | + return PropertyUtil.propertyAsBoolean( |
| 87 | + restCatalog.properties(), |
| 88 | + RESTCompatibilityKitSuite.RCK_OVERRIDES_REQUESTED_LOCATION, |
| 89 | + false); |
| 90 | + } |
| 91 | +} |
0 commit comments