Skip to content
Snippets Groups Projects
Commit 94f05b97 authored by wongoo's avatar wongoo
Browse files

fix: java exception & unit test

parent 37b82ce2
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,7 @@ package main
import (
"context"
"fmt"
"github.com/dubbogo/hessian2/java_exception"
"strconv"
"time"
)
......@@ -172,7 +173,7 @@ func (u *UserProvider) GetUser3() error {
}
func (u *UserProvider) GetErr(ctx context.Context, req []interface{}, rsp *User) error {
return hessian.NewThrowable("exception")
return java_exception.NewThrowable("exception")
}
func (u *UserProvider) GetUsers(req []interface{}) ([]interface{}, error) {
......
......@@ -20,6 +20,7 @@ package main
import (
"context"
"fmt"
"github.com/dubbogo/hessian2/java_exception"
"strconv"
"time"
)
......@@ -146,7 +147,7 @@ func (u *UserProvider) GetUser(ctx context.Context, req []interface{}, rsp *User
}
func (u *UserProvider) GetErr(ctx context.Context, req []interface{}, rsp *User) error {
return hessian.NewThrowable("exception")
return java_exception.NewThrowable("exception")
}
func (u *UserProvider) GetUser0(id string, name string) (User, error) {
......
......@@ -3,7 +3,7 @@ module github.com/apache/dubbo-go
require (
github.com/dubbogo/getty v1.0.7
github.com/dubbogo/gost v1.0.0
github.com/dubbogo/hessian2 v1.1.1
github.com/dubbogo/hessian2 v1.1.2
github.com/magiconair/properties v1.8.1
github.com/pkg/errors v0.8.1
github.com/samuel/go-zookeeper v0.0.0-20180130194729-c4fab1ac1bec
......
......@@ -217,7 +217,6 @@ func (c *Client) call(ct CallType, addr string, svcUrl common.URL, method string
p := &DubboPackage{}
p.Service.Path = strings.TrimPrefix(svcUrl.Path, "/")
p.Service.Target = svcUrl.GetParam(constant.INTERFACE_KEY, "")
p.Service.Interface = svcUrl.GetParam(constant.INTERFACE_KEY, "")
p.Service.Version = svcUrl.GetParam(constant.VERSION_KEY, "")
p.Service.Method = method
......
......@@ -49,7 +49,6 @@ func TestDubboPackage_MarshalAndUnmarshal(t *testing.T) {
// request
pkg.Header.Type = hessian.PackageRequest
pkg.Service.Interface = "Service"
pkg.Service.Target = "Service"
pkg.Service.Version = "2.6"
pkg.Service.Method = "Method"
pkg.Service.Timeout = time.Second
......@@ -64,10 +63,10 @@ func TestDubboPackage_MarshalAndUnmarshal(t *testing.T) {
assert.Equal(t, byte(S_Dubbo), pkgres.Header.SerialID)
assert.Equal(t, int64(10086), pkgres.Header.ID)
assert.Equal(t, "2.5.4", pkgres.Body.([]interface{})[0])
assert.Equal(t, "Service", pkgres.Body.([]interface{})[1])
assert.Equal(t, "", pkgres.Body.([]interface{})[1])
assert.Equal(t, "2.6", pkgres.Body.([]interface{})[2])
assert.Equal(t, "Method", pkgres.Body.([]interface{})[3])
assert.Equal(t, "Ljava/lang/String;", pkgres.Body.([]interface{})[4])
assert.Equal(t, []interface{}{"a"}, pkgres.Body.([]interface{})[5])
assert.Equal(t, map[interface{}]interface{}{"interface": "Service", "path": "", "timeout": "1000"}, pkgres.Body.([]interface{})[6])
assert.Equal(t, map[interface{}]interface{}{"interface": "Service", "path": "", "group": "", "timeout": "1000"}, pkgres.Body.([]interface{})[6])
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment