<commit_before>// Copyright (c) 2016 - <NAME> <<EMAIL>>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package mongodb

import (
	"reflect"
	"testing"

	"github.com/looplab/eventhorizon"
	"github.com/looplab/eventhorizon/testutil"
)

// func (s *EventStoreSuite) SetUpSuite(c *C) {
// 	// Support Wercker testing with MongoDB.
// 	host := os.Getenv("WERCKER_MONGODB_HOST")
// 	port := os.Getenv("WERCKER_MONGODB_PORT")

// 	if host != "" && port != "" {
// 		s.url = host + ":" + port
// 	} else {
// 		s.url = "localhost"
// 	}
// }

func TestEventStore(t *testing.T) {
	bus := &testutil.MockEventBus{
		Events: make([]eventhorizon.Event, 0),
	}

	config := &EventStoreConfig{
		Table:  "eventhorizonTest-" + eventhorizon.NewUUID().String(),
		Region: "eu-west-1",
	}
	store, err := NewEventStore(bus, config)
	if err != nil {
		t.Fatal("there should be no error:", err)
	}
	if store == nil {
		t.Fatal("there should be a store")
	}

	if err = store.RegisterEventType(&testutil.TestEvent{}, func() eventhorizon.Event {
		return &testutil.TestEvent{}
	}); err != nil {
		t.Fatal("there should be no error:", err)
	}

	t.Log("creating table:", config.Table)
	if err := store.CreateTable(); err != nil {
		t.Fatal("could not create table:", err)
	}
<commit_msg>Remove unused test code<commit_after>// Copyright (c) 2016 - <NAME> <<EMAIL>>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package mongodb

import (
	"reflect"
	"testing"

	"github.com/looplab/eventhorizon"
	"github.com/looplab/eventhorizon/testutil"
)

func TestEventStore(t *testing.T) {
	bus := &testutil.MockEventBus{
		Events: make([]eventhorizon.Event, 0),
	}

	config := &EventStoreConfig{
		Table:  "eventhorizonTest-" + eventhorizon.NewUUID().String(),
		Region: "eu-west-1",
	}
	store, err := NewEventStore(bus, config)
	if err != nil {
		t.Fatal("there should be no error:", err)
	}
	if store == nil {
		t.Fatal("there should be a store")
	}

	if err = store.RegisterEventType(&testutil.TestEvent{}, func() eventhorizon.Event {
		return &testutil.TestEvent{}
	}); err != nil {
		t.Fatal("there should be no error:", err)
	}

	t.Log("creating table:", config.Table)
	if err := store.CreateTable(); err != nil {
		t.Fatal("could not create table:", err)
	}

{'fraction_non_alphanumeric': 0.14580129191018149, 'fraction_numerical': 0.006151953245155337, 'mean_word_length': 3.6127659574468085, 'pattern_counts': {'":': 1, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7040963', 'n_tokens_mistral': 1098, 'n_tokens_neox': 1054, 'n_words': 336}