Exemple #1
0
func main() {

	// Flag handling
	var configFilePath = flag.String("config", "", "Read configuration from specified (JSON) file")
	flag.Parse()

	// Create new CAS Server config with default values
	config, err := cas.NewCASServerConfig(*configFilePath)
	if err != nil {
		log.Fatalf("Failed to create new CAS server configuration, err: %v", err)
	}

	// Create CAS Server (registers appropriate handlers to http)
	casServer, err := cas.NewCASServer(config)
	if err != nil {
		log.Fatal("Failed to create new CAS Server instance...", err)
	}

	// Start the CAS Server
	log.Printf("Starting CasGo on port %s...\n", casServer.Config["port"])
	casServer.Start()
}
Exemple #2
0
	"github.com/t3hmrman/casgo/cas"
	"testing"
)

// Testing globals for HTTP tests
var testCASConfig map[string]string
var testCASServer *cas.CAS

func TestCas(t *testing.T) {
	RegisterFailHandler(Fail)
	RunSpecs(t, "CasGo DB Adapter Suite")
}

var _ = BeforeSuite(func() {
	// Setup CAS server & DB
	testCASConfig, err := cas.NewCASServerConfig("")
	testCASConfig["companyName"] = "Casgo Testing Company"
	testCASConfig["dbName"] = "casgo_test"
	testCASConfig["templatesDirectory"] = "../templates"
	Expect(err).To(BeNil())

	testCASServer, err = cas.NewCASServer(testCASConfig)
	Expect(err).To(BeNil())

	err = testCASServer.SetupDb()
	Expect(err).To(BeNil())

	// Load database fixtures
	testCASServer.Db.LoadJSONFixture(
		testCASServer.Db.GetDbName(),
		testCASServer.Db.GetServicesTableName(),
Exemple #3
0
	"testing"
)

// Testing globals for HTTP tests
var testHTTPServer *httptest.Server
var testCASConfig map[string]string
var testCASServer *cas.CAS

func TestCasgoAPI(t *testing.T) {
	RegisterFailHandler(Fail)
	RunSpecs(t, "CasGo API Suite")
}

var _ = BeforeSuite(func() {
	// Setup CAS server & DB
	testCASConfig, _ = cas.NewCASServerConfig("")
	testCASConfig["companyName"] = "Casgo Testing Company"
	testCASConfig["dbName"] = "casgo_test"
	testCASConfig["templatesDirectory"] = "../templates"

	testCASServer, _ = cas.NewCASServer(testCASConfig)
	testCASServer.SetupDb()

	// Setup http test server
	testHTTPServer = httptest.NewTLSServer(testCASServer.ServeMux)

	// Load database fixtures
	testCASServer.Db.LoadJSONFixture(
		testCASServer.Db.GetDbName(),
		testCASServer.Db.GetServicesTableName(),
		"../../fixtures/services.json",