Skip to content

Commit

Permalink
Merge 657b8b6 into 61a51d9
Browse files Browse the repository at this point in the history
  • Loading branch information
jungan21 committed Jun 6, 2020
2 parents 61a51d9 + 657b8b6 commit 81b82be
Show file tree
Hide file tree
Showing 16 changed files with 603 additions and 912 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?xml version="1.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.
-->

<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<artifactId>demo-zeroconfig-schemadiscovery-registry-client</artifactId>
<name>Java Chassis::Demo::ZeroConfig-SchemaDiscovery Registry Client</name>
<parent>
<groupId>org.apache.servicecomb.demo</groupId>
<artifactId>demo-zeroconfig-schemadiscovery-registry</artifactId>
<version>2.1.0-SNAPSHOT</version>
</parent>

<properties>
<demo.main>org.apache.servicecomb.demo.zeroconfig.Application</demo.main>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.servicecomb</groupId>
<artifactId>java-chassis-spring-boot-starter-servlet</artifactId>
</dependency>
<dependency>
<groupId>org.apache.servicecomb.demo</groupId>
<artifactId>demo-schema</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.github.odavid.maven.plugins</groupId>
<artifactId>mixin-maven-plugin</artifactId>
<configuration>
<mixins>
<mixin>
<groupId>org.apache.servicecomb.demo</groupId>
<artifactId>docker-run-config</artifactId>
<version>${project.version}</version>
</mixin>
</mixins>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>docker</id>
<properties>
<demo.service.name>demo-multi-registries-server</demo.service.name>
</properties>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>


Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* 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.demo.zeroconfig;

import org.apache.servicecomb.demo.CategorizedTestCaseRunner;
import org.apache.servicecomb.demo.TestMgr;
import org.apache.servicecomb.springboot2.starter.EnableServiceComb;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;

@SpringBootApplication
@EnableServiceComb
public class Application {

public static void main(final String[] args) throws Exception {
new SpringApplicationBuilder().sources(Application.class).web(WebApplicationType.SERVLET)
.build().run(args);

runTest();

TestMgr.summary();
if (!TestMgr.errors().isEmpty()) {
throw new IllegalStateException("tests failed");
}
}

private static void runTest() throws Exception {
CategorizedTestCaseRunner
.runCategorizedTestCase("demo-zeroconfig-schemadiscovery-registry-server");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* 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.demo.zeroconfig;

import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.servicecomb.demo.CategorizedTestCase;
import org.apache.servicecomb.demo.TestMgr;
import org.apache.servicecomb.provider.springmvc.reference.RestTemplateBuilder;
import org.apache.servicecomb.registry.DiscoveryManager;
import org.apache.servicecomb.registry.api.registry.Microservice;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

@Component
public class ServerTest implements CategorizedTestCase {

RestTemplate template = RestTemplateBuilder.create();

@Override
public void testRestTransport() {
testServerGetName();
testGetAllMicroservice();
}

private void testGetAllMicroservice() {
List<Microservice> microserviceList = DiscoveryManager.INSTANCE.getAllMicroservices();
Set<String> names = new HashSet<>();

for (Microservice m : microserviceList) {
if (m.getServiceName().equals("demo-zeroconfig-schemadiscovery-registry-client")
|| m.getServiceName().equals("demo-zeroconfig-schemadiscovery-registry-server")) {
names.add(m.getServiceName());
}
}
TestMgr.check(2, names.size());
}

private void testServerGetName() {
// invoke demo-zeroconfig-schemadiscovery-registry-server
TestMgr.check("2", template
.getForObject(
"cse://demo-zeroconfig-schemadiscovery-registry-server/register/url/prefix/getName?name=2",
String.class));
}

@Override
public void testHighwayTransport() throws Exception {

}

@Override
public void testAllTransport() throws Exception {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## ---------------------------------------------------------------------------
## 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.
## ---------------------------------------------------------------------------

server:
port: 8082

# java-chassis configurations

APPLICATION_ID: demo-zeroconfig-schemadiscovery-registry
service_description:
name: demo-zeroconfig-schemadiscovery-registry-client
version: 0.0.2
servicecomb:
handler:
chain:
Consumer:
default: loadbalance
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->

<configuration scan="true">
<appender name="STDOUT-TRACING" class="ch.qos.logback.core.ConsoleAppender">
<!-- If applicable, can use ch.qos.logback.classic.filter.MarkerFilter -->
<filter class="org.apache.servicecomb.foundation.logback.MarkerFilter">
<Marker>SERVICECOMB_MARKER</Marker>
<OnMismatch>DENY</OnMismatch>
<OnMatch>ACCEPT</OnMatch>
</filter>

<encoder>
<pattern>%d [%level] [%thread][%X{SERVICECOMB_TRACE_ID}] - %msg (%F:%L\)%n</pattern>
</encoder>
</appender>

<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- If applicable, can use ch.qos.logback.classic.filter.MarkerFilter -->
<filter class="org.apache.servicecomb.foundation.logback.MarkerFilter">
<Marker>SERVICECOMB_MARKER</Marker>
<OnMismatch>ACCEPT</OnMismatch>
<OnMatch>DENY</OnMatch>
</filter>

<encoder>
<pattern>%d [%level] [%thread] - %msg (%F:%L\)%n</pattern>
</encoder>
</appender>

<root level="info">
<appender-ref ref="STDOUT"/>
<appender-ref ref="STDOUT-TRACING"/>
</root>
</configuration>
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?xml version="1.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.
-->

<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<artifactId>demo-zeroconfig-schemadiscovery-registry-server</artifactId>
<name>Java Chassis::Demo::ZeroConfig-SchemaDiscovery Registry Server</name>
<parent>
<groupId>org.apache.servicecomb.demo</groupId>
<artifactId>demo-zeroconfig-schemadiscovery-registry</artifactId>
<version>2.1.0-SNAPSHOT</version>
</parent>

<properties>
<demo.main>org.apache.servicecomb.demo.zeroconfig.ServerApplication</demo.main>
</properties>
<dependencies>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.servicecomb</groupId>
<artifactId>java-chassis-spring-boot-starter-servlet</artifactId>
</dependency>
<dependency>
<groupId>org.apache.servicecomb.demo</groupId>
<artifactId>demo-schema</artifactId>
</dependency>

</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.github.odavid.maven.plugins</groupId>
<artifactId>mixin-maven-plugin</artifactId>
<configuration>
<mixins>
<mixin>
<groupId>org.apache.servicecomb.demo</groupId>
<artifactId>docker-build-config</artifactId>
<version>${project.version}</version>
</mixin>
</mixins>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>docker</id>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.commonjava.maven.plugins</groupId>
<artifactId>directory-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

0 comments on commit 81b82be

Please sign in to comment.