-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from delphi-hub/develop
Update to 0.9.1
- Loading branch information
Showing
11 changed files
with
142 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
language: scala | ||
scala: | ||
- 2.12.4 | ||
- 2.12.10 | ||
- 2.13.1 | ||
script: | ||
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then sbt ++$TRAVIS_SCALA_VERSION test; fi' | ||
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then sbt ++$TRAVIS_SCALA_VERSION coverage test coverageReport coverageAggregate codacyCoverage; fi' | ||
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then sbt ++$TRAVIS_SCALA_VERSION test; fi' | ||
# - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then sbt ++$TRAVIS_SCALA_VERSION coverage test coverageReport coverageAggregate codacyCoverage; fi' | ||
after_success: | ||
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash <(curl -s https://codecov.io/bash); fi' | ||
# - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash <(curl -s https://codecov.io/bash); fi' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
name := "delphi-client" | ||
|
||
libraryDependencies += "io.spray" %% "spray-json" % "1.3.5" | ||
libraryDependencies += "joda-time" % "joda-time" % "2.10.5" | ||
|
||
|
||
libraryDependencies ++= Seq( | ||
"com.softwaremill.sttp" %% "core" % "1.7.2", | ||
"com.softwaremill.sttp" %% "spray-json" % "1.7.2" | ||
) | ||
|
||
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.8" % "test" |
33 changes: 33 additions & 0 deletions
33
client/src/main/scala/de/upb/cs/swt/delphi/client/DelphiClient.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package de.upb.cs.swt.delphi.client | ||
|
||
import com.softwaremill.sttp._ | ||
import com.softwaremill.sttp.sprayJson._ | ||
import spray.json._ | ||
|
||
import scala.util.Try | ||
import de.upb.cs.swt.delphi.core.model.Artifact | ||
import de.upb.cs.swt.delphi.client.QueryJson._ | ||
|
||
abstract class DelphiClient(baseUri : String) { | ||
def search(query : Query, prettyPrint : Boolean = false) : Try[Seq[SearchResult]] | ||
/* = { | ||
val queryParams = prettyPrint match { | ||
case true => Map("pretty" -> "") | ||
case false => Map() | ||
} | ||
val searchUri = uri"${baseUri}/search?$queryParams" | ||
val request = sttp.body(query.toJson).post(searchUri) | ||
//val (res, time) = processRequest(request) | ||
//res.foreach(processResults(_, time)) | ||
}*/ | ||
|
||
def features() : Try[Seq[FieldDefinition]] | ||
|
||
def retrieve(identifier : String) : Try[Artifact] | ||
|
||
def version() : Try[String] | ||
|
||
def statistics() : Try[Statistics] | ||
} |
25 changes: 25 additions & 0 deletions
25
client/src/main/scala/de/upb/cs/swt/delphi/client/FieldDefinition.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (C) 2018 The Delphi Team. | ||
// See the LICENCE file distributed with this work for additional | ||
// information regarding copyright ownership. | ||
// | ||
// 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 de.upb.cs.swt.delphi.client | ||
|
||
import spray.json.DefaultJsonProtocol | ||
|
||
case class FieldDefinition(name : String, description : String) | ||
|
||
object FieldDefinitionJson extends DefaultJsonProtocol { | ||
implicit val transform = jsonFormat2(FieldDefinition) | ||
} |
9 changes: 9 additions & 0 deletions
9
client/src/main/scala/de/upb/cs/swt/delphi/client/Query.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package de.upb.cs.swt.delphi.client | ||
|
||
import spray.json.DefaultJsonProtocol | ||
|
||
case class Query(query : String, limit : Option[Int] = Some(50)) | ||
|
||
object QueryJson extends DefaultJsonProtocol { | ||
implicit val queryRequestFormat = jsonFormat2(Query) | ||
} |
3 changes: 3 additions & 0 deletions
3
client/src/main/scala/de/upb/cs/swt/delphi/client/Statistics.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package de.upb.cs.swt.delphi.client | ||
|
||
case class Statistics(total : Long, hermesEnabled : Long) |
7 changes: 7 additions & 0 deletions
7
client/src/main/scala/de/upb/cs/swt/delphi/client/StatisticsJson.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package de.upb.cs.swt.delphi.client | ||
|
||
import spray.json.DefaultJsonProtocol | ||
|
||
object StatisticsJson extends DefaultJsonProtocol { | ||
implicit val statisticsFormat = jsonFormat2(Statistics) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (C) 2019 The Delphi Team. | ||
// See the LICENCE file distributed with this work for additional | ||
// information regarding copyright ownership. | ||
// | ||
// 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. | ||
|
||
// build management and packaging | ||
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0") | ||
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.5.1") | ||
|
||
// coverage | ||
//addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1") | ||
//addSbtPlugin("com.codacy" % "sbt-codacy-coverage" % "3.0.3") | ||
|
||
// preparation for dependency checking | ||
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.9.1") | ||
|
||
// scalastyle | ||
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0") |