Exemplo n.º 1
0
func main() {
	service := goa.New("cfbroker")
	configuration, err := config.Load("./config.yaml")
	if err != nil {
		panic(err)
	}

	store, err := storage.NewLocalFile("/tmp/data")
	if err != nil {
		panic(err)
	}

	provisioningController := controllers.NewProvisioning(store)
	catalogController := commoncontrollers.NewCatalog(configuration.Catalog)

	app.MountCatalogController(service, catalogController)
	app.MountProvisioningController(service, provisioningController)

	swagger.MountController(service)
	service.ListenAndServe(":8080")
}
Exemplo n.º 2
0
	"github.com/tscolari/memcached-broker/config"
	"golang.org/x/net/context"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Catalog", func() {
	var catalogConfig app.CfbrokerCatalog
	var catalogController *controllers.Catalog

	BeforeEach(func() {
		config, err := config.Load("./assets/valid.config.yml")
		Expect(err).ToNot(HaveOccurred())
		catalogConfig = config.Catalog
		catalogController = controllers.NewCatalog(catalogConfig)
	})

	Describe("#Show", func() {
		var goaContext *goa.Context
		var catalogContext *app.ShowCatalogContext
		var responseWriter *httptest.ResponseRecorder

		BeforeEach(func() {
			gctx := context.Background()
			req := http.Request{}
			responseWriter = httptest.NewRecorder()
			params := url.Values{}
			payload := map[string]string{}

			goaContext = goa.NewContext(gctx, &req, responseWriter, params, payload)