Skip to content

Commit

Permalink
added code for endpoints - mock, unMock and handle
Browse files Browse the repository at this point in the history
  • Loading branch information
s0s01qp committed Jul 24, 2021
1 parent 3e68b90 commit 0d32ba9
Show file tree
Hide file tree
Showing 16 changed files with 638 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ coverage.out

*.db

__debug_bin
__debug_bin

persistence.db
32 changes: 32 additions & 0 deletions commons/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package commons

// Common Constants
const (
ActuatorPrefix = "/actuator"
MoxyPrefix = "/moxy"
PersistencePath = "persistence-path"
PersistenceDefaultValue = "persistence.db"
PersistenceUsage = "persistence path is the path of the file which acts as the persistence layer for this application"
Port = "port"
PortDefaultValue = 8080
PortUsage = "port is the port number on which the application is running"
)

// Endpoint Paths
const (
MockEndpointPath = "/moxy/mock"
UnMockEndpointPath = "/moxy/unMock"
)

// MockEntityName is the mock entity name
const (
MockEntityName = "mock"
)

// Response constants
const (
TagHeader = "x-tag"
URLHeader = "x-url"
ApplicationJSONContentType = "application/json"
TextStringContentType = "text/string"
)
23 changes: 23 additions & 0 deletions commons/utils.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package commons

import (
"bytes"
"encoding/json"
)

// EncodeJSON is used to encode any type of data to byte array
func EncodeJSON(v interface{}) ([]byte, error) {
var buffer bytes.Buffer
e := json.NewEncoder(&buffer)
err := e.Encode(v)
if err != nil {
return nil, err
}
return buffer.Bytes(), nil
}

// DecodeJSON is used to decode any type of data from byte array
func DecodeJSON(b []byte, v interface{}) error {
d := json.NewDecoder(bytes.NewReader(b))
return d.Decode(v)
}
68 changes: 68 additions & 0 deletions controllers/handle.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package controllers

import (
"fmt"
"github.com/sinhashubham95/moxy/persistence"
"github.com/valyala/fasthttp"
"net/http"

"github.com/sinhashubham95/moxy/commons"
"github.com/sinhashubham95/moxy/persistence/entities"
)

// Handle is used to handle the request to any endpoint
func Handle(ctx *fasthttp.RequestCtx) {
// first get the method, path and tag
method := string(ctx.Method())
path := string(ctx.Path())
tag := string(ctx.Request.Header.Peek(commons.TagHeader))

// now for this method and path, fetch the entity
mock := entities.Mock{
Tag: tag,
Method: method,
Path: path,
}

// try to fetch the mock
err := persistence.View(&mock)
if err == nil {
// this means that the mock exists
ctx.SetStatusCode(mock.Status)
// writing the response here is tricky
if s, ok := mock.Body.(string); ok {
// write as string
ctx.SetContentType(commons.TextStringContentType)
ctx.SetBodyString(s)
} else {
// first parse to bytes
body, err := commons.EncodeJSON(mock.Body)
if err == nil {
// now write
ctx.SetContentType(commons.ApplicationJSONContentType)
ctx.SetBody(body)
}
}
// return from here
return
}

// get the url
url := string(ctx.Request.Header.Peek(commons.URLHeader))
body := ctx.Request.Body()

// now that mock does not exist, call the actual endpoint
req := fasthttp.AcquireRequest()
req.SetRequestURI(fmt.Sprintf("%s/%s", url, path))
req.Header.SetMethod(method)
req.SetBody(body)
res := fasthttp.AcquireResponse()
err = fasthttp.Do(req, res)
if err != nil {
ctx.SetStatusCode(http.StatusInternalServerError)
return
}
ctx.SetStatusCode(res.StatusCode())
res.Header.CopyTo(&ctx.Response.Header)
ctx.SetBody(res.Body())
}
43 changes: 43 additions & 0 deletions controllers/mock.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package controllers

import (
"github.com/sinhashubham95/moxy/commons"
"github.com/sinhashubham95/moxy/models"
"github.com/sinhashubham95/moxy/persistence"
"github.com/sinhashubham95/moxy/persistence/entities"
"github.com/valyala/fasthttp"
"net/http"
)

// HandleMock is used to mock and endpoint
func HandleMock(ctx *fasthttp.RequestCtx) {
var request models.MockRequest
err := commons.DecodeJSON(ctx.PostBody(), &request)
if err != nil {
// invalid request body
ctx.Error("invalid json request body provided", http.StatusBadRequest)
return
}
err = (&request).Validate()
if err != nil {
// invalid request
ctx.Error(err.Error(), http.StatusBadRequest)
return
}
(&request).Default()
// now time to save it
err = persistence.Save(&entities.Mock{
Tag: request.Tag,
Method: request.Method,
Path: request.Path,
Status: request.ResponseStatus,
Body: request.ResponseBody,
})
if err != nil {
// unable to save the mock configurations
ctx.Error(err.Error(), http.StatusInternalServerError)
return
}
// success
ctx.SetStatusCode(http.StatusOK)
}
39 changes: 39 additions & 0 deletions controllers/unmock.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package controllers

