Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ARSnova Scala Prototype
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
16
Issues
16
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ARSnova
ARSnova Scala Prototype
Commits
0977ebed
Commit
0977ebed
authored
Mar 20, 2017
by
Tom Käsler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement package/directory structure for tests
parent
070d242d
Pipeline
#7860
passed with stage
in 2 minutes and 18 seconds
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
59 additions
and
52 deletions
+59
-52
src/test/scala/de/thm/arsnova/BaseServiceSpec.scala
src/test/scala/de/thm/arsnova/BaseServiceSpec.scala
+5
-6
src/test/scala/de/thm/arsnova/ChoiceAnswerApiSpec.scala
src/test/scala/de/thm/arsnova/ChoiceAnswerApiSpec.scala
+7
-6
src/test/scala/de/thm/arsnova/CommentApiSpec.scala
src/test/scala/de/thm/arsnova/CommentApiSpec.scala
+8
-9
src/test/scala/de/thm/arsnova/FeaturesApiSpec.scala
src/test/scala/de/thm/arsnova/FeaturesApiSpec.scala
+7
-5
src/test/scala/de/thm/arsnova/FreetextAnswerApiSpec.scala
src/test/scala/de/thm/arsnova/FreetextAnswerApiSpec.scala
+8
-9
src/test/scala/de/thm/arsnova/HateoasSpec.scala
src/test/scala/de/thm/arsnova/HateoasSpec.scala
+7
-5
src/test/scala/de/thm/arsnova/QuestionApiSpec.scala
src/test/scala/de/thm/arsnova/QuestionApiSpec.scala
+7
-5
src/test/scala/de/thm/arsnova/SessionApiSpec.scala
src/test/scala/de/thm/arsnova/SessionApiSpec.scala
+7
-6
src/test/scala/de/thm/arsnova/TestData.scala
src/test/scala/de/thm/arsnova/TestData.scala
+3
-1
No files found.
src/test/scala/BaseServiceSpec.scala
→
src/test/scala/
de/thm/arsnova/
BaseServiceSpec.scala
View file @
0977ebed
import
services.BaseService
package
de.thm.arsnova
import
models.User
import
de.thm.arsnova.services.BaseService
import
de.thm.arsnova.models._
import
de.thm.arsnova.utils.
{
DatabaseConfig
,
MigrationConfig
}
import
akka.event.
{
NoLogging
,
LoggingAdapter
}
import
akka.event.
{
NoLogging
,
LoggingAdapter
}
import
utils.MigrationConfig
import
org.scalatest._
import
org.scalatest._
import
scala.concurrent.Await
import
scala.concurrent.Await
import
scala.concurrent.duration._
import
scala.concurrent.duration._
import
services.BaseService
import
models._
import
scala.language.existentials
import
scala.language.existentials
import
org.scalatest.BeforeAndAfterEach
import
org.scalatest.BeforeAndAfterEach
import
utils.DatabaseConfig
class
BaseServiceSpec
extends
FunSpec
with
Matchers
with
MigrationConfig
with
BeforeAndAfterAll
with
DatabaseConfig
class
BaseServiceSpec
extends
FunSpec
with
Matchers
with
MigrationConfig
with
BeforeAndAfterAll
with
DatabaseConfig
with
BaseService
with
HateoasSpec
with
SessionApiSpec
with
QuestionApiSpec
with
FreetextAnswerApiSpec
with
ChoiceAnswerApiSpec
with
CommentApiSpec
with
BaseService
with
HateoasSpec
with
SessionApiSpec
with
QuestionApiSpec
with
FreetextAnswerApiSpec
with
ChoiceAnswerApiSpec
with
CommentApiSpec
...
...
src/test/scala/ChoiceAnswerApiSpec.scala
→
src/test/scala/
de/thm/arsnova/
ChoiceAnswerApiSpec.scala
View file @
0977ebed
package
de.thm.arsnova
import
de.thm.arsnova.services.
{
BaseService
,
SessionService
}
import
de.thm.arsnova.models._
import
de.thm.arsnova.api.ChoiceAnswerApi
import
akka.http.scaladsl.model.
{
HttpEntity
,
MediaTypes
,
StatusCode
}
import
akka.http.scaladsl.model.
{
HttpEntity
,
MediaTypes
,
StatusCode
}
import
services.
{
BaseService
,
SessionService
}
import
models._
import
org.scalatest.concurrent.ScalaFutures
import
org.scalatest.concurrent.ScalaFutures
import
spray.json._
import
spray.json._
import
akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import
akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import
models._
import
api.ChoiceAnswerApi
import
akka.http.scaladsl.server.Directives._
import
akka.http.scaladsl.server.Directives._
import
akka.http.scaladsl.unmarshalling.Unmarshal
import
akka.http.scaladsl.unmarshalling.Unmarshal
...
@@ -13,7 +15,6 @@ import scala.concurrent.Future
...
@@ -13,7 +15,6 @@ import scala.concurrent.Future
import
akka.http.scaladsl.model.StatusCodes._
import
akka.http.scaladsl.model.StatusCodes._
import
akka.http.scaladsl.testkit.ScalatestRouteTest
import
akka.http.scaladsl.testkit.ScalatestRouteTest
import
org.scalatest.Matchers
import
org.scalatest.Matchers
import
services.BaseService
import
org.scalatest._
import
org.scalatest._
import
scala.concurrent.Await
import
scala.concurrent.Await
import
scala.concurrent.duration._
import
scala.concurrent.duration._
...
@@ -21,7 +22,7 @@ import akka.http.scaladsl.server.MissingQueryParamRejection
...
@@ -21,7 +22,7 @@ import akka.http.scaladsl.server.MissingQueryParamRejection
trait
ChoiceAnswerApiSpec
extends
FunSpec
with
Matchers
with
ScalaFutures
with
BaseService
with
ScalatestRouteTest
with
Routes
trait
ChoiceAnswerApiSpec
extends
FunSpec
with
Matchers
with
ScalaFutures
with
BaseService
with
ScalatestRouteTest
with
Routes
with
TestData
with
ChoiceAnswerApi
{
with
TestData
with
ChoiceAnswerApi
{
import
mappings.ChoiceAnswerJsonProtocol._
import
de.thm.arsnova.
mappings.ChoiceAnswerJsonProtocol._
describe
(
"ChoiceAnswer api"
)
{
describe
(
"ChoiceAnswer api"
)
{
it
(
"retrieve choice answers for question"
)
{
it
(
"retrieve choice answers for question"
)
{
Get
(
"/question/5/choiceAnswer"
)
~>
choiceAnswerApi
~>
check
{
Get
(
"/question/5/choiceAnswer"
)
~>
choiceAnswerApi
~>
check
{
...
...
src/test/scala/CommentApiSpec.scala
→
src/test/scala/
de/thm/arsnova/
CommentApiSpec.scala
View file @
0977ebed
package
de.thm.arsnova
import
de.thm.arsnova.services.
{
BaseService
,
SessionService
}
import
de.thm.arsnova.models._
import
de.thm.arsnova.api.CommentApi
import
akka.http.scaladsl.model.
{
HttpEntity
,
MediaTypes
,
StatusCode
}
import
akka.http.scaladsl.model.
{
HttpEntity
,
MediaTypes
,
StatusCode
}
import
services.
{
BaseService
,
SessionService
}
import
models._
import
org.scalatest.concurrent.ScalaFutures
import
org.scalatest.concurrent.ScalaFutures
import
spray.json._
import
spray.json._
import
akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import
akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import
models._
import
api.CommentApi
import
akka.http.scaladsl.server.Directives._
import
akka.http.scaladsl.server.Directives._
import
akka.http.scaladsl.unmarshalling.Unmarshal
import
akka.http.scaladsl.unmarshalling.Unmarshal
import
scala.concurrent.Future
import
akka.http.scaladsl.model.StatusCodes._
import
akka.http.scaladsl.model.StatusCodes._
import
akka.http.scaladsl.testkit.ScalatestRouteTest
import
akka.http.scaladsl.testkit.ScalatestRouteTest
import
org.scalatest.Matchers
import
org.scalatest.Matchers
import
services.BaseService
import
org.scalatest._
import
org.scalatest._
import
scala.concurrent.
{
Future
,
Await
}
import
scala.concurrent.Await
import
scala.concurrent.duration._
import
scala.concurrent.duration._
import
akka.http.scaladsl.server.MissingQueryParamRejection
import
akka.http.scaladsl.server.MissingQueryParamRejection
trait
CommentApiSpec
extends
FunSpec
with
Matchers
with
ScalaFutures
with
BaseService
with
ScalatestRouteTest
with
Routes
trait
CommentApiSpec
extends
FunSpec
with
Matchers
with
ScalaFutures
with
BaseService
with
ScalatestRouteTest
with
Routes
with
TestData
with
CommentApi
{
with
TestData
with
CommentApi
{
import
mappings.CommentJsonProtocol._
import
de.thm.arsnova.
mappings.CommentJsonProtocol._
describe
(
"Comment api"
)
{
describe
(
"Comment api"
)
{
it
(
"retrieve comment by id"
)
{
it
(
"retrieve comment by id"
)
{
...
...
src/test/scala/FeaturesApiSpec.scala
→
src/test/scala/
de/thm/arsnova/
FeaturesApiSpec.scala
View file @
0977ebed
package
de.thm.arsnova
import
de.thm.arsnova.services.
{
BaseService
,
FeaturesService
}
import
de.thm.arsnova.models._
import
de.thm.arsnova.api.FeaturesApi
import
akka.http.scaladsl.testkit.ScalatestRouteTest
import
akka.http.scaladsl.testkit.ScalatestRouteTest
import
org.scalatest.
{
FunSpec
,
Matchers
}
import
org.scalatest.
{
FunSpec
,
Matchers
}
import
org.scalatest.concurrent.ScalaFutures
import
org.scalatest.concurrent.ScalaFutures
import
services.BaseService
import
models._
import
api.FeaturesApi
import
services.FeaturesService
import
spray.json._
import
spray.json._
import
akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import
akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import
akka.http.scaladsl.model.
{
HttpEntity
,
MediaTypes
}
import
akka.http.scaladsl.model.
{
HttpEntity
,
MediaTypes
}
...
@@ -12,7 +14,7 @@ import akka.http.scaladsl.model.StatusCodes._
...
@@ -12,7 +14,7 @@ import akka.http.scaladsl.model.StatusCodes._
trait
FeaturesApiSpec
extends
FunSpec
with
Matchers
with
ScalaFutures
with
BaseService
with
ScalatestRouteTest
with
Routes
trait
FeaturesApiSpec
extends
FunSpec
with
Matchers
with
ScalaFutures
with
BaseService
with
ScalatestRouteTest
with
Routes
with
TestData
with
FeaturesApi
{
with
TestData
with
FeaturesApi
{
import
mappings.FeatureJsonProtocol._
import
de.thm.arsnova.
mappings.FeatureJsonProtocol._
describe
(
"Features api"
)
{
describe
(
"Features api"
)
{
it
(
"retrieve features by id"
)
{
it
(
"retrieve features by id"
)
{
Get
(
"/features/1"
)
~>
featuresApi
~>
check
{
Get
(
"/features/1"
)
~>
featuresApi
~>
check
{
...
...
src/test/scala/FreetextAnswerApiSpec.scala
→
src/test/scala/
de/thm/arsnova/
FreetextAnswerApiSpec.scala
View file @
0977ebed
package
de.thm.arsnova
import
de.thm.arsnova.services.
{
BaseService
,
SessionService
}
import
de.thm.arsnova.models._
import
de.thm.arsnova.api.FreetextAnswerApi
import
akka.http.scaladsl.model.
{
HttpEntity
,
MediaTypes
,
StatusCode
}
import
akka.http.scaladsl.model.
{
HttpEntity
,
MediaTypes
,
StatusCode
}
import
services.
{
BaseService
,
SessionService
}
import
models._
import
org.scalatest.concurrent.ScalaFutures
import
org.scalatest.concurrent.ScalaFutures
import
spray.json._
import
spray.json._
import
akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import
akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import
models._
import
api.FreetextAnswerApi
import
akka.http.scaladsl.server.Directives._
import
akka.http.scaladsl.server.Directives._
import
akka.http.scaladsl.unmarshalling.Unmarshal
import
akka.http.scaladsl.unmarshalling.Unmarshal
import
scala.concurrent.Future
import
akka.http.scaladsl.model.StatusCodes._
import
akka.http.scaladsl.model.StatusCodes._
import
akka.http.scaladsl.testkit.ScalatestRouteTest
import
akka.http.scaladsl.testkit.ScalatestRouteTest
import
org.scalatest.Matchers
import
org.scalatest.Matchers
import
services.BaseService
import
org.scalatest._
import
org.scalatest._
import
scala.concurrent.
Await
import
scala.concurrent.
{
Future
,
Await
}
import
scala.concurrent.duration._
import
scala.concurrent.duration._
import
akka.http.scaladsl.server.MissingQueryParamRejection
import
akka.http.scaladsl.server.MissingQueryParamRejection
trait
FreetextAnswerApiSpec
extends
FunSpec
with
Matchers
with
ScalaFutures
with
BaseService
with
ScalatestRouteTest
with
Routes
trait
FreetextAnswerApiSpec
extends
FunSpec
with
Matchers
with
ScalaFutures
with
BaseService
with
ScalatestRouteTest
with
Routes
with
TestData
with
FreetextAnswerApi
{
with
TestData
with
FreetextAnswerApi
{
import
mappings.FreetextAnswerJsonProtocol._
import
de.thm.arsnova.
mappings.FreetextAnswerJsonProtocol._
describe
(
"FreetextAnswer api"
)
{
describe
(
"FreetextAnswer api"
)
{
it
(
"retrieve freetext answers for question"
)
{
it
(
"retrieve freetext answers for question"
)
{
Get
(
"/question/1/freetextAnswer"
)
~>
freetextAnswerApi
~>
check
{
Get
(
"/question/1/freetextAnswer"
)
~>
freetextAnswerApi
~>
check
{
...
...
src/test/scala/HateoasSpec.scala
→
src/test/scala/
de/thm/arsnova/
HateoasSpec.scala
View file @
0977ebed
package
de.thm.arsnova
import
de.thm.arsnova.services.BaseService
import
de.thm.arsnova.hateoas._
import
de.thm.arsnova.api._
import
akka.http.scaladsl.testkit.ScalatestRouteTest
import
akka.http.scaladsl.testkit.ScalatestRouteTest
import
org.scalatest.
{
FunSpec
,
Matchers
}
import
org.scalatest.
{
FunSpec
,
Matchers
}
import
org.scalatest.concurrent.ScalaFutures
import
org.scalatest.concurrent.ScalaFutures
import
spray.json._
import
spray.json._
import
services.BaseService
import
scala.concurrent.
{
Future
,
Await
}
import
scala.concurrent.Future
import
scala.concurrent.Await
import
scala.concurrent.duration._
import
scala.concurrent.duration._
import
akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import
akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import
akka.http.scaladsl.unmarshalling.Unmarshal
import
akka.http.scaladsl.unmarshalling.Unmarshal
import
akka.http.scaladsl.server.Route
import
akka.http.scaladsl.server.Route
import
hateoas._
import
api._
trait
HateoasSpec
extends
FunSpec
with
Matchers
with
ScalaFutures
with
BaseService
with
ScalatestRouteTest
with
Routes
{
trait
HateoasSpec
extends
FunSpec
with
Matchers
with
ScalaFutures
with
BaseService
with
ScalatestRouteTest
with
Routes
{
import
hateoas.LinkJsonProtocol._
import
hateoas.LinkJsonProtocol._
...
...
src/test/scala/QuestionApiSpec.scala
→
src/test/scala/
de/thm/arsnova/
QuestionApiSpec.scala
View file @
0977ebed
package
de.thm.arsnova
import
de.thm.arsnova.services.
{
BaseService
,
SessionService
}
import
de.thm.arsnova.models._
import
de.thm.arsnova.api.QuestionApi
import
akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import
akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import
akka.http.scaladsl.unmarshalling._
import
akka.http.scaladsl.unmarshalling._
import
akka.http.scaladsl.model.
{
HttpEntity
,
MediaTypes
,
StatusCode
}
import
akka.http.scaladsl.model.
{
HttpEntity
,
MediaTypes
,
StatusCode
}
import
services.
{
BaseService
,
SessionService
}
import
models._
import
api.QuestionApi
import
org.scalatest.concurrent.ScalaFutures
import
org.scalatest.concurrent.ScalaFutures
import
spray.json._
import
spray.json._
import
akka.http.scaladsl.server.Directives._
import
akka.http.scaladsl.server.Directives._
import
scala.concurrent.Future
import
scala.concurrent.Future
import
scala.util.
{
Failure
,
Success
}
import
scala.util.
{
Failure
,
Success
}
import
akka.http.scaladsl.model.StatusCodes._
import
akka.http.scaladsl.model.StatusCodes._
...
@@ -16,7 +18,7 @@ import akka.http.scaladsl.server.MissingQueryParamRejection
...
@@ -16,7 +18,7 @@ import akka.http.scaladsl.server.MissingQueryParamRejection
import
org.scalatest.
{
FunSpec
,
Matchers
}
import
org.scalatest.
{
FunSpec
,
Matchers
}
trait
QuestionApiSpec
extends
FunSpec
with
Matchers
with
ScalaFutures
with
BaseService
with
ScalatestRouteTest
with
Routes
with
TestData
with
QuestionApi
{
trait
QuestionApiSpec
extends
FunSpec
with
Matchers
with
ScalaFutures
with
BaseService
with
ScalatestRouteTest
with
Routes
with
TestData
with
QuestionApi
{
import
mappings.QuestionJsonProtocol._
import
de.thm.arsnova.
mappings.QuestionJsonProtocol._
// you need to call unmarshal because of the question trait
// you need to call unmarshal because of the question trait
describe
(
"Question api"
)
{
describe
(
"Question api"
)
{
it
(
"retrieve question by id 1"
)
{
it
(
"retrieve question by id 1"
)
{
...
...
src/test/scala/SessionApiSpec.scala
→
src/test/scala/
de/thm/arsnova/
SessionApiSpec.scala
View file @
0977ebed
package
de.thm.arsnova
import
de.thm.arsnova.services.
{
BaseService
,
SessionService
}
import
de.thm.arsnova.models._
import
de.thm.arsnova.api.SessionApi
import
akka.http.scaladsl.model.
{
HttpEntity
,
MediaTypes
,
StatusCode
}
import
akka.http.scaladsl.model.
{
HttpEntity
,
MediaTypes
,
StatusCode
}
import
services.
{
BaseService
,
SessionService
}
import
models._
import
api.SessionApi
import
org.scalatest.concurrent.ScalaFutures
import
org.scalatest.concurrent.ScalaFutures
import
spray.json._
import
spray.json._
import
akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import
akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import
models._
import
akka.http.scaladsl.server.Directives._
import
akka.http.scaladsl.server.Directives._
import
akka.http.scaladsl.unmarshalling.Unmarshal
import
akka.http.scaladsl.unmarshalling.Unmarshal
...
@@ -13,12 +15,11 @@ import scala.concurrent.Future
...
@@ -13,12 +15,11 @@ import scala.concurrent.Future
import
akka.http.scaladsl.model.StatusCodes._
import
akka.http.scaladsl.model.StatusCodes._
import
akka.http.scaladsl.testkit.ScalatestRouteTest
import
akka.http.scaladsl.testkit.ScalatestRouteTest
import
org.scalatest.Matchers
import
org.scalatest.Matchers
import
services.BaseService
import
org.scalatest._
import
org.scalatest._
import
akka.http.scaladsl.server.MissingQueryParamRejection
import
akka.http.scaladsl.server.MissingQueryParamRejection
trait
SessionApiSpec
extends
FunSpec
with
Matchers
with
ScalaFutures
with
BaseService
with
ScalatestRouteTest
with
Routes
with
TestData
with
SessionApi
{
trait
SessionApiSpec
extends
FunSpec
with
Matchers
with
ScalaFutures
with
BaseService
with
ScalatestRouteTest
with
Routes
with
TestData
with
SessionApi
{
import
mappings.SessionJsonProtocol._
import
de.thm.arsnova.
mappings.SessionJsonProtocol._
describe
(
"Session api"
)
{
describe
(
"Session api"
)
{
it
(
"retrieve sessions for user 1"
)
{
it
(
"retrieve sessions for user 1"
)
{
...
...
src/test/scala/TestData.scala
→
src/test/scala/
de/thm/arsnova/
TestData.scala
View file @
0977ebed
import
models._
package
de.thm.arsnova
import
de.thm.arsnova.models._
trait
TestData
{
trait
TestData
{
val
FOUR
=
4
val
FOUR
=
4
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment