Skip to content

Commit

Permalink
Merged local changes
Browse files Browse the repository at this point in the history
  • Loading branch information
petrhosek committed Jan 21, 2012
1 parent 45e6717 commit 05402cd
Show file tree
Hide file tree
Showing 12 changed files with 100 additions and 77 deletions.
15 changes: 15 additions & 0 deletions .idea/codeStyleSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/highlighting.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/scopes/scope_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 14 additions & 11 deletions build.sbt
Expand Up @@ -22,20 +22,23 @@ libraryDependencies ++= {

libraryDependencies ++= Seq(
"joda-time" % "joda-time" % "1.6.2" % "compile",
"org.eclipse.jetty" % "jetty-webapp" % "7.3.0.v20110203" % "test,container",
"ch.qos.logback" % "logback-classic" % "0.9.26",
"org.eclipse.jetty" % "jetty-webapp" % "8.0.1.v20110908" % "test,container",
"javax.servlet" % "servlet-api" % "2.5" % "provided",
"ch.qos.logback" % "logback-classic" % "0.9.26" % "compile",
"junit" % "junit" % "4.8.2" % "test->default",
"org.jmock" % "jmock-junit4" % "2.5.1" % "test->default",
"org.jmock" % "jmock-legacy" %"2.5.1" % "test->default",
"org.mockito" % "mockito-all" % "1.9.0-rc1" % "test->default",
"cglib" % "cglib" %"2.1_3" % "test->default",
"org.objenesis" % "objenesis" %"1.0" % "test->default",
"org.scala-tools.testing" % "specs_2.8.1" % "1.6.6" % "test->default",
"org.specs2" % "specs2_2.9.0" % "1.5" % "test->default",
"org.specs2" % "specs2-scalaz-core_2.9.0" % "6.0.RC2" % "test->default",
"org.seleniumhq.selenium" % "selenium-firefox-driver" % "2.5.0" % "test->default",
"org.seleniumhq.selenium" % "selenium-server" % "2.5.0" % "test->default",
"com.h2database" % "h2" % "1.2.144" % "runtime",
"postgresql" % "postgresql" % "8.4-701.jdbc4" % "runtime"
)

resolvers += ScalaToolsSnapshots

resolvers += "Java.net Repo" at "http://download.java.net/maven/2/"
)

