Skip to content

Commit

Permalink
[type: feature] replenish alibaba-dubbo syn method (#4931)
Browse files Browse the repository at this point in the history
* replenish alibaba-dubbo syn method 01

* replenish alibaba-dubbo syn method 02

* replenish alibaba-dubbo syn method 03

* replenish alibaba-dubbo syn method 04

* replenish alibaba-dubbo syn method 05

* replenish alibaba-dubbo syn method 06

* replenish alibaba-dubbo syn method 07

* replenish alibaba-dubbo syn method 08

* replenish alibaba-dubbo syn method 09

* replenish alibaba-dubbo syn method 10

---------

Co-authored-by: dragon-zhang <[email protected]>
  • Loading branch information
HaiqiQin and loongs-zhang committed Aug 2, 2023
1 parent 3082629 commit 4271cb8
Show file tree
Hide file tree
Showing 13 changed files with 313 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* 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.shenyu.e2e.testcase.alibabadubbo;

import com.fasterxml.jackson.core.JsonProcessingException;
import org.apache.shenyu.e2e.client.admin.AdminClient;
import org.apache.shenyu.e2e.client.gateway.GatewayClient;
import org.apache.shenyu.e2e.engine.annotation.ShenYuTest;
import org.apache.shenyu.e2e.engine.config.ShenYuEngineConfigure;
import org.apache.shenyu.e2e.model.data.MetaData;
import org.apache.shenyu.e2e.model.data.RuleCacheData;
import org.apache.shenyu.e2e.model.data.SelectorCacheData;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import java.util.List;

/**
* Testing the correctness of Http data synchronization method.
*/
@ShenYuTest(
mode = ShenYuEngineConfigure.Mode.DOCKER,
services = {
@ShenYuTest.ServiceConfigure(
serviceName = "admin",
port = 9095,
baseUrl = "http://{hostname:localhost}:9095",
parameters = {
@ShenYuTest.Parameter(key = "username", value = "admin"),
@ShenYuTest.Parameter(key = "password", value = "123456"),
@ShenYuTest.Parameter(key = "dataSyn", value = "admin_http")
}
),
@ShenYuTest.ServiceConfigure(
serviceName = "gateway",
port = 9195,
baseUrl = "http://{hostname:localhost}:9195",
type = ShenYuEngineConfigure.ServiceType.SHENYU_GATEWAY,
parameters = {
@ShenYuTest.Parameter(key = "dataSyn", value = "gateway_http")
}
)
},
dockerComposeFile = "classpath:./docker-compose.mysql.yml"
)
public class DataSynHttpTest {

@Test
void testDataSyn(final AdminClient adminClient, final GatewayClient gatewayClient) throws InterruptedException, JsonProcessingException {
adminClient.login();
Thread.sleep(10000);
List<MetaData> metaDataCacheList = gatewayClient.getMetaDataCache();
List<SelectorCacheData> selectorCacheList = gatewayClient.getSelectorCache();
List<RuleCacheData> ruleCacheList = gatewayClient.getRuleCache();
Assertions.assertEquals(1, selectorCacheList.size());
Assertions.assertEquals(25, metaDataCacheList.size());
Assertions.assertEquals(25, ruleCacheList.size());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* 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.shenyu.e2e.testcase.alibabadubbo;

import com.fasterxml.jackson.core.JsonProcessingException;
import org.apache.shenyu.e2e.client.admin.AdminClient;
import org.apache.shenyu.e2e.client.gateway.GatewayClient;
import org.apache.shenyu.e2e.engine.annotation.ShenYuTest;
import org.apache.shenyu.e2e.engine.annotation.ShenYuTest.Parameter;
import org.apache.shenyu.e2e.engine.config.ShenYuEngineConfigure;
import org.apache.shenyu.e2e.model.data.MetaData;
import org.apache.shenyu.e2e.model.data.RuleCacheData;
import org.apache.shenyu.e2e.model.data.SelectorCacheData;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import java.util.List;

/**
* Testing the correctness of Nacos data synchronization method.
*/
@ShenYuTest(
mode = ShenYuEngineConfigure.Mode.DOCKER,
services = {
@ShenYuTest.ServiceConfigure(
serviceName = "admin",
port = 9095,
baseUrl = "http://{hostname:localhost}:9095",
parameters = {
@Parameter(key = "username", value = "admin"),
@Parameter(key = "password", value = "123456"),
@Parameter(key = "dataSyn", value = "nacos")
}
),
@ShenYuTest.ServiceConfigure(
serviceName = "gateway",
port = 9195,
baseUrl = "http://{hostname:localhost}:9195",
type = ShenYuEngineConfigure.ServiceType.SHENYU_GATEWAY,
parameters = {
@Parameter(key = "dataSyn", value = "nacos")
}
)
},
dockerComposeFile = "classpath:./docker-compose.mysql.yml"
)
public class DataSynNacosTest {

@Test
void testDataSyn(final AdminClient adminClient, final GatewayClient gatewayClient) throws InterruptedException, JsonProcessingException {
adminClient.login();
Thread.sleep(10000);
List<MetaData> metaDataCacheList = gatewayClient.getMetaDataCache();
List<SelectorCacheData> selectorCacheList = gatewayClient.getSelectorCache();
List<RuleCacheData> ruleCacheList = gatewayClient.getRuleCache();
Assertions.assertEquals(1, selectorCacheList.size());
Assertions.assertEquals(25, metaDataCacheList.size());
Assertions.assertEquals(25, ruleCacheList.size());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* 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.shenyu.e2e.testcase.alibabadubbo;

import com.fasterxml.jackson.core.JsonProcessingException;
import org.apache.shenyu.e2e.client.admin.AdminClient;
import org.apache.shenyu.e2e.client.gateway.GatewayClient;
import org.apache.shenyu.e2e.engine.annotation.ShenYuTest;
import org.apache.shenyu.e2e.engine.config.ShenYuEngineConfigure;
import org.apache.shenyu.e2e.model.data.MetaData;
import org.apache.shenyu.e2e.model.data.RuleCacheData;
import org.apache.shenyu.e2e.model.data.SelectorCacheData;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import java.util.List;

/**
* Testing the correctness of Apollo data synchronization method.
*/
@ShenYuTest(
mode = ShenYuEngineConfigure.Mode.DOCKER,
services = {
@ShenYuTest.ServiceConfigure(
serviceName = "admin",
port = 9095,
baseUrl = "http://{hostname:localhost}:9095",
parameters = {
@ShenYuTest.Parameter(key = "username", value = "admin"),
@ShenYuTest.Parameter(key = "password", value = "123456"),
@ShenYuTest.Parameter(key = "dataSyn", value = "zookeeper")
}
),
@ShenYuTest.ServiceConfigure(
serviceName = "gateway",
port = 9195,
baseUrl = "http://{hostname:localhost}:9195",
type = ShenYuEngineConfigure.ServiceType.SHENYU_GATEWAY,
parameters = {
@ShenYuTest.Parameter(key = "dataSyn", value = "zookeeper")
}
)
},
dockerComposeFile = "classpath:./docker-compose.mysql.yml"
)
public class DataSynZookeeperTest {

@Test
void testDataSyn(final AdminClient adminClient, final GatewayClient gatewayClient) throws InterruptedException, JsonProcessingException {
adminClient.login();
Thread.sleep(10000);
List<MetaData> metaDataCacheList = gatewayClient.getMetaDataCache();
List<SelectorCacheData> selectorCacheList = gatewayClient.getSelectorCache();
List<RuleCacheData> ruleCacheList = gatewayClient.getRuleCache();
Assertions.assertEquals(1, selectorCacheList.size());
Assertions.assertEquals(25, metaDataCacheList.size());
Assertions.assertEquals(25, ruleCacheList.size());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,40 @@ services:
restart: always
expose:
- 2181
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/commands/stat"]
interval: 10s
timeout: 5s
retries: 3

nacos:
image: nacos/nacos-server:v2.2.3
environment:
- TZ=Asia/Shanghai
- MODE=standalone
expose:
- 8848
- 9848
- 9849
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8848/nacos/actuator/health"]
interval: 10s
timeout: 5s
retries: 3

admin:
image: shenyu/admin:latest
expose:
- 9095
ports:
- "9095:9095"
depends_on:
mysql:
condition: service_healthy
nacos:
condition: service_healthy
zookeeper:
condition: service_healthy
volumes:
- ../../target/test-classes/admin-application.yml:/opt/shenyu-admin/conf/application.yml
- /tmp/shenyu-e2e/mysql/mysql-connector.jar:/opt/shenyu-admin/ext-lib/mysql-connector.jar
Expand Down Expand Up @@ -59,7 +86,7 @@ services:
- dubbo.zk=zookeeper://zookeeper:2181
- shenyu.register.serverLists=http://admin:9095
depends_on:
gateway:
admin:
condition: service_healthy

gateway:
Expand All @@ -69,7 +96,7 @@ services:
ports:
- "9195:9195"
depends_on:
admin:
dubbo:
condition: service_healthy
volumes:
- ../../target/test-classes/bootstrap-application.yml:/opt/shenyu-bootstrap/conf/application.yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class DataSynHttpTest {
@Test
void testDataSyn(final AdminClient adminClient, final GatewayClient gatewayClient) throws InterruptedException, JsonProcessingException {
adminClient.login();
Thread.sleep(20000);
Thread.sleep(10000);
List<MetaData> metaDataCacheList = gatewayClient.getMetaDataCache();
List<SelectorCacheData> selectorCacheList = gatewayClient.getSelectorCache();
List<RuleCacheData> ruleCacheList = gatewayClient.getRuleCache();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class DataSynNacosTest {
@Test
void testDataSyn(final AdminClient adminClient, final GatewayClient gatewayClient) throws InterruptedException, JsonProcessingException {
adminClient.login();
Thread.sleep(20000);
Thread.sleep(10000);
List<MetaData> metaDataCacheList = gatewayClient.getMetaDataCache();
List<SelectorCacheData> selectorCacheList = gatewayClient.getSelectorCache();
List<RuleCacheData> ruleCacheList = gatewayClient.getRuleCache();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class DataSynZookeeperTest {
@Test
void testDataSyn(final AdminClient adminClient, final GatewayClient gatewayClient) throws InterruptedException, JsonProcessingException {
adminClient.login();
Thread.sleep(20000);
Thread.sleep(10000);
List<MetaData> metaDataCacheList = gatewayClient.getMetaDataCache();
List<SelectorCacheData> selectorCacheList = gatewayClient.getSelectorCache();
List<RuleCacheData> ruleCacheList = gatewayClient.getRuleCache();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ services:
zookeeper:
image: zookeeper:3.8
restart: always
expose:
- 2181
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/commands/stat"]
interval: 10s
timeout: 5s
retries: 3

nacos:
image: nacos/nacos-server:v2.2.3
Expand All @@ -31,17 +38,25 @@ services:
- 8848
- 9848
- 9849
ports:
- "8848:8848"
- "9848:9848"
- "9849:9849"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8848/nacos/actuator/health"]
interval: 10s
timeout: 5s
retries: 3

admin:
image: shenyu/admin:latest
expose:
- 9095
ports:
- "9095:9095"
depends_on:
mysql:
condition: service_healthy
nacos:
condition: service_healthy
zookeeper:
condition: service_healthy
environment:
- SPRING_PROFILES_ACTIVE=mysql
- spring.datasource.username=shenyue2e
Expand Down Expand Up @@ -81,7 +96,7 @@ services:
ports:
- "9195:9195"
depends_on:
admin:
dubbo:
condition: service_healthy
volumes:
- ../../target/test-classes/bootstrap-application.yml:/opt/shenyu-bootstrap/conf/application.yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class DataSynHttpTest {
@Test
void testDataSyn(final AdminClient adminClient, final GatewayClient gatewayClient) throws InterruptedException, JsonProcessingException {
adminClient.login();
Thread.sleep(20000);
Thread.sleep(10000);
List<MetaData> metaDataCacheList = gatewayClient.getMetaDataCache();
List<SelectorCacheData> selectorCacheList = gatewayClient.getSelectorCache();
List<RuleCacheData> ruleCacheList = gatewayClient.getRuleCache();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class DataSynNacosTest {
@Test
void testDataSyn(final AdminClient adminClient, final GatewayClient gatewayClient) throws InterruptedException, JsonProcessingException {
adminClient.login();
Thread.sleep(20000);
Thread.sleep(10000);
List<MetaData> metaDataCacheList = gatewayClient.getMetaDataCache();
List<SelectorCacheData> selectorCacheList = gatewayClient.getSelectorCache();
List<RuleCacheData> ruleCacheList = gatewayClient.getRuleCache();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class DataSynZookeeperTest {
@Test
void testDataSyn(final AdminClient adminClient, final GatewayClient gatewayClient) throws InterruptedException, JsonProcessingException {
adminClient.login();
Thread.sleep(20000);
Thread.sleep(10000);
List<MetaData> metaDataCacheList = gatewayClient.getMetaDataCache();
List<SelectorCacheData> selectorCacheList = gatewayClient.getSelectorCache();
List<RuleCacheData> ruleCacheList = gatewayClient.getRuleCache();
Expand Down
Loading

0 comments on commit 4271cb8

Please sign in to comment.