You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by sp...@apache.org on 2021/05/19 03:34:12 UTC
[apisix-java-plugin-runner] branch main updated: add code checker
(#2)
This is an automated email from the ASF dual-hosted git repository.
spacewander pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git
The following commit(s) were added to refs/heads/main by this push:
new 4b41047 add code checker (#2)
4b41047 is described below
commit 4b41047f3c01ad21bfefc0ed7a457445433f967b
Author: Daming <zt...@foxmail.com>
AuthorDate: Wed May 19 11:34:07 2021 +0800
add code checker (#2)
---
.github/workflows/ci.yaml | 52 ++++++++++++++++++++++
pom.xml | 3 +-
.../runner/handler/A6HandlerConfiguration.java | 2 +-
.../server/config/TcpServerConfiguration.java | 7 ---
.../apisix/plugin/runner/service/CacheService.java | 39 ----------------
.../apisix/plugin/runner/A6HttpCallResponse.java | 2 -
.../org/apache/apisix/plugin/runner/A6Request.java | 1 -
.../apache/apisix/plugin/runner/HttpRequest.java | 8 ++--
.../apache/apisix/plugin/runner/HttpResponse.java | 4 +-
.../apisix/plugin/runner/HttpStopResponse.java | 6 +--
runner-starter/src/main/resources/application.yaml | 15 +++++++
src/main/checkstyle/checkstyle.xml | 2 +-
12 files changed, 78 insertions(+), 63 deletions(-)
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
new file mode 100644
index 0000000..2f15a7a
--- /dev/null
+++ b/.github/workflows/ci.yaml
@@ -0,0 +1,52 @@
+# 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.
+
+name: CI
+
+on:
+ pull_request:
+ push:
+ branches:
+ - master
+ tags:
+ - 'v*'
+
+jobs:
+ CI:
+ runs-on: ubuntu-18.04
+ timeout-minutes: 180
+ strategy:
+ fail-fast: true
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/setup-java@v1
+ with:
+ java-version: 8
+ - name: 'Install & Test'
+ run: mvn clean install
+
+ CI-on-MacOS:
+ runs-on: macos-latest
+ timeout-minutes: 180
+ strategy:
+ fail-fast: true
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/setup-java@v1
+ with:
+ java-version: 8
+ - name: 'Install & Test'
+ run: ./mvnw clean install
diff --git a/pom.xml b/pom.xml
index 7f98f56..c7beacb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -152,8 +152,7 @@
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.0</version>
<configuration>
- <!-- disable checkstyle temporary -->
- <skip>true</skip>
+ <skip>false</skip>
<configLocation>${maven.multiModuleProjectDirectory}/src/main/checkstyle/checkstyle.xml</configLocation>
<headerLocation>${maven.multiModuleProjectDirectory}/src/main/checkstyle/HEADER</headerLocation>
<encoding>UTF-8</encoding>
diff --git a/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/A6HandlerConfiguration.java b/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/A6HandlerConfiguration.java
index 859ae37..4b85ff4 100644
--- a/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/A6HandlerConfiguration.java
+++ b/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/A6HandlerConfiguration.java
@@ -67,7 +67,7 @@ public class A6HandlerConfiguration {
@Bean
public Dispatcher createDispatcher(A6ConfigHandler configHandler, A6HttpCallHandler httpCallHandler) {
- return (request) -> {
+ return request -> {
A6Response response;
switch (request.getType()) {
case 0:
diff --git a/runner-core/src/main/java/org/apache/apisix/plugin/runner/server/config/TcpServerConfiguration.java b/runner-core/src/main/java/org/apache/apisix/plugin/runner/server/config/TcpServerConfiguration.java
index bb4cff9..a6a4537 100644
--- a/runner-core/src/main/java/org/apache/apisix/plugin/runner/server/config/TcpServerConfiguration.java
+++ b/runner-core/src/main/java/org/apache/apisix/plugin/runner/server/config/TcpServerConfiguration.java
@@ -17,9 +17,7 @@
package org.apache.apisix.plugin.runner.server.config;
-import io.netty.channel.unix.DomainSocketAddress;
import org.springframework.beans.factory.ObjectProvider;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import reactor.netty.tcp.TcpServer;
@@ -42,10 +40,5 @@ public class TcpServerConfiguration {
}
return server;
}
-//
-// @Bean
-// public TcpServerCustomizer configureHandler(@Value("${runner.server.socket.file:/tmp/runner.socks") String socketFile) {
-// return tcpServer -> tcpServer.bindAddress(() -> new DomainSocketAddress(socketFile));
-// }
}
diff --git a/runner-core/src/main/java/org/apache/apisix/plugin/runner/service/CacheService.java b/runner-core/src/main/java/org/apache/apisix/plugin/runner/service/CacheService.java
deleted file mode 100644
index f4b6018..0000000
--- a/runner-core/src/main/java/org/apache/apisix/plugin/runner/service/CacheService.java
+++ /dev/null
@@ -1,39 +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.apisix.plugin.runner.service;
-
-import com.google.common.cache.Cache;
-import com.google.common.cache.CacheBuilder;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Service;
-
-import java.time.Duration;
-import java.util.Properties;
-
-@Service
-public class CacheService {
-
- @Value("${conf.cache.expire:5000}")
- private long expiredOnMills;
-
- private Cache<String, Properties> configMap;
-
- public void build() {
-
- }
-}
diff --git a/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/A6HttpCallResponse.java b/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/A6HttpCallResponse.java
index 865f02e..98fb2c6 100644
--- a/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/A6HttpCallResponse.java
+++ b/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/A6HttpCallResponse.java
@@ -28,12 +28,10 @@ public class A6HttpCallResponse implements A6Response {
private final Map<String, String> parameters;
-
public A6HttpCallResponse(int requestId, Map<String, String> parameters, Map<String, String> headers) {
this.requestId = requestId;
this.headers = headers;
this.parameters = parameters;
-
}
@Override
diff --git a/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/A6Request.java b/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/A6Request.java
index 8cedf12..dd24742 100644
--- a/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/A6Request.java
+++ b/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/A6Request.java
@@ -23,7 +23,6 @@ public interface A6Request {
return false;
}
-
int getConfToken();
default int getType() {
diff --git a/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/HttpRequest.java b/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/HttpRequest.java
index 22a1464..8e5163e 100644
--- a/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/HttpRequest.java
+++ b/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/HttpRequest.java
@@ -18,7 +18,6 @@
package org.apache.apisix.plugin.runner;
import io.github.api7.A6.HTTPReqCall.Req;
-import io.netty.buffer.ByteBuf;
import java.nio.ByteBuffer;
import java.util.Enumeration;
@@ -58,7 +57,7 @@ public class HttpRequest implements A6Request {
}
public String getSourceIP() {
- return ""; // TODO
+ return "";
}
public Method getMethod() {
@@ -66,7 +65,7 @@ public class HttpRequest implements A6Request {
}
public String getPath() {
- return req.path(); // FiXME
+ return req.path();
}
public String getParameter(String name) {
@@ -82,7 +81,7 @@ public class HttpRequest implements A6Request {
}
public String[] getParameterValues(String name) {
- return null; // todo
+ return null;
}
@Override
@@ -94,7 +93,6 @@ public class HttpRequest implements A6Request {
return new HttpRequest(Req.getRootAsReq(buffer));
}
-
public enum Method {
GET,
HEAD,
diff --git a/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/HttpResponse.java b/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/HttpResponse.java
index 8068a96..1ed4688 100644
--- a/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/HttpResponse.java
+++ b/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/HttpResponse.java
@@ -26,8 +26,8 @@ import java.util.Objects;
/**
* table Resp {
- * id:uint32;
- * action:Action;
+ * id:uint32;
+ * action:Action;
* }
*/
@Data
diff --git a/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/HttpStopResponse.java b/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/HttpStopResponse.java
index 079a0a2..bc5dbcb 100644
--- a/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/HttpStopResponse.java
+++ b/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/HttpStopResponse.java
@@ -19,9 +19,9 @@ package org.apache.apisix.plugin.runner;
/**
* table Stop {
- * status:uint16;
- * headers:[TextEntry];
- * body:[ubyte];
+ * status:uint16;
+ * headers:[TextEntry];
+ * body:[ubyte];
* }
*/
@Deprecated
diff --git a/runner-starter/src/main/resources/application.yaml b/runner-starter/src/main/resources/application.yaml
index 4a82fb3..2dec244 100644
--- a/runner-starter/src/main/resources/application.yaml
+++ b/runner-starter/src/main/resources/application.yaml
@@ -1,3 +1,18 @@
+# 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.
+
logging:
level:
root: debug
diff --git a/src/main/checkstyle/checkstyle.xml b/src/main/checkstyle/checkstyle.xml
index 920aa92..6cd3658 100644
--- a/src/main/checkstyle/checkstyle.xml
+++ b/src/main/checkstyle/checkstyle.xml
@@ -96,7 +96,7 @@
<property name="format" value="(^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$)"/>
</module>
<module name="PackageName">
- <property name="format" value="^org\.apache\.apisix\.plugin\.runner(\.[a-zA-Z][a-zA-Z0-9]*)+$"/>
+ <property name="format" value="^org\.apache\.apisix\.plugin\.runner(\.[a-zA-Z][a-zA-Z0-9]*)*$"/>
</module>
<module name="ParameterName"/>
<module name="StaticVariableName">