import (
"github.com/sinhashubham95/moxy/commons"
"github.com/sinhashubham95/moxy/models"
"github.com/sinhashubham95/moxy/persistence"
"github.com/sinhashubham95/moxy/persistence/entities"
"github.com/valyala/fasthttp"
"net/http"
)

// HandleUnMock is used to un mock and endpoint
func HandleUnMock(ctx *fasthttp.RequestCtx) {
var request models.UnMockRequest
err := commons.DecodeJSON(ctx.PostBody(), &request)
if err != nil {
// invalid request body
ctx.Error("invalid json request body provided", http.StatusBadRequest)
return
}
err = (&request).Validate()
if err != nil {
// invalid request
ctx.Error(err.Error(), http.StatusBadRequest)
return
}
err = persistence.Delete(&entities.Mock{
Tag: request.Tag,
Method: request.Method,
Path: request.Path,
})
if err != nil {
// unable to save the mock configurations
ctx.Error(err.Error(), http.StatusInternalServerError)
return
}
// success
ctx.SetStatusCode(http.StatusOK)
}
32 changes: 32 additions & 0 deletions flags/flags.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package flags

import (
actuatorCommons "github.com/sinhashubham95/go-actuator/commons"
flag "github.com/spf13/pflag"

"github.com/sinhashubham95/moxy/commons"
)

var (
persistencePath = flag.String(commons.PersistencePath, commons.PersistenceDefaultValue, commons.PersistenceUsage)
port = flag.Int(commons.Port, commons.PortDefaultValue, commons.PortUsage)

// dummy flags
_ = flag.String(actuatorCommons.Env, actuatorCommons.EnvDefaultValue, actuatorCommons.EnvUsage)
_ = flag.String(actuatorCommons.Name, actuatorCommons.NameDefaultValue, actuatorCommons.NameUsage)
_ = flag.String(actuatorCommons.Version, actuatorCommons.VersionDefaultValue, actuatorCommons.VersionUsage)
)

func init() {
flag.Parse()
}

// PersistencePath is the path of the persistence database file
func PersistencePath() string {
return *persistencePath
}

// Port is the port number where the application is running
func Port() int {
return *port
}
12 changes: 11 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
module "github.com/sinhashubham95/moxy"
module github.com/sinhashubham95/moxy

go 1.16

require (
github.com/sinhashubham95/bleep v1.0.2
github.com/sinhashubham95/go-actuator v1.3.2
github.com/spf13/pflag v1.0.5
github.com/valyala/fasthttp v1.28.0
go.etcd.io/bbolt v1.3.6
)
87 changes: 87 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
github.com/andybalholm/brotli v1.0.2 h1:JKnhI/XQ75uFBTiuzXpzFrUriDPiZjlOSzh6wXogP0E=
github.com/andybalholm/brotli v1.0.2/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.7.2 h1:Tg03T9yM2xa8j6I3Z3oqLaQRSmKvxPd6g/2HJ6zICFA=
github.com/gin-gonic/gin v1.7.2/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY=
github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE=
github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=
github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/uuid v1.1.3 h1:twObb+9XcuH5B9V1TBCvvvZoO6iEdILi2a76PYn5rJI=
github.com/google/uuid v1.1.3/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/klauspost/compress v1.12.2 h1:2KCfW3I9M7nSc5wOqXAlW2v2U6v+w6cbjvbfp+OykW8=
github.com/klauspost/compress v1.12.2/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sinhashubham95/bleep v1.0.2 h1:/QaineE2Ec/CFaSDhE2not31NjeB/4ClxPamTwwNRj8=
github.com/sinhashubham95/bleep v1.0.2/go.mod h1:SNUbuZgBztw2QT339J5QK0y/scIG/1RdLFgKPCmm+Jo=
github.com/sinhashubham95/go-actuator v1.3.2 h1:b44Y83WhujzPjpKL03Z80g7JVrjT7tzefajjpIid1E0=
github.com/sinhashubham95/go-actuator v1.3.2/go.mod h1:fZRxekWXxkMLCCIFdzeeJIo7EeHj9kwDC7TKXxzu4M4=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasthttp v1.28.0 h1:ruVmTmZaBR5i67NqnjvvH5gEv0zwHfWtbjoyW98iho4=
github.com/valyala/fasthttp v1.28.0/go.mod h1:cmWIqlu99AO/RKcp1HWaViTqc57FswJOfYYdPJBl8BA=
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU=
go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a h1:kr2P4QFmQr29mSLA43kwrOcgcReGTfbE9N577tCTuBc=
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210510120150-4163338589ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 h1:hZR0X1kPW+nwyJ9xRxqZk1vx5RUObAPBdKVvXPDUH/E=
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
12 changes: 11 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
package main

func main() {
import (
"fmt"
"github.com/valyala/fasthttp"

"github.com/sinhashubham95/moxy/flags"
)

func main() {
err := fasthttp.ListenAndServe(fmt.Sprintf(":%d", flags.Port()), getFastHTTPHandler())
if err != nil {
return
}
}
Loading

0 comments on commit 0d32ba9

Please sign in to comment.