Skip to content

Commit

Permalink
Merge 9484e2b into 4eda42b
Browse files Browse the repository at this point in the history
  • Loading branch information
little-cui committed Nov 17, 2017
2 parents 4eda42b + 9484e2b commit 5e3a228
Show file tree
Hide file tree
Showing 55 changed files with 1,419 additions and 1,129 deletions.
1 change: 0 additions & 1 deletion etc/conf/app.conf
Expand Up @@ -46,7 +46,6 @@ auth_plugin = ""

#support om, manage
auditlog_plugin = ""
audit_log_dir = ""

#Rate-limit options
#ttl=m, s, ms
Expand Down
2 changes: 1 addition & 1 deletion integration/microservices_test.go
Expand Up @@ -207,7 +207,7 @@ var _ = Describe("MicroService Api Test", func() {
resp, _ := scclient.Do(req)
respbody, _ := ioutil.ReadAll(resp.Body)
Expect(resp.StatusCode).To(Equal(http.StatusOK))
Expect(string(respbody)).To(Equal("{}"))
Expect(strings.TrimSpace(string(respbody))).To(Equal("{}"))
})
})

Expand Down
10 changes: 7 additions & 3 deletions integration/rules_test.go
Expand Up @@ -183,13 +183,17 @@ var _ = Describe("MicroService Api Test", func() {
Expect(resp.StatusCode).To(Equal(http.StatusOK))

//Duplicate Request
bodyBuf = bytes.NewReader(body)
req, _ = http.NewRequest(POST, SCURL+url, bodyBuf)
req.Header.Set("X-Domain-Name", "default")
resp, err = scclient.Do(req)
Expect(err).To(BeNil())
defer resp.Body.Close()

Expect(resp.StatusCode).To(Equal(http.StatusBadRequest))
Expect(resp.StatusCode).To(Equal(http.StatusOK))

respbody, _ := ioutil.ReadAll(resp.Body)
Expect(strings.TrimSpace(string(respbody))).To(Equal("{}"))
})
})

Expand Down Expand Up @@ -243,7 +247,7 @@ var _ = Describe("MicroService Api Test", func() {
resp, _ := scclient.Do(req)
respbody, _ := ioutil.ReadAll(resp.Body)
Expect(resp.StatusCode).To(Equal(http.StatusOK))
Expect(string(respbody)).To(Equal("{}"))
Expect(strings.TrimSpace(string(respbody))).To(Equal("{}"))
})

It("Get Rules for Invalid MicroService", func() {
Expand Down Expand Up @@ -482,7 +486,7 @@ var _ = Describe("MicroService Api Test", func() {
resp, _ = scclient.Do(req)
respbody, _ = ioutil.ReadAll(resp.Body)
Expect(resp.StatusCode).To(Equal(http.StatusOK))
Expect(string(respbody)).To(Equal("{}"))
Expect(strings.TrimSpace(string(respbody))).To(Equal("{}"))
})

It("Delete MicroService rules with non-exsisting ruleID", func() {
Expand Down
5 changes: 2 additions & 3 deletions pkg/rest/common.go
Expand Up @@ -19,8 +19,7 @@ import (
"encoding/pem"
"github.com/ServiceComb/service-center/pkg/tlsutil"
"github.com/ServiceComb/service-center/pkg/util"
"github.com/ServiceComb/service-center/server/infra/security"
"github.com/astaxie/beego"
"github.com/ServiceComb/service-center/server/plugin"
"io/ioutil"
"time"
)
Expand Down Expand Up @@ -67,7 +66,7 @@ func getX509CACertPool() (caCertPool *x509.CertPool, err error) {
func loadTLSCertificate() (tlsCert []tls.Certificate, err error) {
certFile, keyFile := tlsutil.GetServerSSLConfig().CertFile, tlsutil.GetServerSSLConfig().KeyFile
passphase := tlsutil.GetServerSSLConfig().KeyPassphase
plainPassphase, err := security.CipherPlugins[beego.AppConfig.DefaultString("cipher_plugin", "default")]().Decrypt(passphase)
plainPassphase, err := plugin.Plugins().Cipher().Decrypt(passphase)
if err != nil {
util.Logger().Errorf(err, "decrypt ssl passphase(%d) failed.", len(passphase))
plainPassphase = ""
Expand Down
5 changes: 5 additions & 0 deletions pkg/uuid/uuid.go
Expand Up @@ -18,6 +18,7 @@ import (
"encoding/binary"
"encoding/hex"
"net"
"strings"
"sync"
"time"
"unsafe"
Expand Down Expand Up @@ -165,3 +166,7 @@ func NewV1() UUID {

return u
}

func GenerateUuid() string {
return strings.Replace(NewV1().String(), string(DASH), "", -1)
}
18 changes: 13 additions & 5 deletions server/bootstrap/bootstrap.go
Expand Up @@ -14,21 +14,29 @@
package bootstrap

import _ "github.com/ServiceComb/service-center/server/core" // initialize
// cipher
import _ "github.com/ServiceComb/service-center/server/plugin/infra/security/plain"

// rest
import _ "github.com/ServiceComb/service-center/server/rest/controller/v3"
import _ "github.com/ServiceComb/service-center/server/rest/controller/v4"

// registry
import _ "github.com/ServiceComb/service-center/server/core/registry/etcd"
import _ "github.com/ServiceComb/service-center/server/core/registry/embededetcd"

// rest
import _ "github.com/ServiceComb/service-center/server/rest/controller/v3"
import _ "github.com/ServiceComb/service-center/server/rest/controller/v4"
// cipher
import _ "github.com/ServiceComb/service-center/server/plugin/infra/security/buildin"

// quota
import _ "github.com/ServiceComb/service-center/server/plugin/infra/quota/buildin"
import _ "github.com/ServiceComb/service-center/server/plugin/infra/quota/unlimit"

// auth
import _ "github.com/ServiceComb/service-center/server/plugin/infra/auth/buildin"
import _ "github.com/ServiceComb/service-center/server/plugin/infra/auth/dynamic"

// uuid
import _ "github.com/ServiceComb/service-center/server/plugin/infra/uuid/dynamic"

import (
"github.com/ServiceComb/service-center/pkg/util"
"github.com/ServiceComb/service-center/server/handler/auth"
Expand Down
4 changes: 3 additions & 1 deletion server/core/proto/services.go
Expand Up @@ -46,6 +46,8 @@ const (
EXISTENCE_SCHEMA string = "schema"

PROP_ALLOW_CROSS_APP = "allowCrossApp"

Response_SUCCESS int32 = 0
)

type SerivceInstanceCtrlServerEx interface {
Expand All @@ -68,7 +70,7 @@ type SystemConfig struct {
Version string `json:"version"`
}

func CreateResponse(code Response_Code, message string) *Response {
func CreateResponse(code int32, message string) *Response {
resp := &Response{
Code: code,
Message: message,
Expand Down

0 comments on commit 5e3a228

Please sign in to comment.