/* sbt -- Simple Build Tool
 * Copyright 2009 Mark Harrah
 */
package sbt.impl

import java.io.File
import scala.collection.mutable.{HashMap, Map}

/** Only intended to be used once per instance. */
private[sbt] class class TestStatusReporter extends java.lang.Object with sbt.TestsListener with ScalaObjectTestStatusReporter(sbt.Pathpath: sbt.PathPath, sbt.Loggerlog: sbt.LoggerLogger) extends sbt.TestsListenerTestsListener
{
	private lazy val scala.collection.mutable.Map[String,Long]succeeded: scala.collection.mutable.Map[String,Long]Map[String, Long] = object sbt.impl.TestStatusTestStatus.(sbt.Path,sbt.Logger)scala.collection.mutable.Map[String,Long]read(sbt.Pathpath, sbt.Loggerlog)

	def => UnitdoInit Unit{}
	def (String)UnitstartGroup(Stringname: StringString) { => scala.collection.mutable.Map[String,Long]succeeded (String)Option[Long]removeKey Stringname }
	def (sbt.TestEvent)UnittestEvent(sbt.TestEventevent: sbt.TestEventTestEvent) Unit{}
	def (String,Throwable)UnitendGroup(Stringname: StringString, Throwablet: ThrowableThrowable) Unit{}
	def (String,sbt.Result.Value)UnitendGroup(Stringname: StringString, sbt.Result.Valueresult: Result.sbt.Result.ValueValue)
	{
		Unitif(sbt.Result.Valueresult (AnyRef)Boolean== object sbt.ResultResult.=> sbt.Result.ValuePassed)
			=> scala.collection.mutable.Map[String,Long]succeeded(Stringname) = object java.lang.SystemSystem.()LongcurrentTimeMillis
	}
	def (sbt.Result.Value)UnitdoComplete(sbt.Result.ValuefinalResult: Result.sbt.Result.ValueValue) { ()Unitcomplete() }
	def (Throwable)UnitdoComplete(Throwablet: ThrowableThrowable) { ()Unitcomplete() }
	
	private def ()Unitcomplete()
	{
		object sbt.impl.TestStatusTestStatus.(scala.collection.mutable.Map[String,Long],String,sbt.Path,sbt.Logger)Unitwrite(=> scala.collection.mutable.Map[String,Long]succeeded, java.lang.String("Successful Tests")"Successful Tests", sbt.Pathpath, sbt.Loggerlog)
	}
}

