예제 #1
0
파일: main.go 프로젝트: jostyee/casgo
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()
}
예제 #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(),
예제 #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",