"github.com/cloudfoundry-incubator/ltc/exit_handler/fake_exit_handler"
	"github.com/cloudfoundry-incubator/ltc/logs/command_factory"
	"github.com/cloudfoundry-incubator/ltc/logs/console_tailed_logs_outputter/fake_tailed_logs_outputter"
	"github.com/cloudfoundry-incubator/ltc/task_examiner"
	"github.com/cloudfoundry-incubator/ltc/task_examiner/fake_task_examiner"
	"github.com/cloudfoundry-incubator/ltc/terminal"
	"github.com/cloudfoundry-incubator/ltc/test_helpers"
	"github.com/codegangsta/cli"
)

var _ = Describe("CommandFactory", func() {
	var (
		appExaminer             *fake_app_examiner.FakeAppExaminer
		taskExaminer            *fake_task_examiner.FakeTaskExaminer
		outputBuffer            *gbytes.Buffer
		terminalUI              terminal.UI
		fakeTailedLogsOutputter *fake_tailed_logs_outputter.FakeTailedLogsOutputter
		signalChan              chan os.Signal
		fakeExitHandler         *fake_exit_handler.FakeExitHandler
	)

	BeforeEach(func() {
		appExaminer = &fake_app_examiner.FakeAppExaminer{}
		taskExaminer = &fake_task_examiner.FakeTaskExaminer{}
		outputBuffer = gbytes.NewBuffer()
		terminalUI = terminal.NewUI(nil, outputBuffer, nil)
		fakeTailedLogsOutputter = fake_tailed_logs_outputter.NewFakeTailedLogsOutputter()
		signalChan = make(chan os.Signal)
		fakeExitHandler = &fake_exit_handler.FakeExitHandler{}
	})
	"github.com/cloudfoundry-incubator/ltc/exit_handler/fake_exit_handler"
	"github.com/cloudfoundry-incubator/ltc/task_examiner"
	"github.com/cloudfoundry-incubator/ltc/task_examiner/fake_task_examiner"
	"github.com/cloudfoundry-incubator/ltc/task_runner/command_factory"
	"github.com/cloudfoundry-incubator/ltc/task_runner/fake_task_runner"
	"github.com/cloudfoundry-incubator/ltc/terminal"
	"github.com/cloudfoundry-incubator/ltc/terminal/colors"
	"github.com/cloudfoundry-incubator/ltc/test_helpers"
	"github.com/codegangsta/cli"
)

var _ = Describe("TaskRunner CommandFactory", func() {
	var (
		outputBuffer     *gbytes.Buffer
		terminalUI       terminal.UI
		fakeTaskRunner   *fake_task_runner.FakeTaskRunner
		fakeTaskExaminer *fake_task_examiner.FakeTaskExaminer
		fakeExitHandler  *fake_exit_handler.FakeExitHandler
	)

	BeforeEach(func() {
		outputBuffer = gbytes.NewBuffer()
		terminalUI = terminal.NewUI(nil, outputBuffer, nil)
		fakeTaskRunner = &fake_task_runner.FakeTaskRunner{}
		fakeTaskExaminer = &fake_task_examiner.FakeTaskExaminer{}
		fakeExitHandler = &fake_exit_handler.FakeExitHandler{}
	})

	Describe("SubmitTaskCommand", func() {
		var (
			submitTaskCommand cli.Command
	"github.com/cloudfoundry-incubator/ltc/exit_handler/exit_codes"
	"github.com/cloudfoundry-incubator/ltc/exit_handler/fake_exit_handler"
	"github.com/cloudfoundry-incubator/ltc/task_examiner"
	"github.com/cloudfoundry-incubator/ltc/task_examiner/command_factory"
	"github.com/cloudfoundry-incubator/ltc/task_examiner/fake_task_examiner"
	"github.com/cloudfoundry-incubator/ltc/terminal"
	"github.com/cloudfoundry-incubator/ltc/terminal/colors"
	"github.com/cloudfoundry-incubator/ltc/test_helpers"
	"github.com/codegangsta/cli"
)

var _ = Describe("TaskExaminer CommandFactory", func() {
	var (
		fakeTaskExaminer *fake_task_examiner.FakeTaskExaminer
		outputBuffer     *gbytes.Buffer
		terminalUI       terminal.UI
		fakeExitHandler  *fake_exit_handler.FakeExitHandler
	)

	BeforeEach(func() {
		fakeTaskExaminer = &fake_task_examiner.FakeTaskExaminer{}
		outputBuffer = gbytes.NewBuffer()
		terminalUI = terminal.NewUI(nil, outputBuffer, nil)
		fakeExitHandler = &fake_exit_handler.FakeExitHandler{}
	})

	Describe("TaskCommand", func() {
		var taskCommand cli.Command

		BeforeEach(func() {
			commandFactory := command_factory.NewTaskExaminerCommandFactory(fakeTaskExaminer, terminalUI, fakeExitHandler)
	"github.com/codegangsta/cli"
	"github.com/pivotal-golang/clock/fakeclock"

	app_runner_command_factory "github.com/cloudfoundry-incubator/ltc/app_runner/command_factory"
	droplet_runner_command_factory "github.com/cloudfoundry-incubator/ltc/droplet_runner/command_factory"
)

var _ = Describe("CommandFactory", func() {
	var (
		outputBuffer            *gbytes.Buffer
		fakeDropletRunner       *fake_droplet_runner.FakeDropletRunner
		fakeExitHandler         *fake_exit_handler.FakeExitHandler
		fakeTailedLogsOutputter *fake_tailed_logs_outputter.FakeTailedLogsOutputter
		fakeClock               *fakeclock.FakeClock
		fakeAppExaminer         *fake_app_examiner.FakeAppExaminer
		fakeTaskExaminer        *fake_task_examiner.FakeTaskExaminer
		fakeCFIgnore            *fake_cf_ignore.FakeCFIgnore
		fakeZipper              *fake_zipper.FakeZipper
		fakeBlobStoreVerifier   *fake_blob_store_verifier.FakeBlobStoreVerifier
		config                  *config_package.Config

		appRunnerCommandFactory app_runner_command_factory.AppRunnerCommandFactory
	)

	BeforeEach(func() {
		fakeDropletRunner = &fake_droplet_runner.FakeDropletRunner{}
		fakeExitHandler = &fake_exit_handler.FakeExitHandler{}
		fakeTailedLogsOutputter = fake_tailed_logs_outputter.NewFakeTailedLogsOutputter()
		fakeClock = fakeclock.NewFakeClock(time.Now())
		fakeAppExaminer = &fake_app_examiner.FakeAppExaminer{}
		fakeTaskExaminer = &fake_task_examiner.FakeTaskExaminer{}
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"github.com/cloudfoundry-incubator/bbs/models"
	"github.com/cloudfoundry-incubator/ltc/task_examiner"
	"github.com/cloudfoundry-incubator/ltc/task_examiner/fake_task_examiner"
	"github.com/cloudfoundry-incubator/ltc/task_runner"
	"github.com/cloudfoundry-incubator/receptor"
	"github.com/cloudfoundry-incubator/receptor/fake_receptor"
	"github.com/pivotal-golang/clock/fakeclock"
)

var _ = Describe("TaskRunner", func() {
	var (
		fakeReceptorClient *fake_receptor.FakeClient
		taskRunner         task_runner.TaskRunner
		fakeTaskExaminer   *fake_task_examiner.FakeTaskExaminer
		fakeClock          *fakeclock.FakeClock
	)

	BeforeEach(func() {
		fakeReceptorClient = &fake_receptor.FakeClient{}
		fakeTaskExaminer = &fake_task_examiner.FakeTaskExaminer{}
		location, err := time.LoadLocation("Africa/Djibouti")
		Expect(err).NotTo(HaveOccurred())
		fakeClock = fakeclock.NewFakeClock(time.Date(2012, time.February, 29, 6, 45, 30, 820, location))
		taskRunner = task_runner.New(fakeReceptorClient, fakeTaskExaminer, fakeClock)
	})

	Describe("CreateTask", func() {
		var (
			action             *models.Action
	"github.com/cloudfoundry-incubator/ltc/terminal/cursor"
	"github.com/cloudfoundry-incubator/ltc/test_helpers"
	"github.com/codegangsta/cli"
	"github.com/pivotal-golang/clock/fakeclock"
)

const TerminalEsc = "\033["

var _ = Describe("CommandFactory", func() {

	var (
		fakeAppExaminer         *fake_app_examiner.FakeAppExaminer
		outputBuffer            *gbytes.Buffer
		terminalUI              terminal.UI
		fakeTerm                *fake_terminal.FakeTerminal
		fakeClock               *fakeclock.FakeClock
		osSignalChan            chan os.Signal
		fakeExitHandler         *fake_exit_handler.FakeExitHandler
		fakeGraphicalVisualizer *fake_graphical_visualizer.FakeGraphicalVisualizer
		fakeTaskExaminer        *fake_task_examiner.FakeTaskExaminer
		systemDomain            string
	)

	BeforeEach(func() {
		fakeAppExaminer = &fake_app_examiner.FakeAppExaminer{}
		fakeTaskExaminer = &fake_task_examiner.FakeTaskExaminer{}
		outputBuffer = gbytes.NewBuffer()
		terminalUI = terminal.NewUI(nil, outputBuffer, nil)
		fakeTerm = &fake_terminal.FakeTerminal{}
		osSignalChan = make(chan os.Signal, 1)
		location, err := time.LoadLocation("Africa/Djibouti")
		Expect(err).NotTo(HaveOccurred())