ing
This commit is contained in:
parent
43d2a34c60
commit
49f54ef0e3
49
.classpath
Normal file
49
.classpath
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="src" output="target/classes" path="target/generated-sources/protobuf/java">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="src" output="target/classes" path="target/generated-sources/protobuf/grpc-java">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/proto">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
<attribute name="test" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
|
</classpath>
|
23
.project
Normal file
23
.project
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>central_api</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
4
.settings/org.eclipse.core.resources.prefs
Normal file
4
.settings/org.eclipse.core.resources.prefs
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
encoding//src/main/proto=UTF-8
|
||||||
|
encoding//src/main/resources=UTF-8
|
||||||
|
encoding/<project>=UTF-8
|
5
.settings/org.eclipse.jdt.core.prefs
Normal file
5
.settings/org.eclipse.jdt.core.prefs
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.8
|
4
.settings/org.eclipse.m2e.core.prefs
Normal file
4
.settings/org.eclipse.m2e.core.prefs
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
activeProfiles=
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
resolveWorkspaceProjects=true
|
||||||
|
version=1
|
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"java.configuration.updateBuildConfiguration": "automatic"
|
||||||
|
}
|
|
@ -1,18 +1,18 @@
|
||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// source: server_grpc.proto
|
// source: central-api.proto
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Package server_grpc is a generated protocol buffer package.
|
Package central_api is a generated protocol buffer package.
|
||||||
|
|
||||||
It is generated from these files:
|
It is generated from these files:
|
||||||
server_grpc.proto
|
central-api.proto
|
||||||
|
|
||||||
It has these top-level messages:
|
It has these top-level messages:
|
||||||
ServerInput
|
ServerInput
|
||||||
ServerParam
|
ServerParam
|
||||||
ServerOutput
|
ServerOutput
|
||||||
*/
|
*/
|
||||||
package server_grpc
|
package central_api
|
||||||
|
|
||||||
import proto "github.com/golang/protobuf/proto"
|
import proto "github.com/golang/protobuf/proto"
|
||||||
import fmt "fmt"
|
import fmt "fmt"
|
||||||
|
@ -128,87 +128,88 @@ var _ grpc.ClientConn
|
||||||
// is compatible with the grpc package it is being compiled against.
|
// is compatible with the grpc package it is being compiled against.
|
||||||
const _ = grpc.SupportPackageIsVersion4
|
const _ = grpc.SupportPackageIsVersion4
|
||||||
|
|
||||||
// Client API for OverflowApiServer service
|
// Client API for CentralAPI service
|
||||||
|
|
||||||
type OverflowApiServerClient interface {
|
type CentralAPIClient interface {
|
||||||
Exec(ctx context.Context, in *ServerInput, opts ...grpc.CallOption) (*ServerOutput, error)
|
Exec(ctx context.Context, in *ServerInput, opts ...grpc.CallOption) (*ServerOutput, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type overflowApiServerClient struct {
|
type centralAPIClient struct {
|
||||||
cc *grpc.ClientConn
|
cc *grpc.ClientConn
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewOverflowApiServerClient(cc *grpc.ClientConn) OverflowApiServerClient {
|
func NewCentralAPIClient(cc *grpc.ClientConn) CentralAPIClient {
|
||||||
return &overflowApiServerClient{cc}
|
return ¢ralAPIClient{cc}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *overflowApiServerClient) Exec(ctx context.Context, in *ServerInput, opts ...grpc.CallOption) (*ServerOutput, error) {
|
func (c *centralAPIClient) Exec(ctx context.Context, in *ServerInput, opts ...grpc.CallOption) (*ServerOutput, error) {
|
||||||
out := new(ServerOutput)
|
out := new(ServerOutput)
|
||||||
err := grpc.Invoke(ctx, "/OverflowApiServer/exec", in, out, c.cc, opts...)
|
err := grpc.Invoke(ctx, "/CentralAPI/exec", in, out, c.cc, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Server API for OverflowApiServer service
|
// Server API for CentralAPI service
|
||||||
|
|
||||||
type OverflowApiServerServer interface {
|
type CentralAPIServer interface {
|
||||||
Exec(context.Context, *ServerInput) (*ServerOutput, error)
|
Exec(context.Context, *ServerInput) (*ServerOutput, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func RegisterOverflowApiServerServer(s *grpc.Server, srv OverflowApiServerServer) {
|
func RegisterCentralAPIServer(s *grpc.Server, srv CentralAPIServer) {
|
||||||
s.RegisterService(&_OverflowApiServer_serviceDesc, srv)
|
s.RegisterService(&_CentralAPI_serviceDesc, srv)
|
||||||
}
|
}
|
||||||
|
|
||||||
func _OverflowApiServer_Exec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
func _CentralAPI_Exec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(ServerInput)
|
in := new(ServerInput)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if interceptor == nil {
|
if interceptor == nil {
|
||||||
return srv.(OverflowApiServerServer).Exec(ctx, in)
|
return srv.(CentralAPIServer).Exec(ctx, in)
|
||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: "/OverflowApiServer/Exec",
|
FullMethod: "/CentralAPI/Exec",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(OverflowApiServerServer).Exec(ctx, req.(*ServerInput))
|
return srv.(CentralAPIServer).Exec(ctx, req.(*ServerInput))
|
||||||
}
|
}
|
||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _OverflowApiServer_serviceDesc = grpc.ServiceDesc{
|
var _CentralAPI_serviceDesc = grpc.ServiceDesc{
|
||||||
ServiceName: "OverflowApiServer",
|
ServiceName: "CentralAPI",
|
||||||
HandlerType: (*OverflowApiServerServer)(nil),
|
HandlerType: (*CentralAPIServer)(nil),
|
||||||
Methods: []grpc.MethodDesc{
|
Methods: []grpc.MethodDesc{
|
||||||
{
|
{
|
||||||
MethodName: "exec",
|
MethodName: "exec",
|
||||||
Handler: _OverflowApiServer_Exec_Handler,
|
Handler: _CentralAPI_Exec_Handler,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{},
|
Streams: []grpc.StreamDesc{},
|
||||||
Metadata: "server_grpc.proto",
|
Metadata: "central-api.proto",
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { proto.RegisterFile("server_grpc.proto", fileDescriptor0) }
|
func init() { proto.RegisterFile("central-api.proto", fileDescriptor0) }
|
||||||
|
|
||||||
var fileDescriptor0 = []byte{
|
var fileDescriptor0 = []byte{
|
||||||
// 240 bytes of a gzipped FileDescriptorProto
|
// 241 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x90, 0x3d, 0x4f, 0xc3, 0x30,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x90, 0xb1, 0x4e, 0xc3, 0x30,
|
||||||
0x10, 0x40, 0x31, 0xa9, 0x2a, 0x38, 0xc2, 0x50, 0x0f, 0x10, 0x31, 0xa0, 0xc8, 0x12, 0xa8, 0x93,
|
0x10, 0x40, 0x31, 0xa9, 0x2a, 0x38, 0xc2, 0x80, 0x07, 0x14, 0xb1, 0x10, 0x59, 0xa2, 0xea, 0x82,
|
||||||
0x07, 0xd8, 0xd8, 0x80, 0x89, 0xa9, 0x55, 0x11, 0x03, 0x13, 0x32, 0xe9, 0xb5, 0x44, 0x72, 0x7a,
|
0x07, 0xfa, 0x05, 0xd0, 0xa9, 0x13, 0x51, 0x11, 0x03, 0xa3, 0x49, 0xaf, 0x10, 0xc9, 0xc9, 0x59,
|
||||||
0x96, 0x73, 0x29, 0xf0, 0x0f, 0xf8, 0xd9, 0xc8, 0x1f, 0xa0, 0x76, 0xbb, 0xf7, 0x24, 0x3f, 0x9d,
|
0xce, 0xa5, 0xc0, 0x1f, 0xf0, 0xd9, 0xc8, 0xb1, 0x41, 0x61, 0xbb, 0xf7, 0x86, 0xa7, 0xbb, 0x83,
|
||||||
0x0f, 0x26, 0x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0xb5, 0x58, 0x73, 0x43, 0x5d, 0x91, 0x95, 0x62, 0x79, 0xb2, 0xfd, 0xe7, 0xd4, 0x02,
|
||||||
0x65, 0x4a, 0xcf, 0x06, 0xce, 0x2b, 0x7b, 0xec, 0x07, 0xfb, 0xbf, 0x72, 0xa2, 0x9b, 0x3b, 0x98,
|
0xf2, 0x98, 0x7e, 0x1c, 0x38, 0xad, 0xec, 0xb1, 0x1f, 0xec, 0xdf, 0xca, 0x91, 0xee, 0x56, 0x00,
|
||||||
0xcc, 0xb6, 0xe8, 0x57, 0x96, 0x3e, 0xef, 0x5d, 0x9b, 0x9e, 0xc8, 0x2b, 0x18, 0xe1, 0x17, 0x36,
|
0xeb, 0x78, 0xee, 0x7d, 0xb5, 0x91, 0x37, 0x30, 0xc3, 0x4f, 0xac, 0x65, 0xae, 0x27, 0xe7, 0x5e,
|
||||||
0xb2, 0xd4, 0x3b, 0xbf, 0xbe, 0x38, 0xd5, 0xbb, 0x45, 0x75, 0xf0, 0x70, 0x09, 0xe7, 0x0d, 0x75,
|
0x9d, 0xeb, 0x69, 0x4a, 0x1d, 0x3d, 0x2c, 0xe0, 0xba, 0xa6, 0x56, 0x5b, 0x32, 0x7b, 0x8b, 0x9a,
|
||||||
0xda, 0x92, 0x59, 0x59, 0xd4, 0x94, 0x33, 0xda, 0xb8, 0x76, 0x2e, 0x7e, 0x84, 0x78, 0x1f, 0xc7,
|
0x0e, 0xe8, 0xf7, 0x96, 0x3e, 0x74, 0xfa, 0x9b, 0x36, 0xae, 0xa9, 0xc4, 0xb7, 0x10, 0xaf, 0xf3,
|
||||||
0xe3, 0xdd, 0xfe, 0x06, 0x00, 0x00, 0xff, 0xff, 0x11, 0xfd, 0x20, 0xaf, 0x51, 0x01, 0x00, 0x00,
|
0xf1, 0x7b, 0xab, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6c, 0xcd, 0x0f, 0x07, 0x52, 0x01, 0x00,
|
||||||
|
0x00,
|
||||||
}
|
}
|
|
@ -1,10 +1,11 @@
|
||||||
package server_grpc
|
package central_api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
|
||||||
"google.golang.org/grpc"
|
|
||||||
"golang.org/x/net/context"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
"google.golang.org/grpc"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestTarDis_saveAllTarget(t *testing.T) {
|
func TestTarDis_saveAllTarget(t *testing.T) {
|
||||||
|
@ -23,10 +24,8 @@ func TestTarDis_saveAllTarget(t *testing.T) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func TestRPCNP_readAllByDomain(t *testing.T) {
|
func TestRPCNP_readAllByDomain(t *testing.T) {
|
||||||
|
|
||||||
|
|
||||||
si := &ServerInput{}
|
si := &ServerInput{}
|
||||||
|
|
||||||
si.Target = "NoAuthProbeService"
|
si.Target = "NoAuthProbeService"
|
8
pom.xml
8
pom.xml
|
@ -5,16 +5,16 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.loafle</groupId>
|
<groupId>com.loafle.maven</groupId>
|
||||||
<artifactId>maven_parent_jar</artifactId>
|
<artifactId>maven_parent_jar</artifactId>
|
||||||
<version>1.0.0-RELEASE</version>
|
<version>1.0.0-RELEASE</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>com.loafle</groupId>
|
<groupId>com.loafle.overflow</groupId>
|
||||||
<artifactId>central_api</artifactId>
|
<artifactId>central-api</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
<name>com.loafle.central_api</name>
|
<name>com.loafle.overflow.central-api</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<grpc.version>1.2.0</grpc.version>
|
<grpc.version>1.2.0</grpc.version>
|
||||||
|
|
21
src/main/proto/build
Executable file
21
src/main/proto/build
Executable file
|
@ -0,0 +1,21 @@
|
||||||
|
|
||||||
|
# https://github.com/google/protobuf/releases
|
||||||
|
# Unzip
|
||||||
|
#unzip protoc-3.3.0-linux-x86_64.zip -d protoc3
|
||||||
|
|
||||||
|
# Move protoc to /usr/local/bin/
|
||||||
|
#sudo mv protoc3/bin/* /usr/local/bin/
|
||||||
|
|
||||||
|
# Move protoc3/include to /usr/local/include/
|
||||||
|
#sudo mv protoc3/include/* /usr/local/include/
|
||||||
|
|
||||||
|
# For go
|
||||||
|
#go get -u github.com/golang/protobuf/protoc-gen-go
|
||||||
|
|
||||||
|
# Optional: change owner
|
||||||
|
#sudo chown $USER /usr/local/bin/protoc
|
||||||
|
#sudo chown -R $USER /usr/local/include/google
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protoc -I src/main/proto/ src/main/proto/central-api.proto --go_out=plugins=grpc:golang
|
|
@ -1,7 +1,7 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
option java_multiple_files = true;
|
option java_multiple_files = true;
|
||||||
option java_package = "com.loafle.overflow.api";
|
option java_package = "com.loafle.overflow.central.api";
|
||||||
option java_generic_services = true;
|
option java_generic_services = true;
|
||||||
|
|
||||||
message ServerInput {
|
message ServerInput {
|
||||||
|
@ -20,7 +20,7 @@ message ServerOutput {
|
||||||
string result = 1;
|
string result = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
service OverflowApiServer {
|
service CentralAPI {
|
||||||
rpc exec(ServerInput) returns (ServerOutput) {}
|
rpc exec(ServerInput) returns (ServerOutput) {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
protoc -I src/main/proto/ src/main/proto/server_grpc.proto --go_out=plugins=grpc:golang
|
|
Loading…
Reference in New Issue
Block a user