Skip to content

Commit e832a0d

Browse files
authored
Merge pull request #28 from delphi-hub/develop
Alpha Release
2 parents bddbaf4 + 7b5e1f2 commit e832a0d

40 files changed

+1729
-910
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ The web API implementation for the Delphi platform.
55
We are currently in pre-alpha state! There is no release and the code in
66
this repository is purely experimental!
77

8-
|branch | status | codacy |
9-
| :---: | :---: | :---: |
10-
| master | [![Build Status](https://travis-ci.org/delphi-hub/delphi-webapi.svg?branch=master)](https://travis-ci.org/delphi-hub/delphi-webapi) | [![Codacy Badge](https://api.codacy.com/project/badge/Grade/8ebe27850ffb4139af6280fd1cd6d540)](https://www.codacy.com/app/delphi-hub/delphi-webapi?utm_source=github.com&utm_medium=referral&utm_content=delphi-hub/delphi-webapi&utm_campaign=Badge_Grade)|
11-
| develop | [![Build Status](https://travis-ci.org/delphi-hub/delphi-webapi.svg?branch=develop)](https://travis-ci.org/delphi-hub/delphi-webapi) | [![Codacy Badge](https://api.codacy.com/project/badge/Grade/8ebe27850ffb4139af6280fd1cd6d540?branch=develop)](https://www.codacy.com/app/delphi-hub/delphi-webapi?branch=develop&utm_source=github.com&utm_medium=referral&utm_content=delphi-hub/delphi-webapi&utm_campaign=Badge_Grade) |
8+
|branch | status | codacy | snyk |
9+
| :---: | :---: | :---: | :---: |
10+
| master | [![Build Status](https://travis-ci.org/delphi-hub/delphi-webapi.svg?branch=master)](https://travis-ci.org/delphi-hub/delphi-webapi) | [![Codacy Badge](https://api.codacy.com/project/badge/Grade/8ebe27850ffb4139af6280fd1cd6d540)](https://www.codacy.com/app/delphi-hub/delphi-webapi?utm_source=github.com&utm_medium=referral&utm_content=delphi-hub/delphi-webapi&utm_campaign=Badge_Grade)| [![Known Vulnerabilities](https://snyk.io/test/github/delphi-hub/delphi-webapi/badge.svg?targetFile=build.sbt)](https://snyk.io/test/github/delphi-hub/delphi-webapi/?targetFile=build.sbt) |
11+
| develop | [![Build Status](https://travis-ci.org/delphi-hub/delphi-webapi.svg?branch=develop)](https://travis-ci.org/delphi-hub/delphi-webapi) | [![Codacy Badge](https://api.codacy.com/project/badge/Grade/8ebe27850ffb4139af6280fd1cd6d540?branch=develop)](https://www.codacy.com/app/delphi-hub/delphi-webapi?branch=develop&utm_source=github.com&utm_medium=referral&utm_content=delphi-hub/delphi-webapi&utm_campaign=Badge_Grade) | [![Known Vulnerabilities](https://snyk.io/test/github/delphi-hub/delphi-webapi/develop/badge.svg?targetFile=build.sbt)](https://snyk.io/test/github/delphi-hub/delphi-webapi/develop/?targetFile=build.sbt) |
1212

1313
## What is the Delphi Web API?
1414

build.sbt

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,42 @@ version := "1.0.0-SNAPSHOT"
44

55
scalaVersion := "2.12.4"
66

7-
libraryDependencies += "org.parboiled" %% "parboiled" % "2.1.4"
8-
libraryDependencies += "com.typesafe.akka" %% "akka-http" % "10.0.11"
9-
libraryDependencies += "com.typesafe.akka" %% "akka-stream" % "2.5.12"
10-
libraryDependencies += "com.typesafe.akka" %% "akka-http-spray-json" % "10.1.1"
11-
libraryDependencies += "io.spray" %% "spray-json" % "1.3.3"
12-
libraryDependencies += "org.parboiled" %% "parboiled" % "2.1.4"
13-
libraryDependencies += "org.scalactic" %% "scalactic" % "3.0.4"
14-
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.4" % "test"
7+
val akkaVersion = "2.5.14"
8+
libraryDependencies ++= Seq (
9+
"com.typesafe.akka" %% "akka-stream" % akkaVersion,
10+
"com.typesafe.akka" %% "akka-slf4j" % akkaVersion
11+
)
12+
13+
val akkaHttpVersion = "10.1.5"
14+
libraryDependencies ++= Seq (
15+
"com.typesafe.akka" %% "akka-http" % akkaHttpVersion,
16+
"com.typesafe.akka" %% "akka-http-testkit" % akkaHttpVersion,
17+
"com.typesafe.akka" %% "akka-http-spray-json" % akkaHttpVersion
18+
)
1519

1620
val elastic4sVersion = "6.3.0"
1721
libraryDependencies ++= Seq(
1822
"com.sksamuel.elastic4s" %% "elastic4s-core" % elastic4sVersion,
19-
20-
// for the http client
2123
"com.sksamuel.elastic4s" %% "elastic4s-http" % elastic4sVersion,
22-
23-
// if you want to use reactive streams
2424
"com.sksamuel.elastic4s" %% "elastic4s-http-streams" % elastic4sVersion,
25-
26-
// testing
27-
"com.sksamuel.elastic4s" %% "elastic4s-testkit" % elastic4sVersion % "test",
28-
"com.sksamuel.elastic4s" %% "elastic4s-embedded" % elastic4sVersion % "test"
2925
)
3026

27+
libraryDependencies += "org.parboiled" %% "parboiled" % "2.1.4"
28+
libraryDependencies += "io.spray" %% "spray-json" % "1.3.3"
29+
libraryDependencies += "org.scalactic" %% "scalactic" % "3.0.4"
30+
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.4" % "it,test"
31+
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.2.3" % Runtime
3132

3233
lazy val webapi = (project in file(".")).
34+
//https://www.scala-sbt.org/1.x/docs/Testing.html
35+
configs(IntegrationTest).
36+
settings(
37+
Defaults.itSettings,
38+
).
3339
enablePlugins(JavaAppPackaging).
3440
enablePlugins(DockerPlugin).
3541
enablePlugins(ScalastylePlugin).
36-
settings (
42+
settings(
3743
dockerBaseImage := "openjdk:jre-alpine"
3844
).
3945
enablePlugins(AshScriptPlugin).
@@ -44,3 +50,11 @@ lazy val webapi = (project in file(".")).
4450
)
4551

4652
scalastyleConfig := baseDirectory.value / "project" / "scalastyle-config.xml"
53+
54+
// Pinning secure versions of insecure transitive libraryDependencies
55+
// Please update when updating dependencies above (including Play plugin)
56+
libraryDependencies ++= Seq(
57+
"com.fasterxml.jackson.core" % "jackson-databind" % "2.9.7"
58+
)
59+
60+
trapExit := false

project/scalastyle-config.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
</check>
99
<check level="warning" class="org.scalastyle.file.HeaderMatchesChecker" enabled="true">
1010
<parameters>
11-
<parameter name="header"><![CDATA[// Copyright (C) 2011-2012 the original author or authors.
12-
// See the LICENCE.txt file distributed with this work for additional
11+
<parameter name="header"><![CDATA[// Copyright (C) 2018 The Delphi Team.
12+
// See the LICENCE file distributed with this work for additional
1313
// information regarding copyright ownership.
1414
//
1515
// Licensed under the Apache License, Version 2.0 (the "License");
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright (C) 2018 The Delphi Team.
2+
// See the LICENCE file distributed with this work for additional
3+
// information regarding copyright ownership.
4+
//
5+
// Licensed under the Apache License, Version 2.0 (the "License");
6+
// you may not use this file except in compliance with the License.
7+
// You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing, software
12+
// distributed under the License is distributed on an "AS IS" BASIS,
13+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
// See the License for the specific language governing permissions and
15+
// limitations under the License.
16+
17+
package de.upb.cs.swt.delphi.webapi
18+
19+
import org.scalatest.{FlatSpec, Matchers}
20+
21+
class FeatureQueryCheck extends FlatSpec with Matchers {
22+
"FeatureExtractor" should "provide a list of features" in {
23+
val configuration = new Configuration()
24+
val featureList = new FeatureQuery(configuration).featureList
25+
26+
featureList.size should be > 0
27+
}
28+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright (C) 2018 The Delphi Team.
2+
// See the LICENCE file distributed with this work for additional
3+
// information regarding copyright ownership.
4+
//
5+
// Licensed under the Apache License, Version 2.0 (the "License");
6+
// you may not use this file except in compliance with the License.
7+
// You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing, software
12+
// distributed under the License is distributed on an "AS IS" BASIS,
13+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
// See the License for the specific language governing permissions and
15+
// limitations under the License.
16+
17+
package de.upb.cs.swt.delphi.webapi
18+
19+
import de.upb.cs.swt.delphi.webapi.search.{QueryRequest, SearchQuery}
20+
import org.scalatest.{FlatSpec, Matchers}
21+
22+
import scala.util.Success
23+
24+
class SearchQueryTest extends FlatSpec with Matchers {
25+
"Search query" should "check for fields" in {
26+
val configuration = new Configuration()
27+
val q = new SearchQuery(configuration, new FeatureQuery(configuration))
28+
29+
val response = q.search(QueryRequest("[if_icmpeq (opcode:159)]>1"))
30+
response shouldBe a [Success[_]]
31+
}
32+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package de.upb.cs.swt.delphi.webapi
2+
3+
import org.scalatest.{FlatSpec, Matchers}
4+
5+
class StatisticsQueryCheck extends FlatSpec with Matchers {
6+
"Statics" should "be retrievable" in {
7+
val configuration = new Configuration()
8+
val stats = new StatisticsQuery(configuration)
9+
println(stats.retrieveStandardStatistics)
10+
}
11+
}

src/main/resources/application.conf

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,19 @@
1-
es-priority-mailbox {
2-
mailbox-type = "de.upb.cs.swt.delphi.webapi.ElasticPriorityMailbox"
3-
}
4-
51
akka.actor.deployment {
6-
/espriomailboxactor {
7-
mailbox = es-priority-mailbox
8-
}
2+
93
}
104

115
akka {
6+
7+
loggers = ["akka.event.slf4j.Slf4jLogger"]
8+
logLevel = "INFO"
9+
event-handlers = ["akka.event.slf4j.Slf4jEventHandler"]
10+
log-dead-letters = 0
11+
log-dead-letters-during-shutdown = off
12+
log-config-on-start = off
13+
1214
http {
1315
server {
1416
remote-address-header = on
1517
}
1618
}
1719
}
18-
19-
# Use this dispatcher for actors that make blocking calls to the Elasticsearch database
20-
elasticsearch-handling-dispatcher {
21-
type = Dispatcher
22-
executor = "thread-pool-executor"
23-
thread-pool-executor {
24-
fixed-pool-size = 4
25-
# This thread pool is intended for development purposes, and should be increased for production
26-
}
27-
throughput = 1
28-
}

src/main/resources/logback.xml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<!-- https://www.playframework.com/documentation/latest/SettingsLogger -->
2+
<configuration>
3+
4+
<!--<conversionRule conversionWord="coloredLevel" converterClass="play.api.libs.logback.ColoredLevel" />-->
5+
6+
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
7+
<file>${application.home:-.}/logs/application.log</file>
8+
<encoder>
9+
<pattern>[%level] [%date] from %logger in %thread - %message%n%xException</pattern>
10+
</encoder>
11+
</appender>
12+
13+
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
14+
<encoder>
15+
<pattern>[%date] %logger{15} - %message%n%xException{10}</pattern>
16+
</encoder>
17+
</appender>
18+
19+
<appender name="ASYNCFILE" class="ch.qos.logback.classic.AsyncAppender">
20+
<appender-ref ref="FILE" />
21+
</appender>
22+
23+
<appender name="ASYNCSTDOUT" class="ch.qos.logback.classic.AsyncAppender">
24+
<appender-ref ref="STDOUT" />
25+
</appender>
26+
27+
<logger name="de.upb.cs.swt.delphi" level="INFO" />
28+
<logger name="application" level="DEBUG" />
29+
30+
31+
<root level="WARN">
32+
<!--<appender-ref ref="ASYNCFILE" />-->
33+
<appender-ref ref="ASYNCSTDOUT" />
34+
</root>
35+
36+
</configuration>

src/main/scala/de/upb/cs/swt/delphi/featuredefinitions/FeatureDescription.scala

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)