Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 105 additions & 0 deletions demo/demo-model-field-ignore/ignore-client/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2017 Huawei Technologies Co., Ltd
~
~ Licensed 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 xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>demo-model-field-ignore</artifactId>
<groupId>io.servicecomb.demo</groupId>
<version>0.4.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>ignore-client</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>io.servicecomb</groupId>
<artifactId>provider-springmvc</artifactId>
</dependency>
<dependency>
<groupId>io.servicecomb.demo</groupId>
<artifactId>demo-schema</artifactId>
</dependency>
<dependency>
<groupId>io.servicecomb.demo</groupId>
<artifactId>ignore-contract</artifactId>
<version>0.4.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.servicecomb</groupId>
<artifactId>provider-pojo</artifactId>
</dependency>
<dependency>
<groupId>io.servicecomb</groupId>
<artifactId>foundation-common</artifactId>
</dependency>
<dependency>
<groupId>io.servicecomb</groupId>
<artifactId>provider-rest-common</artifactId>
</dependency>
</dependencies>

<properties>
<demo.main>io.servicecomb.demo.ignore.AllTestClient</demo.main>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.github.odavid.maven.plugins</groupId>
<artifactId>mixin-maven-plugin</artifactId>
<configuration>
<mixins>
<mixin>
<groupId>io.servicecomb.demo</groupId>
<artifactId>docker-run-config</artifactId>
<version>0.4.0-SNAPSHOT</version>
</mixin>
</mixins>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>docker</id>
<properties>
<demo.service.name>ignore-server</demo.service.name>
<demo.vm.options>
-Dcse.rest.address=0.0.0.0:8080?sslEnabled=false
</demo.vm.options>
</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,37 @@
/*
* Copyright 2017 Huawei Technologies Co., Ltd
*
* Licensed 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 io.servicecomb.demo.ignore;

import io.servicecomb.demo.TestMgr;
import io.servicecomb.foundation.common.utils.BeanUtils;
import io.servicecomb.foundation.common.utils.Log4jUtils;

public class AllTestClient {
public static void main(String[] args) throws Exception {
Log4jUtils.init();
BeanUtils.init();

run();

TestMgr.summary();
}

public static void run() throws Exception {
IgnoreRestClient.run();
IgnoreRpcClient.run();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright 2017 Huawei Technologies Co., Ltd
*
* Licensed 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 io.servicecomb.demo.ignore;

import org.springframework.web.client.RestTemplate;

import io.servicecomb.demo.TestMgr;
import io.servicecomb.foundation.common.utils.BeanUtils;
import io.servicecomb.foundation.common.utils.Log4jUtils;
import io.servicecomb.provider.springmvc.reference.RestTemplateBuilder;

public class IgnoreRestClient {
public static void main(String[] args) throws Exception {
Log4jUtils.init();
BeanUtils.init();

run();

TestMgr.summary();
}

public static void run() throws Exception {
InputModelForTestIgnore input = new InputModelForTestIgnore("input_id_rest", "input_id_content");
RestTemplate restTemplate = RestTemplateBuilder.create();

OutputModelForTestIgnore output = restTemplate
.postForObject("cse://testModelIgnoreServer/", input, OutputModelForTestIgnore.class);

TestMgr.check(null, output.getInputId());
TestMgr.check(input.getContent(), output.getContent());
TestMgr.check(null, output.getOutputId());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright 2017 Huawei Technologies Co., Ltd
*
* Licensed 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 io.servicecomb.demo.ignore;

import org.springframework.stereotype.Component;

import io.servicecomb.demo.TestMgr;
import io.servicecomb.foundation.common.utils.BeanUtils;
import io.servicecomb.foundation.common.utils.Log4jUtils;
import io.servicecomb.provider.pojo.RpcReference;

@Component
public class IgnoreRpcClient {
@RpcReference(microserviceName = "testModelIgnoreServer", schemaId = "ignoreServiceProvider")
private static Service service;

public static void main(String[] args) throws Exception {
Log4jUtils.init();
BeanUtils.init();

run();

TestMgr.summary();
}

public static void run() throws Exception {
InputModelForTestIgnore input = new InputModelForTestIgnore("input_id_rpc", "input_content_rpc");

OutputModelForTestIgnore output = service.test(input);

TestMgr.check(null, output.getInputId());
TestMgr.check(input.getContent(), output.getContent());
TestMgr.check(null, output.getOutputId());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
APPLICATION_ID: demoIgnore
service_description:
name: testModelIgnoreClient
version: 0.0.1
cse:
service:
registry:
address: http://127.0.0.1:30100
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright 2017 Huawei Technologies Co., Ltd
*
* Licensed 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 io.servicecomb.demo.ignore;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;

import org.junit.Before;
import org.junit.Test;

import io.servicecomb.demo.TestMgr;

public class IgnoreIT {
@Before
public void setUp() throws Exception {
TestMgr.errors().clear();
}

@Test
public void clientGetsNoError() throws Exception {
AllTestClient.main(new String[0]);

assertThat(TestMgr.errors().isEmpty(), is(true));
}
}
36 changes: 36 additions & 0 deletions demo/demo-model-field-ignore/ignore-contract/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2017 Huawei Technologies Co., Ltd
~
~ Licensed 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 xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>demo-model-field-ignore</artifactId>
<groupId>io.servicecomb.demo</groupId>
<version>0.4.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>ignore-contract</artifactId>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright 2017 Huawei Technologies Co., Ltd
*
* Licensed 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 io.servicecomb.demo.ignore;

import com.fasterxml.jackson.annotation.JsonIgnore;

public class InputModelForTestIgnore {
@JsonIgnore
private String inputId = null;

private String content = null;

public String getInputId() {
return this.inputId;
}

public void setInputId(String inputId) {
this.inputId = inputId;
}

public String getContent() {
return this.content;
}

public void setContent(String content) {
this.content = content;
}

public InputModelForTestIgnore() {
}

public InputModelForTestIgnore(String inputId, String content) {
this.inputId = inputId;
this.content = content;
}
}
Loading