bug fixed, format code
diff --git a/api.go b/api.go index 0d3d6c6..028436e 100644 --- a/api.go +++ b/api.go
@@ -11,7 +11,7 @@ type sucResponseDetail struct { Key string `json:"key"` ExpiresAt int64 `json:"expiresAt"` - IssuedAt string `json:"issuedAt"` + IssuedAt string `json:"issuedAt"` Status string `json:"status"` Type string `json:"cType"` RedirectionURIs string `json:"redirectionURIs"` @@ -97,6 +97,7 @@ switch { case error == sql.ErrNoRows: + log.Debug("verifyAPIKey: sql.ErrNoRows") reason := "ENV Validation Failed" errorCode := "ENV_VALIDATION_FAILED" return errorResponse(reason, errorCode)
diff --git a/api_test.go b/api_test.go index ddb245e..2dbd431 100644 --- a/api_test.go +++ b/api_test.go
@@ -99,4 +99,4 @@ Expect(respj.ErrInfo.ErrorCode).Should(Equal("REQ_ENTRY_NOT_FOUND")) }) }) -}) \ No newline at end of file +})
diff --git a/listener.go b/listener.go index 8eda4ed..8c66d25 100644 --- a/listener.go +++ b/listener.go
@@ -32,4 +32,4 @@ setDB(db) return -} \ No newline at end of file +}
diff --git a/listener_test.go b/listener_test.go index 1cc33da..fed281f 100644 --- a/listener_test.go +++ b/listener_test.go
@@ -38,7 +38,7 @@ func addScopes(db apid.DB) { txn, _ := db.Begin() - txn.Exec("INSERT INTO DATA_SCOPE (id, _change_selector, apid_cluster_id, scope, org, env) "+ + txn.Exec("INSERT INTO EDGEX_DATA_SCOPE (id, _change_selector, apid_cluster_id, scope, org, env) "+ "VALUES"+ "($1,$2,$3,$4,$5,$6)", "ABCDE", @@ -48,7 +48,7 @@ "test_org0", "Env_0", ) - txn.Exec("INSERT INTO DATA_SCOPE (id, _change_selector, apid_cluster_id, scope, org, env) "+ + txn.Exec("INSERT INTO EDGEX_DATA_SCOPE (id, _change_selector, apid_cluster_id, scope, org, env) "+ "VALUES"+ "($1,$2,$3,$4,$5,$6)", "XYZ", @@ -58,6 +58,6 @@ "test_org0", "Env_0", ) - log.Info("Inserted DATA_SCOPE for test") + log.Info("Inserted EDGEX_DATA_SCOPE for test") txn.Commit() }
diff --git a/test_helper.go b/test_helper.go index b112dcf..19eef1c 100644 --- a/test_helper.go +++ b/test_helper.go
@@ -1,8 +1,8 @@ package apidVerifyApiKey import ( - "strconv" "database/sql" + "strconv" ) func convertSuffix(i int) string { @@ -15,7 +15,7 @@ if err != nil { log.Panicf("This is a bug : " + err.Error()) } - s.Exec("api_product_" + convertSuffix(suffix), "{/**, /test}", "{Env_0, Env_1}", + s.Exec("api_product_"+convertSuffix(suffix), "{/**, /test}", "{Env_0, Env_1}", "tenant_id_xxxx", "Org_0") } @@ -25,7 +25,7 @@ if err != nil { log.Panicf("This is a bug : " + err.Error()) } - s.Exec("developer_id_" + convertSuffix(suffix), "Active", "test@apigee.com", "Apigee", "Google", "tenant_id_xxxx", "Org_0") + s.Exec("developer_id_"+convertSuffix(suffix), "Active", "test@apigee.com", "Apigee", "Google", "tenant_id_xxxx", "Org_0") } func generateTestCompany(suffix int, txn *sql.Tx) { @@ -34,7 +34,7 @@ if err != nil { log.Panicf("This is a bug: " + err.Error()) } - s.Exec("company_id_" + convertSuffix(suffix), "Active", "Apigee Corporation", "Apigee", "tenant_id_xxxx", "Org_0") + s.Exec("company_id_"+convertSuffix(suffix), "Active", "Apigee Corporation", "Apigee", "tenant_id_xxxx", "Org_0") } func generateTestCompanyDeveloper(suffix int, txn *sql.Tx) { @@ -43,7 +43,7 @@ if err != nil { log.Panicf("This is a bug: " + err.Error()) } - s.Exec("developer_id_" + convertSuffix(suffix), "tenant_id_0", "test_org0", "company_id_" + convertSuffix(suffix)) + s.Exec("developer_id_"+convertSuffix(suffix), "tenant_id_0", "test_org0", "company_id_"+convertSuffix(suffix)) } func generateTestApp(suffix1, suffix2 int, txn *sql.Tx) { @@ -52,8 +52,8 @@ if err != nil { log.Panicf("This is a bug: " + err.Error()) } - s.Exec("application_id_" + convertSuffix(suffix1), "developer_id_" + convertSuffix(suffix2), "Approved", "tenant_id_xxxx", - "http://apigee.com", "Org_0", "developer_id_" + convertSuffix(suffix2)) + s.Exec("application_id_"+convertSuffix(suffix1), "developer_id_"+convertSuffix(suffix2), "Approved", "tenant_id_xxxx", + "http://apigee.com", "Org_0", "developer_id_"+convertSuffix(suffix2)) } @@ -63,8 +63,8 @@ if err != nil { log.Panicf("This is a bug: " + err.Error()) } - s.Exec("application_id_" + convertSuffix(suffix1), "company_id_" + convertSuffix(suffix2), "Approved", "tenant_id_xxxx", - "http://apigee.com", "Org_0", "company_id_" + convertSuffix(suffix2)) + s.Exec("application_id_"+convertSuffix(suffix1), "company_id_"+convertSuffix(suffix2), "Approved", "tenant_id_xxxx", + "http://apigee.com", "Org_0", "company_id_"+convertSuffix(suffix2)) } @@ -73,7 +73,7 @@ if err != nil { log.Panicf("This is a bug: " + err.Error()) } - s.Exec("app_credential_" + convertSuffix(suffix), "application_id_" + convertSuffix(suffix), "Approved", + s.Exec("app_credential_"+convertSuffix(suffix), "application_id_"+convertSuffix(suffix), "Approved", "tenant_id_xxxx", "Org_0") } @@ -82,6 +82,6 @@ if err != nil { log.Panicf("This is a bug: " + err.Error()) } - s.Exec("api_product_" + convertSuffix(suffix), "Approved", "application_id_" + convertSuffix(suffix), - "app_credential_" + convertSuffix(suffix), "tenant_id_xxxx", "Org_0") -} \ No newline at end of file + s.Exec("api_product_"+convertSuffix(suffix), "Approved", "application_id_"+convertSuffix(suffix), + "app_credential_"+convertSuffix(suffix), "tenant_id_xxxx", "Org_0") +}
diff --git a/verifyAPIKey_suite_test.go b/verifyAPIKey_suite_test.go index 2a044e1..131ce4e 100644 --- a/verifyAPIKey_suite_test.go +++ b/verifyAPIKey_suite_test.go
@@ -74,7 +74,7 @@ // application var j, k int for i := 0; i < 10; i++ { - for j = k; j < 10 + k; j++ { + for j = k; j < 10+k; j++ { generateTestApp(j, i, txn) } k = j @@ -107,7 +107,7 @@ // application k = 100 for i := 100; i < 110; i++ { - for j = k; j < 100 + k; j++ { + for j = k; j < 100+k; j++ { generateTestAppCompany(j, i, txn) } k = j @@ -123,6 +123,6 @@ txn.Commit() var count int64 - db.QueryRow("select count(*) from data_scope").Scan(&count) + db.QueryRow("select count(*) from EDGEX_DATA_SCOPE").Scan(&count) log.Info("Found ", count) }