This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit b3e2995fadcb045179ff46ce795a812bb6e9994f
Author: Daniel Qian <chanjars...@gmail.com>
AuthorDate: Thu Nov 7 17:19:15 2019 +0800

    SCB-1555 Integrate oas-validator compability check to cli
    Remove useless ExampleDiffValidator
---
 .../DefaultComponentsDiffValidatorFactory.java     |  7 ---
 .../DefaultExampleDiffValidatorFactory.java        | 34 --------------
 .../DefaultExampleDiffValidatorFactoryTest.java    | 43 -----------------
 .../OasDiffValidatorsSkeletonConfiguration.java    | 47 ++++++++++++++-----
 .../diffvalidation/api/ExampleDiffValidator.java   | 23 ---------
 .../factory/ExampleDiffValidatorFactory.java       | 23 ---------
 .../ComponentsExamplesDiffValidator.java           | 54 ----------------------
 7 files changed, 36 insertions(+), 195 deletions(-)

diff --git 
a/oas-validator/oas-validator-compatibility/src/main/java/org/apache/servicecomb/toolkit/oasv/compatibility/factory/DefaultComponentsDiffValidatorFactory.java
 
b/oas-validator/oas-validator-compatibility/src/main/java/org/apache/servicecomb/toolkit/oasv/compatibility/factory/DefaultComponentsDiffValidatorFactory.java
index 213d441..ab791ee 100644
--- 
a/oas-validator/oas-validator-compatibility/src/main/java/org/apache/servicecomb/toolkit/oasv/compatibility/factory/DefaultComponentsDiffValidatorFactory.java
+++ 
b/oas-validator/oas-validator-compatibility/src/main/java/org/apache/servicecomb/toolkit/oasv/compatibility/factory/DefaultComponentsDiffValidatorFactory.java
@@ -24,14 +24,12 @@ import java.util.List;
 import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.api.ComponentsDiffValidator;
 import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.factory.CallbackDiffValidatorFactory;
 import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.factory.ComponentsDiffValidatorFactory;
-import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.factory.ExampleDiffValidatorFactory;
 import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.factory.HeaderDiffValidatorFactory;
 import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.factory.LinkDiffValidatorFactory;
 import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.factory.ParameterDiffValidatorFactory;
 import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.factory.RequestBodyDiffValidatorFactory;
 import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.factory.ResponseDiffValidatorFactory;
 import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.skeleton.components.ComponentsCallbacksDiffValidator;
-import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.skeleton.components.ComponentsExamplesDiffValidator;
 import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.skeleton.components.ComponentsHeadersDiffValidator;
 import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.skeleton.components.ComponentsLinksDiffValidator;
 import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.skeleton.components.ComponentsParametersDiffValidator;
@@ -44,8 +42,6 @@ public class DefaultComponentsDiffValidatorFactory implements 
ComponentsDiffVali
 
   private final CallbackDiffValidatorFactory callbackDiffValidatorFactory;
 
-  private final ExampleDiffValidatorFactory exampleDiffValidatorFactory;
-
   private final HeaderDiffValidatorFactory headerDiffValidatorFactory;
 
   private final LinkDiffValidatorFactory linkDiffValidatorFactory;
