You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicecomb.apache.org by GitBox <gi...@apache.org> on 2018/02/03 05:57:31 UTC

[GitHub] little-cui closed pull request #271: SCB-317 Prepare the release for Service-Center-1.0.0-m1

little-cui closed pull request #271:  SCB-317 Prepare the release for Service-Center-1.0.0-m1
URL: https://github.com/apache/incubator-servicecomb-service-center/pull/271
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/NOTICE b/NOTICE
index 7572044b..7fe2cb6d 100644
--- a/NOTICE
+++ b/NOTICE
@@ -4,6 +4,29 @@ Copyright 2017-2018 The Apache Software Foundation
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).
 
+================================================================
+The Apache License Version 2.0
+================================================================
+The following components are provided under the  Apache License Version 2.0  (http://www.apache.org/licenses/). See project link for details.
+
+github.com/astaxie/beego
+github.com/cockroachdb/cmux
+github.com/coreos/etcd
+github.com/coreos/go-semver/semver
+github.com/coreos/go-systemd/journal
+github.com/coreos/pkg/capnslog
+google.golang.org/genproto/googleapis/rpc/status
+google.golang.org/grpc
+gopkg.in/yaml.v2
+github.com/google/btree
+github.com/grpc-ecosystem/go-grpc-prometheus
+github.com/jonboulle/clockwork
+github.com/matttproud/golang_protobuf_extensions/pbutil
+github.com/prometheus/client_golang/prometheus
+github.com/prometheus/client_model/go
+github.com/prometheus/common
+github.com/prometheus/procfs/xfs
+
 ================================================================
 The MIT License
 ================================================================
@@ -15,6 +38,10 @@ github.com/boltdb/bolt
 github.com/satori/go.uuid
 AngularJS v1.6.6 (http://angularjs.org)
 Bootstrap v3.3.7 (http://getbootstrap.com)
+Chart.js (https://github.com/chartjs/Chart.js)
+jquery (https://github.com/jquery/jquery)
+JSZip (https://github.com/Stuk/jszip)
+yaml.js (https://github.com/jeremyfa/yaml.js)
 
 ================================================================
 The BSD Licenses
@@ -68,3 +95,100 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
+
+================================================================
+Notice for coreos/etcd
+
+CoreOS Project
+Copyright 2014 CoreOS, Inc
+
+This product includes software developed at CoreOS, Inc.
+(http://www.coreos.com/).
+
+================================================================
+Notice for coreos/go-systemd
+
+CoreOS Project
+Copyright 2018 CoreOS, Inc
+
+This product includes software developed at CoreOS, Inc.
+(http://www.coreos.com/).
+
+================================================================
+Notice for coreos/go-semver
+
+CoreOS Project
+Copyright 2018 CoreOS, Inc
+
+This product includes software developed at CoreOS, Inc.
+(http://www.coreos.com/).
+
+================================================================
+Notice for coreos/pkg
+
+CoreOS Project
+Copyright 2014 CoreOS, Inc
+
+This product includes software developed at CoreOS, Inc.
+(http://www.coreos.com/).
+
+================================================================
+Notice for matttproud/golang_protobuf_extensions
+
+Copyright 2012 Matt T. Proud (matt.proud@gmail.com)
+
+================================================================
+Notice for prometheus/client_golang
+
+Prometheus instrumentation library for Go applications
+Copyright 2012-2015 The Prometheus Authors
+
+This product includes software developed at
+SoundCloud Ltd. (http://soundcloud.com/).
+
+
+The following components are included in this product:
+
+perks - a fork of https://github.com/bmizerany/perks
+https://github.com/beorn7/perks
+Copyright 2013-2015 Blake Mizerany, Bj?rn Rabenstein
+See https://github.com/beorn7/perks/blob/master/README.md for license details.
+
+Go support for Protocol Buffers - Google's data interchange format
+http://github.com/golang/protobuf/
+Copyright 2010 The Go Authors
+See source code for license details.
+
+Support for streaming Protocol Buffer messages for the Go language (golang).
+https://github.com/matttproud/golang_protobuf_extensions
+Copyright 2013 Matt T. Proud
+Licensed under the Apache License, Version 2.0
+
+================================================================
+Notice for prometheus/client_model
+
+Data model artifacts for Prometheus.
+Copyright 2012-2015 The Prometheus Authors
+
+This product includes software developed at
+SoundCloud Ltd. (http://soundcloud.com/).
+
+================================================================
+Notice for prometheus/common
+
+Common libraries shared by Prometheus Go components.
+Copyright 2015 The Prometheus Authors
+
+This product includes software developed at
+SoundCloud Ltd. (http://soundcloud.com/).
+
+================================================================
+Notice for prometheus/procfs
+
+procfs provides functions to retrieve system, kernel and process
+metrics from the pseudo-filesystem proc.
+
+Copyright 2014-2015 The Prometheus Authors
+
+This product includes software developed at
+SoundCloud Ltd. (http://soundcloud.com/).
diff --git a/integration/apis.go b/integration/apis.go
index beacbc64..2466015a 100644
--- a/integration/apis.go
+++ b/integration/apis.go
@@ -29,6 +29,7 @@ var UPDATEMICROSERVICE = "/v4/default/registry/microservices/:serviceId/properti
 var UNREGISTERMICROSERVICE = "/v4/default/registry/microservices/:serviceId?force=1"
 var GETSCHEMABYID = "/v4/default/registry/microservices/:serviceId/schemas/:schemaId"
 var UPDATESCHEMA = "/v4/default/registry/microservices/:serviceId/schemas/:schemaId"
+var GETSCHEMAS = "/v4/default/registry/microservices/:serviceId/schemas"
 var UPDATESCHEMAS = "/v4/default/registry/microservices/:serviceId/schemas"
 var DELETESCHEMA = "/v4/default/registry/microservices/:serviceId/schemas/:schemaId"
 var CREATEDEPENDENCIES = "/v4/default/registry/dependencies"
@@ -51,6 +52,7 @@ var INSTANCELISTWATCHER = "/v4/default/registry/microservices/:serviceId/listwat
 var GETGOVERNANCESERVICEDETAILS = "/v4/default/govern/microservices/:serviceId"
 var GETRELATIONGRAPH = "/v4/default/govern/relations"
 var GETALLSERVICEGOVERNANCEINFO = "/v4/default/govern/microservices"
+var GETALLAPPS = "/v4/default/govern/apps"
 
 //Rules API's
 var ADDRULE = "/v4/default/registry/microservices/:serviceId/rules"
diff --git a/integration/governance_test.go b/integration/governance_test.go
index f5e9a67b..2f592d7b 100644
--- a/integration/governance_test.go
+++ b/integration/governance_test.go
@@ -203,6 +203,30 @@ var _ = Describe("MicroService Api Test", func() {
 
 			})
 		})
+
+		By("Get All Apps by Governance API", func() {
+			It("Get All App Ids", func() {
+				req, _ := http.NewRequest(GET, SCURL+GETALLAPPS, nil)
+				req.Header.Set("X-Domain-Name", "default")
+				resp, err := scclient.Do(req)
+				Expect(err).To(BeNil())
+				defer resp.Body.Close()
+				respbody, _ := ioutil.ReadAll(resp.Body)
+				Expect(resp.StatusCode).To(Equal(http.StatusOK))
+				appIdsStruct := map[string][]string{}
+
+				json.Unmarshal(respbody, &appIdsStruct)
+				found := false
+				for _, appId := range appIdsStruct["appIds"] {
+					if strings.Index(appId, serviceAppId) == 0 {
+						found = true
+						break
+					}
+				}
+				Expect(found).To(Equal(true))
+
+			})
+		})
 	})
 
 })
diff --git a/integration/schema_test.go b/integration/schema_test.go
index 8d30b826..901dc36f 100644
--- a/integration/schema_test.go
+++ b/integration/schema_test.go
@@ -103,6 +103,15 @@ var _ = Describe("MicroService Api schema Test", func() {
 		defer resp.Body.Close()
 	})
 
+	It("get schemas", func() {
+		url := strings.Replace(GETSCHEMAS, ":serviceId", serviceId, 1)
+		req, _ := http.NewRequest(GET, SCURL+url, nil)
+		req.Header.Set("X-Domain-Name", "default")
+		resp, _ := scclient.Do(req)
+		Expect(resp.StatusCode).To(Equal(http.StatusOK))
+		defer resp.Body.Close()
+	})
+
 	It("delete schema", func() {
 		url := strings.Replace(DELETESCHEMA, ":serviceId", serviceId, 1)
 		url = strings.Replace(url, ":schemaId", "second_schemaId", 1)
diff --git a/pkg/tree/tree.go b/pkg/util/tree.go
similarity index 86%
rename from pkg/tree/tree.go
rename to pkg/util/tree.go
index ca3136ac..f847ab20 100644
--- a/pkg/tree/tree.go
+++ b/pkg/util/tree.go
@@ -1,8 +1,8 @@
-package tree
+package util
 
 //The tree is binary sort tree
 type tree struct {
-	root *Node
+	root        *Node
 	isAddToLeft func(node *Node, addRes interface{}) bool
 }
 
@@ -17,7 +17,7 @@ type Node struct {
 	left, right *Node
 }
 
-func (t *tree) GetRoot()*Node {
+func (t *tree) GetRoot() *Node {
 	return t.root
 }
 
@@ -26,7 +26,7 @@ func (t *tree) AddNode(res interface{}) *Node {
 	return t.addNode(t.root, res)
 }
 
-func (t *tree) addNode(n *Node, res interface{}) *Node{
+func (t *tree) addNode(n *Node, res interface{}) *Node {
 	if n == nil {
 		n = new(Node)
 		n.Res = res
@@ -64,4 +64,4 @@ func (t *tree) InOrderTraversal(n *Node, handle func(res interface{}) error) err
 	return nil
 }
 
-//todo add asynchronous handle handle func: go handle
\ No newline at end of file
+//todo add asynchronous handle handle func: go handle
diff --git a/pkg/tree/tree_test.go b/pkg/util/tree_test.go
similarity index 86%
rename from pkg/tree/tree_test.go
rename to pkg/util/tree_test.go
index 902b14a4..64e23399 100644
--- a/pkg/tree/tree_test.go
+++ b/pkg/util/tree_test.go
@@ -1,9 +1,9 @@
-package tree
+package util
 
 import (
 	"fmt"
-	"testing"
 	"reflect"
+	"testing"
 )
 
 func TestTree(t *testing.T) {
@@ -15,25 +15,23 @@ func TestTree(t *testing.T) {
 		}
 		return true
 	}
-	testSlice := []int{6,3,7,2,4,5}
-	targetSlice := []int{2,3,4,5,6,7}
+	testSlice := []int{6, 3, 7, 2, 4, 5}
+	targetSlice := []int{2, 3, 4, 5, 6, 7}
 	slice := testSlice[:0]
 	handle := func(res interface{}) error {
 		slice = append(slice, res.(int))
 		return nil
 	}
 
-
 	testTree := NewTree(compareFunc)
 
 	for _, v := range testSlice {
 		testTree.AddNode(v)
 	}
 
-
 	testTree.InOrderTraversal(testTree.GetRoot(), handle)
 	if !reflect.DeepEqual(slice, targetSlice) {
 		fmt.Printf(`TestTree failed`)
 		t.FailNow()
 	}
-}
\ No newline at end of file
+}
diff --git a/pkg/uuid/uuid.go b/pkg/util/uuid.go
similarity index 96%
rename from pkg/uuid/uuid.go
rename to pkg/util/uuid.go
index eb47fe07..198a5dae 100644
--- a/pkg/uuid/uuid.go
+++ b/pkg/util/uuid.go
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package uuid
+package util
 
 import (
-	"strings"
 	"github.com/satori/go.uuid"
+	"strings"
 )
 
-const DASH="-"
+const DASH = "-"
 
 func GenerateUuid() string {
 	return strings.Replace(uuid.NewV1().String(), string(DASH), "", -1)
-}
\ No newline at end of file
+}
diff --git a/scripts/create_gvt_manifest(exp).sh b/scripts/create_gvt_manifest(exp).sh
index 810be313..0160862d 100755
--- a/scripts/create_gvt_manifest(exp).sh
+++ b/scripts/create_gvt_manifest(exp).sh
@@ -74,3 +74,4 @@ gvt fetch -precaire -no-recurse -revision 6800482f2c813e689c88b7ed32822623850118
 gvt fetch -precaire -no-recurse -revision bb955e01b9346ac19dc29eb16586c90ded99a98c github.com/eapache/go-xerial-snappy
 gvt fetch -precaire -no-recurse -revision ded5959c0d4e360646dc9e9908cff48666781367 github.com/eapache/queue
 gvt fetch -precaire -no-recurse -revision cb6bfca970f6908083f26f39a79009d608efd5cd github.com/klauspost/crc32
+gvt fetch -precaire -no-recurse -revision 879c5887cd475cd7864858769793b2ceb0d44feb github.com/satori/go.uuid
diff --git a/server/plugin/infra/uuid/buildin/buildin.go b/server/plugin/infra/uuid/buildin/buildin.go
index e54ff8c7..b2796ea5 100644
--- a/server/plugin/infra/uuid/buildin/buildin.go
+++ b/server/plugin/infra/uuid/buildin/buildin.go
@@ -18,7 +18,7 @@
 package buildin
 
 import (
-	"github.com/apache/incubator-servicecomb-service-center/pkg/uuid"
+	"github.com/apache/incubator-servicecomb-service-center/pkg/util"
 	mgr "github.com/apache/incubator-servicecomb-service-center/server/plugin"
 )
 
@@ -38,7 +38,7 @@ func (du *BuildinUUID) GetServiceId() string {
 	if ok {
 		return df()
 	}
-	return uuid.GenerateUuid()
+	return util.GenerateUuid()
 }
 
 func (du *BuildinUUID) GetInstanceId() string {
@@ -46,5 +46,5 @@ func (du *BuildinUUID) GetInstanceId() string {
 	if ok {
 		return df()
 	}
-	return uuid.GenerateUuid()
+	return util.GenerateUuid()
 }
diff --git a/server/service/event/dependency_event_handler.go b/server/service/event/dependency_event_handler.go
index 67f2d465..7bbe5df8 100644
--- a/server/service/event/dependency_event_handler.go
+++ b/server/service/event/dependency_event_handler.go
@@ -30,7 +30,6 @@ import (
 	"github.com/coreos/etcd/mvcc/mvccpb"
 	"golang.org/x/net/context"
 	"time"
-	"github.com/apache/incubator-servicecomb-service-center/pkg/tree"
 )
 
 type DependencyEventHandler struct {
@@ -105,7 +104,7 @@ func NewDependencyEventHandlerResource(dep *pb.ConsumerDependency, kv *mvccpb.Ke
 	}
 }
 
-func isAddToLeft(centerNode *tree.Node, addRes interface{}) bool {
+func isAddToLeft(centerNode *util.Node, addRes interface{}) bool {
 	res := addRes.(*DependencyEventHandlerResource)
 	compareRes := centerNode.Res.(*DependencyEventHandlerResource)
 	if res.kv.ModRevision > compareRes.kv.ModRevision {
@@ -131,7 +130,7 @@ func (h *DependencyEventHandler) Handle() error {
 
 	ctx := context.Background()
 
-	dependencyTree := tree.NewTree(isAddToLeft)
+	dependencyTree := util.NewTree(isAddToLeft)
 
 	for _, kv := range resp.Kvs {
 		r := &pb.ConsumerDependency{}
@@ -162,7 +161,6 @@ func (h *DependencyEventHandler) dependencyRuleHandle(res interface{}) error {
 	r := dependencyEventHandlerRes.dep
 	consumerFlag := util.StringJoin([]string{r.Consumer.AppId, r.Consumer.ServiceName, r.Consumer.Version}, "/")
 
-
 	domainProject := dependencyEventHandlerRes.domainProject
 	consumerInfo := pb.DependenciesToKeys([]*pb.MicroServiceKey{r.Consumer}, domainProject)[0]
 	providersInfo := pb.DependenciesToKeys(r.Providers, domainProject)
diff --git a/server/service/rule.go b/server/service/rule.go
index 40609077..c4297957 100644
--- a/server/service/rule.go
+++ b/server/service/rule.go
@@ -19,7 +19,6 @@ package service
 import (
 	"encoding/json"
 	"github.com/apache/incubator-servicecomb-service-center/pkg/util"
-	"github.com/apache/incubator-servicecomb-service-center/pkg/uuid"
 	apt "github.com/apache/incubator-servicecomb-service-center/server/core"
 	"github.com/apache/incubator-servicecomb-service-center/server/core/backend"
 	pb "github.com/apache/incubator-servicecomb-service-center/server/core/proto"
@@ -102,7 +101,7 @@ func (s *MicroServiceService) AddRule(ctx context.Context, in *pb.AddServiceRule
 		// ????rule id
 		timestamp := strconv.FormatInt(time.Now().Unix(), 10)
 		ruleAdd := &pb.ServiceRule{
-			RuleId:       uuid.GenerateUuid(),
+			RuleId:       util.GenerateUuid(),
 			RuleType:     rule.RuleType,
 			Attribute:    rule.Attribute,
 			Pattern:      rule.Pattern,
diff --git a/server/service/service_dependency.go b/server/service/service_dependency.go
index 3e2d38f9..cd986085 100644
--- a/server/service/service_dependency.go
+++ b/server/service/service_dependency.go
@@ -20,7 +20,6 @@ import (
 	"encoding/json"
 	"fmt"
 	"github.com/apache/incubator-servicecomb-service-center/pkg/util"
-	"github.com/apache/incubator-servicecomb-service-center/pkg/uuid"
 	apt "github.com/apache/incubator-servicecomb-service-center/server/core"
 	"github.com/apache/incubator-servicecomb-service-center/server/core/backend"
 	pb "github.com/apache/incubator-servicecomb-service-center/server/core/proto"
@@ -51,7 +50,7 @@ func (s *MicroServiceService) AddOrUpdateDependencies(ctx context.Context, depen
 	opts := make([]registry.PluginOp, 0, len(dependencyInfos))
 	domainProject := util.ParseDomainProject(ctx)
 	for _, dependencyInfo := range dependencyInfos {
-		if (len(dependencyInfo.Providers) == 0  && !override) || dependencyInfo.Consumer == nil {
+		if (len(dependencyInfo.Providers) == 0 && !override) || dependencyInfo.Consumer == nil {
 			return serviceUtil.BadParamsResponse("Provider is invalid").Response, nil
 		}
 
@@ -88,7 +87,7 @@ func (s *MicroServiceService) AddOrUpdateDependencies(ctx context.Context, depen
 
 		id := "0"
 		if !override {
-			id = uuid.GenerateUuid()
+			id = util.GenerateUuid()
 		}
 		key := apt.GenerateConsumerDependencyQueueKey(domainProject, consumerId, id)
 		opts = append(opts, registry.OpPut(registry.WithStrKey(key), registry.WithValue(data)))


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services