add sct-stater-polaris-router juint #682
parent
4ebfd3128f
commit
1fe74b687b
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Tencent is pleased to support the open source community by making Spring Cloud Tencent available.
|
||||
*
|
||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
*
|
||||
* Licensed under the BSD 3-Clause License (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
* 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 com.tencent.cloud.polaris.router.config;
|
||||
|
||||
import com.tencent.cloud.common.metadata.config.MetadataAutoConfiguration;
|
||||
import com.tencent.cloud.polaris.context.config.PolarisContextAutoConfiguration;
|
||||
import com.tencent.cloud.polaris.router.feign.RouterLabelFeignInterceptor;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* test for {@link FeignAutoConfiguration}.
|
||||
* @author dongyinuo
|
||||
*/
|
||||
public class FeignAutoConfigurationTests {
|
||||
|
||||
private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(
|
||||
MetadataAutoConfiguration.class,
|
||||
RouterAutoConfiguration.class,
|
||||
PolarisContextAutoConfiguration.class,
|
||||
FeignAutoConfiguration.class));
|
||||
|
||||
@Test
|
||||
public void routerLabelInterceptor() {
|
||||
contextRunner.run(context -> {
|
||||
assertThat(context).hasSingleBean(FeignAutoConfiguration.class);
|
||||
assertThat(context).hasSingleBean(RouterLabelFeignInterceptor.class);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
import static org.junit.Assert.*;
|
||||
public class LoadBalancerConfigurationTest {
|
||||
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
import static org.junit.Assert.*;
|
||||
public class RouterAutoConfigurationTests {
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Tencent is pleased to support the open source community by making Spring Cloud Tencent available.
|
||||
*
|
||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
*
|
||||
* Licensed under the BSD 3-Clause License (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
* 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 com.tencent.cloud.polaris.router.config.properties;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* test for {@link PolarisMetadataRouterProperties}.
|
||||
*/
|
||||
public class PolarisMetadataRouterPropertiesTests {
|
||||
|
||||
PolarisMetadataRouterProperties properties;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
properties = new PolarisMetadataRouterProperties();
|
||||
}
|
||||
|
||||
@Test
|
||||
void isEnabled() {
|
||||
assertThat(properties.isEnabled()).isEqualTo(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
void setEnabled() {
|
||||
properties.setEnabled(false);
|
||||
assertThat(properties.isEnabled()).isEqualTo(false);
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Tencent is pleased to support the open source community by making Spring Cloud Tencent available.
|
||||
*
|
||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
*
|
||||
* Licensed under the BSD 3-Clause License (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
* 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 com.tencent.cloud.polaris.router.config.properties;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
/**
|
||||
* test for {@link PolarisNearByRouterProperties}.
|
||||
*/
|
||||
public class PolarisNearByRouterPropertiesTests {
|
||||
|
||||
PolarisNearByRouterProperties properties;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
properties = new PolarisNearByRouterProperties();
|
||||
}
|
||||
|
||||
@Test
|
||||
void isEnabled() {
|
||||
assertThat(properties.isEnabled()).isEqualTo(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
void setEnabled() {
|
||||
properties.setEnabled(false);
|
||||
assertThat(properties.isEnabled()).isEqualTo(false);
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Tencent is pleased to support the open source community by making Spring Cloud Tencent available.
|
||||
*
|
||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
*
|
||||
* Licensed under the BSD 3-Clause License (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
* 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 com.tencent.cloud.polaris.router.config.properties;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* test for {@link PolarisRuleBasedRouterProperties}.
|
||||
*/
|
||||
public class PolarisRuleBasedRouterPropertiesTests {
|
||||
|
||||
PolarisRuleBasedRouterProperties properties;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
properties = new PolarisRuleBasedRouterProperties();
|
||||
}
|
||||
|
||||
@Test
|
||||
void isEnabled() {
|
||||
assertThat(properties.isEnabled()).isEqualTo(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
void setEnabled() {
|
||||
properties.setEnabled(false);
|
||||
assertThat(properties.isEnabled()).isEqualTo(false);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Tencent is pleased to support the open source community by making Spring Cloud Tencent available.
|
||||
*
|
||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
*
|
||||
* Licensed under the BSD 3-Clause License (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
* 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 com.tencent.cloud.polaris.router.endpoint;
|
||||
|
||||
import com.tencent.cloud.polaris.context.ServiceRuleManager;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
|
||||
/**
|
||||
* test for {@link PolarisRouterEndpointAutoConfiguration}.
|
||||
* @author dongyinuo
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class PolarisRouterEndpointAutoConfigurationTests {
|
||||
|
||||
@Mock
|
||||
private ServiceRuleManager manager;
|
||||
|
||||
@Test
|
||||
public void polarisRouterEndpoint() {
|
||||
PolarisRouterEndpoint endpoint = new PolarisRouterEndpoint(manager);
|
||||
System.out.println(endpoint.router("test"));
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
import static org.junit.Assert.*;
|
||||
public class PolarisLoadBalancerRequestTests {
|
||||
|
||||
}
|
Loading…
Reference in new issue