@@ -58,14 +54,12 @@ public class DefaultComponentsDiffValidatorFactory 
implements ComponentsDiffVali
 
   public DefaultComponentsDiffValidatorFactory(
       CallbackDiffValidatorFactory callbackDiffValidatorFactory,
-      ExampleDiffValidatorFactory exampleDiffValidatorFactory,
       HeaderDiffValidatorFactory headerDiffValidatorFactory,
       LinkDiffValidatorFactory linkDiffValidatorFactory,
       ParameterDiffValidatorFactory parameterDiffValidatorFactory,
       RequestBodyDiffValidatorFactory requestBodyDiffValidatorFactory,
       ResponseDiffValidatorFactory responseDiffValidatorFactory) {
     this.callbackDiffValidatorFactory = callbackDiffValidatorFactory;
-    this.exampleDiffValidatorFactory = exampleDiffValidatorFactory;
     this.headerDiffValidatorFactory = headerDiffValidatorFactory;
     this.linkDiffValidatorFactory = linkDiffValidatorFactory;
     this.parameterDiffValidatorFactory = parameterDiffValidatorFactory;
@@ -80,7 +74,6 @@ public class DefaultComponentsDiffValidatorFactory implements 
ComponentsDiffVali
 
     // skeletons
     validators.add(new 
ComponentsCallbacksDiffValidator(callbackDiffValidatorFactory.create()));
-    validators.add(new 
ComponentsExamplesDiffValidator(exampleDiffValidatorFactory.create()));
     validators.add(new 
ComponentsHeadersDiffValidator(headerDiffValidatorFactory.create()));
     validators.add(new 
ComponentsLinksDiffValidator(linkDiffValidatorFactory.create()));
     validators.add(new 
ComponentsParametersDiffValidator(parameterDiffValidatorFactory.create()));
diff --git 
a/oas-validator/oas-validator-compatibility/src/main/java/org/apache/servicecomb/toolkit/oasv/compatibility/factory/DefaultExampleDiffValidatorFactory.java
 
b/oas-validator/oas-validator-compatibility/src/main/java/org/apache/servicecomb/toolkit/oasv/compatibility/factory/DefaultExampleDiffValidatorFactory.java
deleted file mode 100644
index 30d8190..0000000
--- 
a/oas-validator/oas-validator-compatibility/src/main/java/org/apache/servicecomb/toolkit/oasv/compatibility/factory/DefaultExampleDiffValidatorFactory.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.toolkit.oasv.compatibility.factory;
-
-import java.util.Collections;
-import java.util.List;
-
-import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.api.ExampleDiffValidator;
-import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.factory.ExampleDiffValidatorFactory;
-import org.springframework.stereotype.Component;
-
-@Component
-public class DefaultExampleDiffValidatorFactory implements 
ExampleDiffValidatorFactory {
-
-  @Override
-  public List<ExampleDiffValidator> create() {
-    return Collections.emptyList();
-  }
-}
diff --git 
a/oas-validator/oas-validator-compatibility/src/test/java/org/apache/servicecomb/toolkit/oasv/compatibility/factory/DefaultExampleDiffValidatorFactoryTest.java
 
b/oas-validator/oas-validator-compatibility/src/test/java/org/apache/servicecomb/toolkit/oasv/compatibility/factory/DefaultExampleDiffValidatorFactoryTest.java
deleted file mode 100644
index 989c4af..0000000
--- 
a/oas-validator/oas-validator-compatibility/src/test/java/org/apache/servicecomb/toolkit/oasv/compatibility/factory/DefaultExampleDiffValidatorFactoryTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.toolkit.oasv.compatibility.factory;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import java.util.List;
-
-import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.api.ExampleDiffValidator;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringRunner;
-
-@RunWith(SpringRunner.class)
-@ContextConfiguration(classes = DiffValidatorFactoryTestConfiguration.class)
-public class DefaultExampleDiffValidatorFactoryTest {
-
-  @Autowired
-  private DefaultExampleDiffValidatorFactory validatorFactory;
-
-  @Test
-  public void create() {
-    List<ExampleDiffValidator> validators = validatorFactory.create();
-    assertThat(validators).isEmpty();
-  }
-}
diff --git 
a/oas-validator/oas-validator-core-spring/src/main/java/org/apache/servicecomb/toolkit/oasv/diffvalidation/config/OasDiffValidatorsSkeletonConfiguration.java
 
b/oas-validator/oas-validator-core-spring/src/main/java/org/apache/servicecomb/toolkit/oasv/diffvalidation/config/OasDiffValidatorsSkeletonConfiguration.java
index 9d2b8eb..8518099 100755
--- 
a/oas-validator/oas-validator-core-spring/src/main/java/org/apache/servicecomb/toolkit/oasv/diffvalidation/config/OasDiffValidatorsSkeletonConfiguration.java
+++ 
b/oas-validator/oas-validator-core-spring/src/main/java/org/apache/servicecomb/toolkit/oasv/diffvalidation/config/OasDiffValidatorsSkeletonConfiguration.java
@@ -17,13 +17,46 @@
 
 package org.apache.servicecomb.toolkit.oasv.diffvalidation.config;
 
-import org.apache.servicecomb.toolkit.oasv.diffvalidation.api.*;
-import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.skeleton.components.*;
+import java.util.List;
+
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.api.CallbackDiffValidator;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.api.ComponentsDiffValidator;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.api.DefaultOasSpecDiffValidator;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.api.EncodingDiffValidator;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.api.HeaderDiffValidator;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.api.InfoDiffValidator;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.api.LinkDiffValidator;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.api.MediaTypeDiffValidator;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.api.OasSpecDiffValidator;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.api.OpenApiDiffValidator;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.api.OperationDiffValidator;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.api.ParameterDiffValidator;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.api.PathItemDiffValidator;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.api.PathsDiffValidator;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.api.RequestBodyDiffValidator;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.api.ResponseDiffValidator;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.api.ResponsesDiffValidator;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.api.SchemaAddValidator;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.api.SchemaCompareValidator;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.api.SchemaDelValidator;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.api.SchemaDiffValidator;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.api.ServerDiffValidator;
+import org.apache.servicecomb.toolkit.oasv.diffvalidation.api.TagDiffValidator;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.skeleton.components.ComponentsCallbacksDiffValidator;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.skeleton.components.ComponentsHeadersDiffValidator;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.skeleton.components.ComponentsLinksDiffValidator;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.skeleton.components.ComponentsParametersDiffValidator;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.skeleton.components.ComponentsRequestBodiesDiffValidator;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.skeleton.components.ComponentsResponsesDiffValidator;
 import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.skeleton.encoding.EncodingHeadersDiffValidator;
 import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.skeleton.header.HeaderSchemaDiffValidator;
 import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.skeleton.mediatype.MediaTypeEncodingDiffValidator;
 import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.skeleton.mediatype.MediaTypeSchemaDiffValidator;
-import org.apache.servicecomb.toolkit.oasv.diffvalidation.skeleton.openapi.*;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.skeleton.openapi.OpenApiComponentsDiffValidator;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.skeleton.openapi.OpenApiInfoDiffValidator;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.skeleton.openapi.OpenApiPathsDiffValidator;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.skeleton.openapi.OpenApiServersDiffValidator;
+import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.skeleton.openapi.OpenApiTagsDiffValidator;
 import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.skeleton.operation.OperationParametersDiffValidator;
 import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.skeleton.operation.OperationRequestBodyDiffValidator;
 import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.skeleton.operation.OperationResponsesDiffValidator;
@@ -40,8 +73,6 @@ import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.skeleton.schema.Schema
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
-import java.util.List;
-
 @Configuration
 public class OasDiffValidatorsSkeletonConfiguration {
 
@@ -57,12 +88,6 @@ public class OasDiffValidatorsSkeletonConfiguration {
   }
 
   @Bean
-  public ComponentsDiffValidator componentsExamplesDiffValidator(
-    List<ExampleDiffValidator> diffValidators) {
-    return new ComponentsExamplesDiffValidator(diffValidators);
-  }
-
-  @Bean
   public ComponentsDiffValidator componentsHeadersDiffValidator(
     List<HeaderDiffValidator> diffValidators) {
     return new ComponentsHeadersDiffValidator(diffValidators);
diff --git 
a/oas-validator/oas-validator-core/src/main/java/org/apache/servicecomb/toolkit/oasv/diffvalidation/api/ExampleDiffValidator.java
 
b/oas-validator/oas-validator-core/src/main/java/org/apache/servicecomb/toolkit/oasv/diffvalidation/api/ExampleDiffValidator.java
deleted file mode 100755
index 59fd890..0000000
--- 
a/oas-validator/oas-validator-core/src/main/java/org/apache/servicecomb/toolkit/oasv/diffvalidation/api/ExampleDiffValidator.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.toolkit.oasv.diffvalidation.api;
-
-import io.swagger.v3.oas.models.examples.Example;
-
-public interface ExampleDiffValidator extends OasObjectDiffValidator<Example> {
-}
diff --git 
a/oas-validator/oas-validator-core/src/main/java/org/apache/servicecomb/toolkit/oasv/diffvalidation/factory/ExampleDiffValidatorFactory.java
 
b/oas-validator/oas-validator-core/src/main/java/org/apache/servicecomb/toolkit/oasv/diffvalidation/factory/ExampleDiffValidatorFactory.java
deleted file mode 100755
index 237179c..0000000
--- 
a/oas-validator/oas-validator-core/src/main/java/org/apache/servicecomb/toolkit/oasv/diffvalidation/factory/ExampleDiffValidatorFactory.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.toolkit.oasv.diffvalidation.factory;
-
-import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.api.ExampleDiffValidator;
-
-public interface ExampleDiffValidatorFactory extends 
OasObjectDiffValidatorFactory<ExampleDiffValidator> {
-}
diff --git 
a/oas-validator/oas-validator-core/src/main/java/org/apache/servicecomb/toolkit/oasv/diffvalidation/skeleton/components/ComponentsExamplesDiffValidator.java
 
b/oas-validator/oas-validator-core/src/main/java/org/apache/servicecomb/toolkit/oasv/diffvalidation/skeleton/components/ComponentsExamplesDiffValidator.java
deleted file mode 100755
index 42e86bb..0000000
--- 
a/oas-validator/oas-validator-core/src/main/java/org/apache/servicecomb/toolkit/oasv/diffvalidation/skeleton/components/ComponentsExamplesDiffValidator.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.toolkit.oasv.diffvalidation.skeleton.components;
-
-import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.api.ComponentsDiffValidator;
-import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.api.ExampleDiffValidator;
-import 
org.apache.servicecomb.toolkit.oasv.diffvalidation.api.MapPropertyDiffValidator;
-import org.apache.servicecomb.toolkit.oasv.common.OasObjectType;
-import io.swagger.v3.oas.models.Components;
-import io.swagger.v3.oas.models.examples.Example;
-
-import java.util.List;
-import java.util.Map;
-
-import static org.apache.servicecomb.toolkit.oasv.common.OasObjectType.EXAMPLE;
-
-public class ComponentsExamplesDiffValidator
-  extends MapPropertyDiffValidator<Components, Example>
-  implements ComponentsDiffValidator {
-
-  public ComponentsExamplesDiffValidator(List<ExampleDiffValidator> 
diffValidators) {
-    super(diffValidators);
-  }
-
-  @Override
-  protected Map<String, Example> getMapProperty(Components oasObject) {
-    return oasObject.getExamples();
-  }
-
-  @Override
-  protected String getMapPropertyName() {
-    return "examples";
-  }
-
-  @Override
-  protected OasObjectType getValueType() {
-    return EXAMPLE;
-  }
-}

Reply via email to