resolvers ++= Seq(
"snapshots" at "http://scala-tools.org/repo-snapshots",
"releases" at "http://scala-tools.org/repo-releases",
"Jetty Repo" at "http://repo1.maven.org/maven2/org/mortbay/jetty",
"Java.net Repo" at "http://download.java.net/maven/2/"
)
File renamed without changes.
2 changes: 1 addition & 1 deletion scala
Submodule scala updated from 68bbb2 to e5b07e
16 changes: 9 additions & 7 deletions src/main/scala/scala/tools/colladoc/model/SearchIndex.scala
Expand Up @@ -179,13 +179,15 @@ class SearchIndex(rootPackage : Package, indexDirectory : Directory, commentToSt
// We could be dealing with a huge list here so it's important that we cons
// as efficiently as possible.
var remainingMembers = members.tail
additionalMembers.foreach((m)=> {
// Make sure that we do not try to index a member that we have indexed
// already!
if (!entityLookup.containsValue(m)) {
remainingMembers = m :: remainingMembers
}
})
if (!additionalMembers.isEmpty) {
additionalMembers.foreach((m)=> {
// Make sure that we do not try to index a member that we have indexed
// already!
if (!entityLookup.containsValue(m)) {
remainingMembers = m :: remainingMembers
}
})
}

// Finally, the recursive step, index the remaining members...
// NOTE: Tail call recursion is REQUIRED here because of the depth of
Expand Down
@@ -1,21 +1,24 @@
package scala.tools.colladoc.integration

import org.specs.Specification
import org.specs2.mutable._
import org.specs2.specification._
import org.eclipse.jetty.server.Server
import org.eclipse.jetty.webapp.WebAppContext
import org.openqa.selenium.server.{RemoteControlConfiguration, SeleniumServer}
import com.thoughtworks.selenium.DefaultSelenium
import tools.colladoc.lib.DependencyFactory
import tools.colladoc.util.TestProps

object SearchEndToEndTests extends Specification {
trait SearchEndToEndTests extends Specification {
private val pageLoadTimeoutInMs = "30000"

private var server : Server = null
private var selenium : DefaultSelenium = null
private var seleniumServer : SeleniumServer = null

doBeforeSpec {
override def map(fs: => Fragments) = Step(startSelenium) ^ fs ^ Step(stopSelenium)

def startSelenium = {
val GUI_PORT = 8080
val SELENIUM_SERVER_PORT = 4444

Expand Down Expand Up @@ -43,12 +46,20 @@ object SearchEndToEndTests extends Specification {

// Setting up the Selenium Client for the duration of the tests
selenium = new DefaultSelenium("localhost",
SELENIUM_SERVER_PORT,
"*firefox",
"http://localhost:"+GUI_PORT+"/")
SELENIUM_SERVER_PORT,
"*firefox",
"http://localhost:"+GUI_PORT+"/")
selenium.start()
}

def stopSelenium = {
// Close everything when done
selenium.close()
selenium.stop()
server.stop()
seleniumServer.stop()
}

// TODO: setup selenium in the right way!
/*"a user" should {
// We want to share the same selenium objects throughout all examples.
Expand Down Expand Up @@ -88,14 +99,6 @@ object SearchEndToEndTests extends Specification {
}
}*/

doAfterSpec {
// Close everything when done
selenium.close()
selenium.stop()
server.stop()
seleniumServer.stop()
}

private def enterSearchQuery(q : String) = {
selenium.`type`("svalue", q)
selenium.click("searchbtn")
Expand Down
@@ -1,13 +1,13 @@
package scala.tools.colladoc.model

import org.specs.mock._
import org.specs2.mock._
import tools.nsc.doc.model._

/**
* Mock for the Classes, traits and Objects
* @author: rumi
*/
trait DocTemplateEntityMock extends AnyRef with JMocker with ClassMocker {
trait DocTemplateEntityMock extends Mockito {
val mockClass = mock[Class]
val mockTrait = mock[Trait]
val mockObject = mock[Object]
Expand All @@ -22,19 +22,17 @@ trait DocTemplateEntityMock extends AnyRef with JMocker with ClassMocker {
val notTraitTemplateEntityName = "NotTestTrait"

def expectationsForDocTemplateEntity(mockEntity: DocTemplateEntity) {
expect {
one(mockEntity).linearizationTemplates willReturn (List[TemplateEntity](traitTemplateEntity, notTraitTemplateEntity))
there was one(mockEntity).linearizationTemplates returns (List[TemplateEntity](traitTemplateEntity, notTraitTemplateEntity))

// From all TemplateEntities for the class(all with) get the name only for the one that are Traits
// Make sure that if EntityTemplate is not a trait its name is not added
one(traitTemplateEntity).name willReturn traitTemplateEntityName
one(notTraitTemplateEntity).name willReturn notTraitTemplateEntityName
allowing(traitTemplateEntity).isTrait willReturn true
allowing(notTraitTemplateEntity).isTrait willReturn false
// From all TemplateEntities for the class(all with) get the name only for the one that are Traits
// Make sure that if EntityTemplate is not a trait its name is not added
there was one(traitTemplateEntity).name returns traitTemplateEntityName
there was one(notTraitTemplateEntity).name returns notTraitTemplateEntityName
traitTemplateEntity.isTrait returns true
notTraitTemplateEntity.isTrait returns false

// Get the visibility of the class
one(mockEntity).visibility willReturn mockVisibility
one(mockVisibility).isPublic willReturn true
}
// Get the visibility of the class
there was one(mockEntity).visibility returns mockVisibility
there was one(mockVisibility).isPublic returns true
}
}
44 changes: 17 additions & 27 deletions src/test/scala/scala/tools/colladoc/model/EntityMemberMock.scala
@@ -1,6 +1,6 @@
package scala.tools.colladoc.model

import org.specs.mock._
import org.specs2.mock._
import tools.nsc.doc.model._
import tools.nsc.doc.model.comment.{Body, Comment}
import mapper.CommentToString
Expand All @@ -9,7 +9,7 @@ import mapper.CommentToString
* Mock for entity member.
* @author rumi
*/
trait EntityMemberMock extends AnyRef with JMocker with ClassMocker {
trait EntityMemberMock extends Mockito {
// Package
var mockPackage: Package = _
val packageName = "Mocked Package"
Expand All @@ -36,44 +36,34 @@ trait EntityMemberMock extends AnyRef with JMocker with ClassMocker {
}

def expectationsForEmptyPackage = {
expect {
defaultExpectationsForPackage()
one(mockPackage).members willReturn (List[MemberEntity]())
}
defaultExpectationsForPackage()
one(mockPackage).members willReturn (List[MemberEntity]())
}

def expectationsForPackageWithEntity(memberEntity: MemberEntity) = {
expect {
defaultExpectationsForPackage()
one(mockPackage).members willReturn (List[MemberEntity](memberEntity))
}
defaultExpectationsForPackage()
one(mockPackage).members willReturn (List[MemberEntity](memberEntity))
}

def expectationsForAnyMemberEntityWithUserComment(mockEntity: MemberEntity) = {
expect {
one(mockEntity).name willReturn entityName
one(commentMapper).latestToString(mockEntity) willReturn (Some(defaultUserComment))
allowingMatch("members")
}
one(mockEntity).name willReturn entityName
one(commentMapper).latestToString(mockEntity) willReturn (Some(defaultUserComment))
allowingMatch("members")
}

def expectationsForAnyMemberEntityWithComment(mockEntity: MemberEntity) = {
val entityComment: Comment = new TestComment()
expect {
one(mockEntity).name willReturn entityName
one(commentMapper).latestToString(mockEntity) willReturn (None)
one(mockEntity).comment willReturn (Some(entityComment))
allowingMatch("members")
}
one(mockEntity).name willReturn entityName
one(commentMapper).latestToString(mockEntity) willReturn (None)
one(mockEntity).comment willReturn (Some(entityComment))
allowingMatch("members")
}

def expectationsForAnyMemberEntityWithoutComment(mockEntity: MemberEntity) = {
expect {
one(mockEntity).name willReturn entityName
one(commentMapper).latestToString(mockEntity) willReturn (None)
one(mockEntity).comment willReturn (None)
allowingMatch("members")
}
one(mockEntity).name willReturn entityName
one(commentMapper).latestToString(mockEntity) willReturn (None)
one(mockEntity).comment willReturn (None)
allowingMatch("members")
}

// Although Comment class can be mocked, expectations cannot be applied to the toString method
Expand Down
@@ -1,7 +1,7 @@
package scala.tools.colladoc.model

import tools.nsc.doc.model._
import org.specs.SpecificationWithJUnit
import org.specs2.SpecificationWithJUnit
import tools.nsc.doc.model.MemberEntity
import org.apache.lucene.store.{RAMDirectory, Directory}
import tools.nsc.doc.model.Package
Expand Down

0 comments on commit 05402cd

Please sign in to comment.