Skip to content

Commit

Permalink
Merge pull request #44 from chuntaojun/feature_auth_sys
Browse files Browse the repository at this point in the history
Feature auth sys
  • Loading branch information
lzp0412 authored Apr 12, 2020
2 parents 93f1451 + 56ea5a1 commit 3dc1d05
Show file tree
Hide file tree
Showing 298 changed files with 326 additions and 41,527 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea
.data
121 changes: 0 additions & 121 deletions Gopkg.lock

This file was deleted.

58 changes: 0 additions & 58 deletions Gopkg.toml

This file was deleted.

4 changes: 2 additions & 2 deletions clients/client_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func setConfig(properties map[string]interface{}) (iClient nacos_client.INacosCl
if clientConfig, ok := clientConfigTmp.(constant.ClientConfig); ok {
err = client.SetClientConfig(clientConfig)
if err != nil {
return
return nil, err
}
}
} else {
Expand All @@ -65,7 +65,7 @@ func setConfig(properties map[string]interface{}) (iClient nacos_client.INacosCl
if serverConfigs, ok := serverConfigTmp.([]constant.ServerConfig); ok {
err = client.SetServerConfig(serverConfigs)
if err != nil {
return
return nil, err
}
}
} else {
Expand Down
10 changes: 5 additions & 5 deletions clients/config_client/config_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func Test_GetConfigWithErrorResponse_401(t *testing.T) {
gomock.AssignableToTypeOf(http.Header{}),
gomock.Eq(clientConfigTest.TimeoutMs),
gomock.Eq(configParamMapTest),
).Times(3).Return(http_agent.FakeHttpResponse(401, "no auth"), nil)
).Times(3).Return(http_agent.FakeHttpResponse(401, "no security"), nil)
result, err := client.GetConfig(configParamTest)
assert.Nil(t, err)
fmt.Printf("result:%s \n", result)
Expand Down Expand Up @@ -206,7 +206,7 @@ func Test_GetConfigWithCache(t *testing.T) {
gomock.AssignableToTypeOf(http.Header{}),
gomock.Eq(clientConfigTest.TimeoutMs),
gomock.Eq(configParamMapTest),
).Times(3).Return(http_agent.FakeHttpResponse(401, "no auth"), nil)
).Times(3).Return(http_agent.FakeHttpResponse(401, "no security"), nil)
content, err = client.GetConfig(configParamTest)
assert.Nil(t, err)
assert.Equal(t, "content", content)
Expand Down Expand Up @@ -268,7 +268,7 @@ func Test_PublishConfigWithErrorResponse(t *testing.T) {
gomock.AssignableToTypeOf(http.Header{}),
gomock.Eq(clientConfigTest.TimeoutMs),
gomock.Eq(localConfigMapTest),
).Times(3).Return(http_agent.FakeHttpResponse(401, "no auth"), nil)
).Times(3).Return(http_agent.FakeHttpResponse(401, "no security"), nil)
success, err := client.PublishConfig(localConfigTest)
assert.NotNil(t, err)
assert.True(t, !success)
Expand Down Expand Up @@ -343,7 +343,7 @@ func Test_DeleteConfigWithErrorResponse_401(t *testing.T) {
gomock.AssignableToTypeOf(http.Header{}),
gomock.Eq(clientConfigTest.TimeoutMs),
gomock.Eq(configParamMapTest),
).Times(3).Return(http_agent.FakeHttpResponse(401, "no auth"), nil)
).Times(3).Return(http_agent.FakeHttpResponse(401, "no security"), nil)
success, err := client.DeleteConfig(configParamTest)
assert.NotNil(t, err)
assert.Equal(t, false, success)
Expand Down Expand Up @@ -581,7 +581,7 @@ func Test_listenWithErrorResponse_401(t *testing.T) {
gomock.AssignableToTypeOf(headerTest),
gomock.Eq(clientConfigTest.TimeoutMs),
gomock.Eq(param),
).Times(1).Return(http_agent.FakeHttpResponse(401, "no auth"), nil)
).Times(1).Return(http_agent.FakeHttpResponse(401, "no security"), nil)

_ = client.SetHttpAgent(mockHttpAgent)

Expand Down
2 changes: 1 addition & 1 deletion clients/config_client/config_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type ConfigProxy struct {
func NewConfigProxy(serverConfig []constant.ServerConfig, clientConfig constant.ClientConfig, httpAgent http_agent.IHttpAgent) (ConfigProxy, error) {
proxy := ConfigProxy{}
var err error
proxy.nacosServer, err = nacos_server.NewNacosServer(serverConfig, httpAgent, clientConfig.TimeoutMs, clientConfig.Endpoint)
proxy.nacosServer, err = nacos_server.NewNacosServer(serverConfig, clientConfig, httpAgent, clientConfig.TimeoutMs, clientConfig.Endpoint)
return proxy, err

}
Expand Down
3 changes: 1 addition & 2 deletions clients/naming_client/host_reator.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"github.com/nacos-group/nacos-sdk-go/clients/cache"
"github.com/nacos-group/nacos-sdk-go/model"
"github.com/nacos-group/nacos-sdk-go/utils"
nsema "github.com/toolkits/concurrent/semaphore"
"log"
"reflect"
"time"
Expand Down Expand Up @@ -131,7 +130,7 @@ func (hr *HostReactor) updateServiceNow(serviceName string, clusters string) {
}

func (hr *HostReactor) asyncUpdateService() {
sema := nsema.NewSemaphore(hr.updateThreadNum)
sema := utils.NewSemaphore(hr.updateThreadNum)
for {
for _, v := range hr.serviceInfoMap.Items() {
service := v.(model.Service)
Expand Down
Loading

0 comments on commit 3dc1d05

Please sign in to comment.