[ISSUE-67901957] refactor
diff --git a/accessEntity/api.go b/accessEntity/api.go
new file mode 100644
index 0000000..534e913
--- /dev/null
+++ b/accessEntity/api.go
@@ -0,0 +1,27 @@
+
+// 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 accessEntity
+
+import (
+)
+
+
+
+type ApiManager struct {
+	DbMan             DbManagerInterface
+	apiInitialized    bool
+}
+
diff --git a/accessEntity/manager_interfaces.go b/accessEntity/manager_interfaces.go
new file mode 100644
index 0000000..07746ca
--- /dev/null
+++ b/accessEntity/manager_interfaces.go
@@ -0,0 +1,17 @@
+package accessEntity
+
+import (
+	"net/http"
+	"github.com/apid/apid-core"
+)
+
+type ApiManagerInterface interface {
+	InitAPI()
+	HandleRequest(w http.ResponseWriter, r *http.Request)
+}
+
+type DbManagerInterface interface {
+	SetDbVersion(string)
+	GetDb() apid.DB
+	GetDbVersion() string
+}
\ No newline at end of file
diff --git a/verifyAPIKey_suite_test.go b/apidApiMetadata_suite_test.go
similarity index 86%
copy from verifyAPIKey_suite_test.go
copy to apidApiMetadata_suite_test.go
index fdb5ed2..a66271f 100644
--- a/verifyAPIKey_suite_test.go
+++ b/apidApiMetadata_suite_test.go
@@ -11,7 +11,6 @@
 // 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 apidVerifyApiKey
 
 import (
@@ -25,25 +24,17 @@
 
 const testTempDirBase = "./tmp/"
 
-var (
-	testTempDir     string
-	testSyncHandler apigeeSyncHandler
-)
-
 var _ = BeforeSuite(func() {
 	_ = os.MkdirAll(testTempDirBase, os.ModePerm)
 })
 
 var _ = AfterSuite(func() {
 	apid.Events().Close()
-	if testServer != nil {
-		testServer.Close()
-	}
 	os.RemoveAll(testTempDirBase)
 
 })
 
-func TestVerifyAPIKey(t *testing.T) {
+func TestApiMetadata(t *testing.T) {
 	RegisterFailHandler(Fail)
 	RunSpecs(t, "VerifyAPIKey Suite")
 }
diff --git a/init.go b/init.go
index 37e5a0b..31a9649 100644
--- a/init.go
+++ b/init.go
@@ -15,13 +15,9 @@
 package apidVerifyApiKey
 
 import (
-	"sync"
-
 	"github.com/apid/apid-core"
-)
-
-const (
-	apiPath = "/verifiers/apikey"
+	"github.com/apid/apidVerifyApiKey/verifyApiKey"
+	"sync"
 )
 
 var (
@@ -35,23 +31,23 @@
 
 func initPlugin(s apid.Services) (apid.PluginData, error) {
 	services = s
-
-	log = services.Log().ForModule("apidVerifyAPIKey")
+	log = services.Log().ForModule("apidApiMetadata")
+	verifyApiKey.SetApidServices(services, log)
 	log.Debug("start init")
 
 	log = services.Log()
-	dbMan := &dbManager{
-		data:  services.Data(),
-		dbMux: sync.RWMutex{},
+	verifyDbMan := &verifyApiKey.DbManager{
+		Data:  services.Data(),
+		DbMux: sync.RWMutex{},
 	}
-	apiMan := apiManager{
-		dbMan:             dbMan,
-		verifiersEndpoint: apiPath,
+	verifyApiMan := &verifyApiKey.ApiManager{
+		DbMan:             verifyDbMan,
+		VerifiersEndpoint: verifyApiKey.ApiPath,
 	}
 
 	syncHandler := apigeeSyncHandler{
-		dbMan:  dbMan,
-		apiMan: apiMan,
+		dbMans:  []DbManagerInterface{verifyDbMan},
+		apiMans: []ApiManagerInterface{verifyApiMan},
 	}
 
 	syncHandler.initListener(services)
diff --git a/interfaces.go b/interfaces.go
new file mode 100644
index 0000000..e97d424
--- /dev/null
+++ b/interfaces.go
@@ -0,0 +1,17 @@
+package apidVerifyApiKey
+
+import (
+	"github.com/apid/apid-core"
+	"net/http"
+)
+
+type ApiManagerInterface interface {
+	InitAPI()
+	HandleRequest(w http.ResponseWriter, r *http.Request)
+}
+
+type DbManagerInterface interface {
+	SetDbVersion(string)
+	GetDb() apid.DB
+	GetDbVersion() string
+}
diff --git a/listener.go b/listener.go
index db136f6..5174026 100644
--- a/listener.go
+++ b/listener.go
@@ -24,8 +24,8 @@
 )
 
 type apigeeSyncHandler struct {
-	dbMan  dbManagerInterface
-	apiMan apiManager
+	dbMans  []DbManagerInterface
+	apiMans []ApiManagerInterface
 }
 
 func (h *apigeeSyncHandler) initListener(services apid.Services) {
@@ -38,8 +38,14 @@
 
 func (h *apigeeSyncHandler) processSnapshot(snapshot *common.Snapshot) {
 	log.Debugf("Snapshot received. Switching to DB version: %s", snapshot.SnapshotInfo)
-	h.dbMan.setDbVersion(snapshot.SnapshotInfo)
-	h.apiMan.InitAPI()
+	// set db version for all packages
+	for _, dbMan := range h.dbMans {
+		dbMan.SetDbVersion(snapshot.SnapshotInfo)
+	}
+	// idempotent init api for all packages
+	for _, apiMan := range h.apiMans {
+		apiMan.InitAPI()
+	}
 	log.Debug("Snapshot processed")
 }
 
diff --git a/listener_test.go b/listener_test.go
index 7ba8379..a4689c4 100644
--- a/listener_test.go
+++ b/listener_test.go
@@ -17,6 +17,7 @@
 import (
 	"github.com/apid/apid-core"
 	"github.com/apid/apid-core/factory"
+	"github.com/apid/apidVerifyApiKey/verifyApiKey"
 	"github.com/apigee-labs/transicator/common"
 	. "github.com/onsi/ginkgo"
 	. "github.com/onsi/gomega"
@@ -43,15 +44,15 @@
 		db, err := apid.Data().DB()
 		Expect(err).NotTo(HaveOccurred())
 
-		dbMan := &dbManager{
-			data:  s.Data(),
-			dbMux: sync.RWMutex{},
-			db:    db,
+		dbMan := &verifyApiKey.DbManager{
+			Data:  s.Data(),
+			DbMux: sync.RWMutex{},
+			Db:    db,
 		}
 
 		listnerTestSyncHandler = apigeeSyncHandler{
-			dbMan:  dbMan,
-			apiMan: apiManager{},
+			dbMans:  []DbManagerInterface{dbMan},
+			apiMans: []ApiManagerInterface{&verifyApiKey.ApiManager{}},
 		}
 
 		listnerTestSyncHandler.initListener(s)
@@ -69,19 +70,23 @@
 				Tables:       []common.Table{},
 			}
 			listnerTestSyncHandler.Handle(s)
-			Expect(listnerTestSyncHandler.dbMan.getDbVersion()).Should(BeEquivalentTo(s.SnapshotInfo))
+			for _, dbMan := range listnerTestSyncHandler.dbMans {
+				Expect(dbMan.GetDbVersion()).Should(BeEquivalentTo(s.SnapshotInfo))
+			}
 
 		})
 
 		It("should not change version for chang event", func() {
 
-			version := listnerTestSyncHandler.dbMan.getDbVersion()
+			version := listnerTestSyncHandler.dbMans[0].GetDbVersion()
 			s := &common.Change{
 				ChangeSequence: 12321,
 				Table:          "",
 			}
-			testSyncHandler.Handle(s)
-			Expect(listnerTestSyncHandler.dbMan.getDbVersion() == version).Should(BeTrue())
+			listnerTestSyncHandler.Handle(s)
+			for _, dbMan := range listnerTestSyncHandler.dbMans {
+				Expect(dbMan.GetDbVersion() == version).Should(BeTrue())
+			}
 
 		})
 
diff --git a/api.go b/verifyApiKey/api.go
similarity index 93%
rename from api.go
rename to verifyApiKey/api.go
index 36c5058..ef7e194 100644
--- a/api.go
+++ b/verifyApiKey/api.go
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package apidVerifyApiKey
+package verifyApiKey
 
 import (
 	"encoding/json"
@@ -22,29 +22,29 @@
 	"strings"
 )
 
-type apiManagerInterface interface {
+type ApiManagerInterface interface {
 	InitAPI()
-	handleRequest(w http.ResponseWriter, r *http.Request)
+	HandleRequest(w http.ResponseWriter, r *http.Request)
 	verifyAPIKey(verifyApiKeyReq VerifyApiKeyRequest) (*VerifyApiKeySuccessResponse, *ErrorResponse)
 }
 
-type apiManager struct {
-	dbMan             dbManagerInterface
-	verifiersEndpoint string
+type ApiManager struct {
+	DbMan             DbManagerInterface
+	VerifiersEndpoint string
 	apiInitialized    bool
 }
 
-func (a *apiManager) InitAPI() {
+func (a *ApiManager) InitAPI() {
 	if a.apiInitialized {
 		return
 	}
-	services.API().HandleFunc(a.verifiersEndpoint, a.handleRequest).Methods("POST")
+	services.API().HandleFunc(a.VerifiersEndpoint, a.HandleRequest).Methods("POST")
 	a.apiInitialized = true
 	log.Debug("API endpoints initialized")
 }
 
 // handle client API
-func (a *apiManager) handleRequest(w http.ResponseWriter, r *http.Request) {
+func (a *ApiManager) HandleRequest(w http.ResponseWriter, r *http.Request) {
 
 	w.Header().Set("Content-Type", "application/json")
 
@@ -108,7 +108,7 @@
 }
 
 // returns []byte to be written to client
-func (apiM apiManager) verifyAPIKey(verifyApiKeyReq VerifyApiKeyRequest) (*VerifyApiKeySuccessResponse, *ErrorResponse) {
+func (apiM ApiManager) verifyAPIKey(verifyApiKeyReq VerifyApiKeyRequest) (*VerifyApiKeySuccessResponse, *ErrorResponse) {
 
 	dataWrapper := VerifyApiKeyRequestResponseDataWrapper{
 		verifyApiKeyRequest: verifyApiKeyReq,
@@ -116,7 +116,7 @@
 	dataWrapper.verifyApiKeySuccessResponse.ClientId.ClientId = verifyApiKeyReq.Key
 	dataWrapper.verifyApiKeySuccessResponse.Environment = verifyApiKeyReq.EnvironmentName
 
-	err := apiM.dbMan.getApiKeyDetails(&dataWrapper)
+	err := apiM.DbMan.getApiKeyDetails(&dataWrapper)
 
 	switch {
 	case err != nil && err.Error() == "InvalidApiKey":
@@ -200,7 +200,7 @@
 
 }
 
-func (apiM apiManager) performValidations(dataWrapper VerifyApiKeyRequestResponseDataWrapper) *ErrorResponse {
+func (apiM ApiManager) performValidations(dataWrapper VerifyApiKeyRequestResponseDataWrapper) *ErrorResponse {
 	clientIdDetails := dataWrapper.verifyApiKeySuccessResponse.ClientId
 	verifyApiKeyReq := dataWrapper.verifyApiKeyRequest
 	appDetails := dataWrapper.verifyApiKeySuccessResponse.App
@@ -273,9 +273,9 @@
 
 }
 
-func (a *apiManager) enrichAttributes(dataWrapper *VerifyApiKeyRequestResponseDataWrapper) {
+func (a *ApiManager) enrichAttributes(dataWrapper *VerifyApiKeyRequestResponseDataWrapper) {
 
-	attributeMap := a.dbMan.getKmsAttributes(dataWrapper.tenant_id, dataWrapper.verifyApiKeySuccessResponse.ClientId.ClientId, dataWrapper.tempDeveloperDetails.Id, dataWrapper.verifyApiKeySuccessResponse.ApiProduct.Id, dataWrapper.verifyApiKeySuccessResponse.App.Id)
+	attributeMap := a.DbMan.getKmsAttributes(dataWrapper.tenant_id, dataWrapper.verifyApiKeySuccessResponse.ClientId.ClientId, dataWrapper.tempDeveloperDetails.Id, dataWrapper.verifyApiKeySuccessResponse.ApiProduct.Id, dataWrapper.verifyApiKeySuccessResponse.App.Id)
 
 	clientIdAttributes := attributeMap[dataWrapper.verifyApiKeySuccessResponse.ClientId.ClientId]
 	developerAttributes := attributeMap[dataWrapper.tempDeveloperDetails.Id]
diff --git a/api_ShortListApiProduct_test.go b/verifyApiKey/api_ShortListApiProduct_test.go
similarity index 99%
rename from api_ShortListApiProduct_test.go
rename to verifyApiKey/api_ShortListApiProduct_test.go
index 72c999e..732fda4 100644
--- a/api_ShortListApiProduct_test.go
+++ b/verifyApiKey/api_ShortListApiProduct_test.go
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package apidVerifyApiKey
+package verifyApiKey
 
 import (
 	. "github.com/onsi/ginkgo"
diff --git a/api_performValidations_test.go b/verifyApiKey/api_performValidations_test.go
similarity index 98%
rename from api_performValidations_test.go
rename to verifyApiKey/api_performValidations_test.go
index afcb225..f7dcdb3 100644
--- a/api_performValidations_test.go
+++ b/verifyApiKey/api_performValidations_test.go
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package apidVerifyApiKey
+package verifyApiKey
 
 import (
 	"encoding/json"
@@ -33,7 +33,7 @@
 
 	apid.Initialize(factory.DefaultServicesFactory())
 	log = factory.DefaultServicesFactory().Log()
-	a := apiManager{}
+	a := ApiManager{}
 
 	Context("performValidationsTest tests", func() {
 		It("happy-path", func() {
@@ -343,7 +343,7 @@
 			}
 			Expect(actual).Should(Equal(td.expectedResult))
 		})
-		It("resources not configured in db", func() {
+		It("resources not configured in Db", func() {
 			td := performValidationsTestDataStruct{
 				expectedResult:                     "",
 				expectedWhenValidateProxyEnvIsTrue: "",
@@ -395,7 +395,7 @@
 			}
 			Expect(actual).Should(Equal(td.expectedResult))
 		})
-		It("proxies not configured in db", func() {
+		It("proxies not configured in Db", func() {
 			td := performValidationsTestDataStruct{
 				expectedResult:                     "",
 				expectedWhenValidateProxyEnvIsTrue: "",
@@ -447,7 +447,7 @@
 			}
 			Expect(actual).Should(Equal(td.expectedResult))
 		})
-		It("environments not configured in db", func() {
+		It("environments not configured in Db", func() {
 			td := performValidationsTestDataStruct{
 				expectedResult:                     "",
 				expectedWhenValidateProxyEnvIsTrue: "",
diff --git a/api_test.go b/verifyApiKey/api_test.go
similarity index 94%
rename from api_test.go
rename to verifyApiKey/api_test.go
index 50c6bbc..5434019 100644
--- a/api_test.go
+++ b/verifyApiKey/api_test.go
@@ -11,7 +11,7 @@
 // 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 apidVerifyApiKey
+package verifyApiKey
 
 // TODO: end to end IT tests
 // 1. happy path for developer
@@ -42,7 +42,7 @@
 
 var _ = Describe("end to end tests", func() {
 	var dataTestTempDir string
-	var dbMan *dbManager
+	var dbMan *DbManager
 
 	var _ = BeforeEach(func() {
 		var err error
@@ -56,20 +56,20 @@
 
 		Expect(err).NotTo(HaveOccurred())
 
-		dbMan = &dbManager{
-			data:  serviceFactoryForTest.Data(),
-			dbMux: sync.RWMutex{},
+		dbMan = &DbManager{
+			Data:  serviceFactoryForTest.Data(),
+			DbMux: sync.RWMutex{},
 		}
-		dbMan.setDbVersion(dataTestTempDir)
+		dbMan.SetDbVersion(dataTestTempDir)
 
-		apiMan := apiManager{
-			dbMan:             dbMan,
-			verifiersEndpoint: apiPath,
+		apiMan := ApiManager{
+			DbMan:             dbMan,
+			VerifiersEndpoint: ApiPath,
 		}
 
 		testServer = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
-			if req.URL.Path == apiPath {
-				apiMan.handleRequest(w, req)
+			if req.URL.Path == ApiPath {
+				apiMan.HandleRequest(w, req)
 			}
 		}))
 
@@ -112,7 +112,7 @@
 			Expect(respObj.ResponseCode).Should(Equal("oauth.v2.InvalidApiKey"))
 		})
 		It("should return validation error for inavlid env", func() {
-			setupApikeyDeveloperTestDb(dbMan.db)
+			setupApikeyDeveloperTestDb(dbMan.Db)
 			var respObj ErrorResponse
 			reqInput := VerifyApiKeyRequest{
 				Key:              "63tHSNLKJkcc6GENVWGT1Zw5gek7kVJ0",
@@ -134,7 +134,7 @@
 			Expect(respObj.ResponseCode).Should(Equal("oauth.v2.InvalidApiKeyForGivenResource"))
 		})
 		It("should return validation error for inavlid resource", func() {
-			setupApikeyDeveloperTestDb(dbMan.db)
+			setupApikeyDeveloperTestDb(dbMan.Db)
 			var respObj ErrorResponse
 			reqInput := VerifyApiKeyRequest{
 				Key:              "63tHSNLKJkcc6GENVWGT1Zw5gek7kVJ0",
@@ -156,7 +156,7 @@
 			Expect(respObj.ResponseCode).Should(Equal("oauth.v2.InvalidApiKeyForGivenResource"))
 		})
 		It("should return validation error for inavlid proxies", func() {
-			setupApikeyDeveloperTestDb(dbMan.db)
+			setupApikeyDeveloperTestDb(dbMan.Db)
 			var respObj ErrorResponse
 			reqInput := VerifyApiKeyRequest{
 				Key:              "63tHSNLKJkcc6GENVWGT1Zw5gek7kVJ0",
@@ -178,7 +178,7 @@
 			Expect(respObj.ResponseCode).Should(Equal("oauth.v2.InvalidApiKeyForGivenResource"))
 		})
 		It("should peform verify api key for developer happy path", func() {
-			setupApikeyDeveloperTestDb(dbMan.db)
+			setupApikeyDeveloperTestDb(dbMan.Db)
 			var respObj VerifyApiKeySuccessResponse
 
 			reqInput := VerifyApiKeyRequest{
@@ -229,7 +229,7 @@
 		})
 
 		It("should peform verify api key for company happy path", func() {
-			setupApikeyCompanyTestDb(dbMan.db)
+			setupApikeyCompanyTestDb(dbMan.Db)
 			var respObj VerifyApiKeySuccessResponse
 
 			reqInput := VerifyApiKeyRequest{
@@ -283,7 +283,7 @@
 
 func performTestOperation(jsonBody string, expectedResponseCode int) ([]byte, error) {
 	uri, err := url.Parse(testServer.URL)
-	uri.Path = apiPath
+	uri.Path = ApiPath
 	client := &http.Client{}
 	httpReq, err := http.NewRequest("POST", uri.String(), strings.NewReader(string(jsonBody)))
 	httpReq.Header.Set("Content-Type", "application/json")
diff --git a/data.go b/verifyApiKey/data.go
similarity index 86%
rename from data.go
rename to verifyApiKey/data.go
index e2d974e..8a2d1e6 100644
--- a/data.go
+++ b/verifyApiKey/data.go
@@ -11,7 +11,7 @@
 // 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 apidVerifyApiKey
+package verifyApiKey
 
 import (
 	"database/sql"
@@ -21,46 +21,46 @@
 	"sync"
 )
 
-type dbManager struct {
-	data      apid.DataService
-	db        apid.DB
-	dbMux     sync.RWMutex
+type DbManager struct {
+	Data      apid.DataService
+	Db        apid.DB
+	DbMux     sync.RWMutex
 	dbVersion string
 }
 
-func (dbc *dbManager) setDbVersion(version string) {
-	db, err := dbc.data.DBVersion(version)
+func (dbc *DbManager) SetDbVersion(version string) {
+	db, err := dbc.Data.DBVersion(version)
 	if err != nil {
 		log.Panicf("Unable to access database: %v", err)
 	}
-	dbc.dbMux.Lock()
-	dbc.db = db
-	dbc.dbMux.Unlock()
+	dbc.DbMux.Lock()
+	dbc.Db = db
+	dbc.DbMux.Unlock()
 	dbc.dbVersion = version
-	// TODO : check if we need to release old db here...
+	// TODO : check if we need to release old Db here...
 }
 
-func (dbc *dbManager) getDb() apid.DB {
-	dbc.dbMux.RLock()
-	defer dbc.dbMux.RUnlock()
-	return dbc.db
+func (dbc *DbManager) GetDb() apid.DB {
+	dbc.DbMux.RLock()
+	defer dbc.DbMux.RUnlock()
+	return dbc.Db
 }
 
-func (dbc *dbManager) getDbVersion() string {
+func (dbc *DbManager) GetDbVersion() string {
 	return dbc.dbVersion
 }
 
-type dbManagerInterface interface {
-	setDbVersion(string)
-	getDb() apid.DB
-	getDbVersion() string
+type DbManagerInterface interface {
+	SetDbVersion(string)
+	GetDb() apid.DB
+	GetDbVersion() string
 	getKmsAttributes(tenantId string, entities ...string) map[string][]Attribute
 	getApiKeyDetails(dataWrapper *VerifyApiKeyRequestResponseDataWrapper) error
 }
 
-func (dbc *dbManager) getKmsAttributes(tenantId string, entities ...string) map[string][]Attribute {
+func (dbc *DbManager) getKmsAttributes(tenantId string, entities ...string) map[string][]Attribute {
 
-	db := dbc.db
+	db := dbc.Db
 	var attName, attValue, entity_id sql.NullString
 	// TODO : is there no other better way to do in caluse???
 	sql := sql_GET_KMS_ATTRIBUTES_FOR_TENANT + ` and entity_id in ('` + strings.Join(entities, `','`) + `')`
@@ -92,9 +92,9 @@
 	return mapOfAttributes
 }
 
-func (dbc dbManager) getApiKeyDetails(dataWrapper *VerifyApiKeyRequestResponseDataWrapper) error {
+func (dbc DbManager) getApiKeyDetails(dataWrapper *VerifyApiKeyRequestResponseDataWrapper) error {
 
-	db := dbc.db
+	db := dbc.Db
 
 	err := db.QueryRow(sql_GET_API_KEY_DETAILS_SQL, dataWrapper.verifyApiKeyRequest.Key, dataWrapper.verifyApiKeyRequest.OrganizationName).
 		Scan(
@@ -144,9 +144,9 @@
 	return err
 }
 
-func (dbc dbManager) getApiProductsForApiKey(key, tenantId string) []ApiProductDetails {
+func (dbc DbManager) getApiProductsForApiKey(key, tenantId string) []ApiProductDetails {
 
-	db := dbc.db
+	db := dbc.Db
 	allProducts := []ApiProductDetails{}
 	var proxies, environments, resources string
 
diff --git a/data_helper_test.go b/verifyApiKey/data_helper_test.go
similarity index 99%
rename from data_helper_test.go
rename to verifyApiKey/data_helper_test.go
index c5fa0e4..74c19a5 100644
--- a/data_helper_test.go
+++ b/verifyApiKey/data_helper_test.go
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package apidVerifyApiKey
+package verifyApiKey
 
 import (
 	"github.com/apid/apid-core"
diff --git a/data_test.go b/verifyApiKey/data_test.go
similarity index 95%
rename from data_test.go
rename to verifyApiKey/data_test.go
index 2a6bdb6..4d5e93b 100644
--- a/data_test.go
+++ b/verifyApiKey/data_test.go
@@ -11,7 +11,7 @@
 // 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 apidVerifyApiKey
+package verifyApiKey
 
 import (
 	"github.com/apid/apid-core"
@@ -24,9 +24,9 @@
 
 var _ = Describe("DataTest", func() {
 
-	Context("query db to get api key details", func() {
+	Context("query Db to get api key details", func() {
 		var dataTestTempDir string
-		var dbMan *dbManager
+		var dbMan *DbManager
 		var _ = BeforeEach(func() {
 			var err error
 			dataTestTempDir, err = ioutil.TempDir(testTempDirBase, "sqlite3")
@@ -38,16 +38,16 @@
 
 			Expect(err).NotTo(HaveOccurred())
 
-			dbMan = &dbManager{
-				data:  s.Data(),
-				dbMux: sync.RWMutex{},
+			dbMan = &DbManager{
+				Data:  s.Data(),
+				DbMux: sync.RWMutex{},
 			}
-			dbMan.setDbVersion(dataTestTempDir)
+			dbMan.SetDbVersion(dataTestTempDir)
 
 		})
 
 		It("should get compnay getApiKeyDetails for happy path", func() {
-			setupApikeyCompanyTestDb(dbMan.db)
+			setupApikeyCompanyTestDb(dbMan.Db)
 
 			dataWrapper := VerifyApiKeyRequestResponseDataWrapper{
 				verifyApiKeyRequest: VerifyApiKeyRequest{
@@ -90,7 +90,7 @@
 		})
 
 		It("should get developer ApiKeyDetails - happy path", func() {
-			setupApikeyDeveloperTestDb(dbMan.db)
+			setupApikeyDeveloperTestDb(dbMan.Db)
 
 			dataWrapper := VerifyApiKeyRequestResponseDataWrapper{
 				verifyApiKeyRequest: VerifyApiKeyRequest{
@@ -134,7 +134,7 @@
 
 		It("should throw error when apikey not found", func() {
 
-			setupApikeyCompanyTestDb(dbMan.db)
+			setupApikeyCompanyTestDb(dbMan.Db)
 			dataWrapper := VerifyApiKeyRequestResponseDataWrapper{
 				verifyApiKeyRequest: VerifyApiKeyRequest{
 					OrganizationName: "apigee-mcrosrvc-client0001",
@@ -148,7 +148,7 @@
 
 		It("should get api products ", func() {
 
-			setupApikeyCompanyTestDb(dbMan.db)
+			setupApikeyCompanyTestDb(dbMan.Db)
 
 			apiProducts := dbMan.getApiProductsForApiKey("63tHSNLKJkcc6GENVWGT1Zw5gek7kVJ0", "bc811169")
 			Expect(len(apiProducts)).Should(BeEquivalentTo(1))
@@ -176,7 +176,7 @@
 
 		It("should return empty array when no api products found", func() {
 
-			setupApikeyCompanyTestDb(dbMan.db)
+			setupApikeyCompanyTestDb(dbMan.Db)
 			apiProducts := dbMan.getApiProductsForApiKey("invalid-LKJkcc6GENVWGT1Zw5gek7kVJ0", "bc811169")
 			Expect(len(apiProducts)).Should(BeEquivalentTo(0))
 
@@ -184,7 +184,7 @@
 
 		It("should get kms attributes", func() {
 
-			setupKmsAttributesdata(dbMan.db)
+			setupKmsAttributesdata(dbMan.Db)
 			attributes := dbMan.getKmsAttributes("bc811169", "40753e12-a50a-429d-9121-e571eb4e43a9", "85629786-37c5-4e8c-bb45-208f3360d005", "50321842-d6ee-4e92-91b9-37234a7920c1", "test-invalid")
 			Expect(len(attributes)).Should(BeEquivalentTo(3))
 			Expect(len(attributes["40753e12-a50a-429d-9121-e571eb4e43a9"])).Should(BeEquivalentTo(1))
diff --git a/verifyApiKey/init.go b/verifyApiKey/init.go
new file mode 100644
index 0000000..2f18a52
--- /dev/null
+++ b/verifyApiKey/init.go
@@ -0,0 +1,19 @@
+package verifyApiKey
+
+import (
+	"github.com/apid/apid-core"
+)
+
+const (
+	ApiPath = "/verifiers/apikey"
+)
+
+var (
+	services apid.Services
+	log      apid.LogService
+)
+
+func SetApidServices(s apid.Services, l apid.LogService) {
+	services = s
+	log = l
+}
diff --git a/kmsDataTest.sql b/verifyApiKey/kmsDataTest.sql
similarity index 100%
rename from kmsDataTest.sql
rename to verifyApiKey/kmsDataTest.sql
diff --git a/sqlQueries.go b/verifyApiKey/sqlQueries.go
similarity index 98%
rename from sqlQueries.go
rename to verifyApiKey/sqlQueries.go
index 504af9a..3a1525e 100644
--- a/sqlQueries.go
+++ b/verifyApiKey/sqlQueries.go
@@ -11,7 +11,7 @@
 // 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 apidVerifyApiKey
+package verifyApiKey
 
 const sql_GET_API_KEY_DETAILS_SQL = `
 			SELECT
diff --git a/verifyAPIKey_suite_test.go b/verifyApiKey/verifyAPIKey_suite_test.go
similarity index 92%
rename from verifyAPIKey_suite_test.go
rename to verifyApiKey/verifyAPIKey_suite_test.go
index fdb5ed2..15f739d 100644
--- a/verifyAPIKey_suite_test.go
+++ b/verifyApiKey/verifyAPIKey_suite_test.go
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package apidVerifyApiKey
+package verifyApiKey
 
 import (
 	. "github.com/onsi/ginkgo"
@@ -26,8 +26,7 @@
 const testTempDirBase = "./tmp/"
 
 var (
-	testTempDir     string
-	testSyncHandler apigeeSyncHandler
+	testTempDir string
 )
 
 var _ = BeforeSuite(func() {
diff --git a/verifyApiKeyStructs.go b/verifyApiKey/verifyApiKeyStructs.go
similarity index 99%
rename from verifyApiKeyStructs.go
rename to verifyApiKey/verifyApiKeyStructs.go
index 28f345b..d7c810e 100644
--- a/verifyApiKeyStructs.go
+++ b/verifyApiKey/verifyApiKeyStructs.go
@@ -11,7 +11,7 @@
 // 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 apidVerifyApiKey
+package verifyApiKey
 
 import "errors"
 
diff --git a/verifyApiKeyUtil.go b/verifyApiKey/verifyApiKeyUtil.go
similarity index 98%
rename from verifyApiKeyUtil.go
rename to verifyApiKey/verifyApiKeyUtil.go
index a7d2451..ee571b5 100644
--- a/verifyApiKeyUtil.go
+++ b/verifyApiKey/verifyApiKeyUtil.go
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package apidVerifyApiKey
+package verifyApiKey
 
 import (
 	"encoding/json"
diff --git a/verifyApiKeyUtil_test.go b/verifyApiKey/verifyApiKeyUtil_test.go
similarity index 98%
rename from verifyApiKeyUtil_test.go
rename to verifyApiKey/verifyApiKeyUtil_test.go
index 4e17289..95aef55 100644
--- a/verifyApiKeyUtil_test.go
+++ b/verifyApiKey/verifyApiKeyUtil_test.go
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package apidVerifyApiKey
+package verifyApiKey
 
 import (
 	. "github.com/onsi/ginkgo"
diff --git a/verifyApiKeyUtil_validate_path_test.go b/verifyApiKey/verifyApiKeyUtil_validate_path_test.go
similarity index 98%
rename from verifyApiKeyUtil_validate_path_test.go
rename to verifyApiKey/verifyApiKeyUtil_validate_path_test.go
index eb91d8f..7399309 100644
--- a/verifyApiKeyUtil_validate_path_test.go
+++ b/verifyApiKey/verifyApiKeyUtil_validate_path_test.go
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package apidVerifyApiKey
+package verifyApiKey
 
 import (
 	. "github.com/onsi/ginkgo"