private[sbt] class class TestQuickFilter extends java.lang.Object with (String) => Boolean with NotNull with ScalaObjectTestQuickFilter(sbt.CompileAnalysistestAnalysis: sbt.CompileAnalysisCompileAnalysis, BooleanfailedOnly: BooleanBoolean, sbt.Pathpath: sbt.PathPath, sbt.Loggerlog: sbt.LoggerLogger) extends (String => Boolean) with NotNullNotNull
{
	private lazy val scala.collection.mutable.Map[String,Long]exclude = object sbt.impl.TestStatusTestStatus.(sbt.Path,sbt.Logger)scala.collection.mutable.Map[String,Long]read(sbt.Pathpath, sbt.Loggerlog)
	private lazy val scala.collection.mutable.Map[String,sbt.Path]map = sbt.CompileAnalysistestAnalysis.=> scala.collection.mutable.Map[String,sbt.Path]testSourceMap
	def (String)Booleanapply(Stringtest: StringString) =
		=> scala.collection.mutable.Map[String,Long]exclude.(String)Option[Long]get(Stringtest) Booleanmatch
		{
			Boolean(true)case object NoneNone => Boolean(true)true // include because this test has not been run or did not succeed
			Booleancase Some(LonglastSuccessTime) => // succeeded the last time it was run
				Booleanif(BooleanfailedOnly)
					Boolean(false)false // don't include because the last time succeeded
				else
					sbt.CompileAnalysistestAnalysis.(sbt.Path)Option[scala.collection.mutable.Set[sbt.Path]]products((String)sbt.Pathmap(Stringtest)) Booleanmatch
					{
						Boolean(true)case object NoneNone => Boolean(true)true
						Booleancase Some(scala.collection.mutable.Set[sbt.Path]products) => scala.collection.mutable.Set[sbt.Path]products.((sbt.Path) => Boolean)Booleanexists(LonglastSuccessTime (Long)Boolean<= sbt.Path_.=> LonglastModified) // include if the test is newer than the last run
					}
		}
}
private object object sbt.impl.TestStatusTestStatus
{
	import java.util.Properties
	def (sbt.Path,sbt.Logger)scala.collection.mutable.Map[String,Long]read(sbt.Pathpath: sbt.PathPath, sbt.Loggerlog: sbt.LoggerLogger): scala.collection.mutable.Map[String,Long]Map[String, Long] =
	{
		val scala.collection.mutable.HashMap[String,Long]map = scala.collection.mutable.HashMap[String,Long]new scala.collection.mutable.HashMap[String,Long]HashMap[String, Long]
		val java.util.Propertiesproperties = java.util.Propertiesnew java.util.PropertiesProperties
		(Option[String],String,sbt.Logger)UnitlogError(object sbt.PropertiesUtilitiesPropertiesUtilities.(java.util.Properties,sbt.Path,sbt.Logger)Option[String]load(java.util.Propertiesproperties, sbt.Pathpath, sbt.Loggerlog), java.lang.String("loading")"loading", sbt.Loggerlog)
		for(((String) => Unit)Unittest <- object sbt.PropertiesUtilitiesPropertiesUtilities.(java.util.Properties)Iterable[String]propertyNames(java.util.Propertiesproperties))
			scala.collection.mutable.HashMap[String,Long]map.(String,Long)Option[Long]put(Stringtest, java.util.Propertiesproperties.implicit scala.Predef.stringWrapper : (String)scala.runtime.RichStringgetProperty(Stringtest).=> LongtoLong)
		scala.collection.mutable.HashMap[String,Long]map
	}
	def (scala.collection.mutable.Map[String,Long],String,sbt.Path,sbt.Logger)Unitwrite(scala.collection.mutable.Map[String,Long]map: scala.collection.mutable.Map[String,Long]Map[String, Long], Stringlabel: StringString, sbt.Pathpath: sbt.PathPath, sbt.Loggerlog: sbt.LoggerLogger)
	{
		val java.util.Propertiesproperties = java.util.Propertiesnew java.util.PropertiesProperties
		for( (((String, Long)) => Unit)Unit(Stringtest, LonglastSuccessTime) <- scala.collection.mutable.Map[String,Long]map)
			java.util.Propertiesproperties.(java.lang.String,java.lang.String)java.lang.ObjectsetProperty(Stringtest, LonglastSuccessTime.()java.lang.StringtoString)
		(Option[String],String,sbt.Logger)UnitlogError(object sbt.PropertiesUtilitiesPropertiesUtilities.(java.util.Properties,String,sbt.Path,sbt.Logger)Option[String]write(java.util.Propertiesproperties, Stringlabel, sbt.Pathpath, sbt.Loggerlog), java.lang.String("writing")"writing", sbt.Loggerlog)
	}
	private def (Option[String],String,sbt.Logger)UnitlogError(Option[String]result: Option[String]Option[String], Stringaction: StringString, sbt.Loggerlog: sbt.LoggerLogger)
	{
		Option[String]result.((String) => Unit)Unitforeach(Stringmsg => sbt.Loggerlog.(=> String)Uniterror(java.lang.String("Error ")"Error " (Any)java.lang.String+ Stringaction (Any)java.lang.String+ java.lang.String(" test status: ")" test status: " (Any)java.lang.String+ Stringmsg))
	}
}