remove mock server cmd, add test coverage to Jenkins
diff --git a/.travis.yml b/.travis.yml
index cf44163..43d50cf 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -14,4 +14,4 @@
script:
- diff -u <(echo -n) <(gofmt -d $(git ls-files | grep '.go$' | grep -v vendor))
- go vet $(glide novendor)
- - go test
+ - go test -covermode=atomic
diff --git a/cmd/mockServer/README.md b/cmd/mockServer/README.md
deleted file mode 100644
index fd65ee5..0000000
--- a/cmd/mockServer/README.md
+++ /dev/null
@@ -1,93 +0,0 @@
-# apidApigeeSync Mock Server
-
-## Overview
-
-This Mock Server is used during unit tests of apidApigeeSync and has been designed to be run standalone
-for stand-alone development use as well as performance and load testing.
-
-## Build
-
-From the apidApigeeSync base dir:
-
- glide install
-
-From apidApigeeSync/cmd/mockServer:
-
- go build
-
-You should now have an executable named "mockServer".
-
-## Execute
-
-Execute with the -h flag to see flags:
-
- ./mockServer -h
- Usage of ./mockServer:
- -addDevEach duration
- add a developer each duration (default 0s)
- -bundleURI string
- a URI to a valid deployment bundle (default '')
- -numDeps int
- number of deployments in snapshot (default 2)
- -numDevs int
- number of developers in snapshot (default 2)
- -reliable
- if false, server will often send 500 errors (default true)
- -upDepEach duration
- update (replace) a deployment each duration (default 0s)
- -upDevEach duration
- update a developer each duration (default 0s)
-
-Note: Nothing is required.
-
-The following are the values used by default by the Mock Server:
-
- ReliableAPI: true
- ClusterID: "cluster"
- TokenKey: "key"
- TokenSecret: "secret"
- Scope: "scope"
- Organization: "org"
- Environment: "test"
- NumDevelopers: 2
- AddDeveloperEvery: 0
- UpdateDeveloperEvery: 0
- NumDeployments: 2
- ReplaceDeploymentEvery: 0
- Port: 9001
-
-## Put it to use
-
-Set your apid configuration to point toward the Mock Server and have correct cluster, key, and secret values.
-
-For example:
-
- api_port: 9000
- api_expvar_path: /expvar
- events_buffer_size: 5
- log_level: debug
- apigeesync_proxy_server_base: http://localhost:9001
- apigeesync_snapshot_server_base: http://localhost:9001
- apigeesync_change_server_base: http://localhost:9001
- apigeesync_consumer_key: key
- apigeesync_consumer_secret: secret
- apigeesync_cluster_id: cluster
- #data_trace_log_level: debug
- data_source: file:%s?_busy_timeout=20000
-
-Now start apid. It should download the snapshot and changes as you configured for the Mock Server.
-
-Try out a couple of APIs to verify:
-
- curl -i -d "action=verify&key=1&uriPath=/&scopeuuid=scope" :9000/verifiers/apikey
-
- curl -i :9000/deployments
-
-## Notes
-
-Under high loads (eg. a large snapshot), apid may get timeout errors from sqlite.
-If you see this, you can work around it by increasing the _busy_timeout by adding a config item to your apid config:
-
- data_source: file:%s?_busy_timeout=10000
-
-The _busy_timeout value is in milliseconds, so the above value is 10s.
diff --git a/cmd/mockServer/main.go b/cmd/mockServer/main.go
deleted file mode 100644
index 8cfa1ef..0000000
--- a/cmd/mockServer/main.go
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright 2017 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package main
-
-import (
- "flag"
-
- "os"
-
- "github.com/apid/apid-core"
- "github.com/apid/apid-core/factory"
- "github.com/apid/apidApigeeSync"
-)
-
-// runs a mock server standalone
-func main() {
- // create new flag to avoid displaying all the Ginkgo flags
- f := flag.NewFlagSet(os.Args[0], flag.ExitOnError)
-
- bundleURI := f.String("bundleURI", "", "a URI to a valid deployment bundle (default '')")
-
- reliable := f.Bool("reliable", true, "if false, server will often send 500 errors")
-
- numDevs := f.Int("numDevs", 2, "number of developers in snapshot")
-
- numDeps := f.Int("numDeps", 2, "number of deployments in snapshot")
-
- f.Parse(os.Args[1:])
-
- // set listener binding before apid.Initialize()
- os.Setenv("APID_API_LISTEN", ":9001")
-
- apid.Initialize(factory.DefaultServicesFactory())
-
- log := apid.Log()
- log.Debug("initializing...")
- apidApigeeSync.SetLogger(log)
-
- config := apid.Config()
- router := apid.API().Router()
-
- params := apidApigeeSync.MockParms{
- ReliableAPI: *reliable,
- ClusterID: "cluster",
- TokenKey: "key",
- TokenSecret: "secret",
- Scope: "scope",
- Organization: "org",
- Environment: "test",
- NumDevelopers: *numDevs,
- NumDeployments: *numDeps,
- BundleURI: *bundleURI,
- }
-
- log.Printf("Params: %#v\n", params)
-
- apidApigeeSync.Mock(params, router)
-
- // print the base url to the console
- listener := config.GetString("api_listen")
- log.Print()
- log.Printf("API is bound to: %s", listener)
- log.Print()
-
- // start client API listener
- api := apid.API()
- err := api.Listen()
- if err != nil {
- log.Print(err)
- }
-}