Skip to content

Commit

Permalink
Merge pull request #584 from naphelps/dependency-updates
Browse files Browse the repository at this point in the history
v2.87.2 - Dependency Updates
  • Loading branch information
naphelps authored May 4, 2022
2 parents 5ece3df + 4c8c175 commit 9d141da
Show file tree
Hide file tree
Showing 28 changed files with 162 additions and 104 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,31 @@ Now you can disable root by setting `api.root.enabled` to `false` in `/etc/horiz
- detect if a pattern is updated with service that has userInput w/o default values, and give warning
- Consider changing all creates to POST, and update (via put/patch) return codes to 200

## Changes in 2.87.2
- Dependency updates.
- akka-http 10.2.4 -> 10.2.7
- akka-http-jackson 1.37.0 -> 1.39.2
- akka-http-xml 10.2.4 -> 10.2.7
- akka-http-testkit 10.2.4 -> 10.2.7
- akka-stream-testkit 2.6.14 -> 2.6.16
- akka-testkit 2.6.14 -> 2.6.16
- json4s-native 3.6.6 -> 4.0.5
- json4s-jackson 3.6.6 -> 4.0.5
- postgresql 42.2.19 -> 42.3.4
- scala 2.13.5 -> 2.13.8
- slf4j-simple 1.7.30 -> 1.7.36
- slick-pg 0.19.3 -> 0.20.3
- slick-pg_json4s 0.19.3 -> 0.20.3
- swagger-akka-http 2.4.2 -> 2.5.2
- swagger-ui 3.47.1 -> 4.10.3
- New configuration file attributes have been added.
- akka.http.server.backlog
- akka.http.server.bind-timeout
- akka.http.server.idle-timeout
- akka.http.server.linger-timeout
- akka.http.server.max-connections
- akka.http.server.pipelining-limit

## Changes in 2.87.1
- This patch back ports some/all changes from the following Exchange versions:
- `2.90.2`
Expand Down
28 changes: 14 additions & 14 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ lazy val root = (project in file("."))
organization := "com.horizon",
release := versionFunc(),
resolvers += Classpaths.typesafeReleases,
scalaVersion := "2.13.5",
scalaVersion := "2.13.8",
summary := "'Open Horizon exchange-api image'",
vendor := "'Open Horizon'",
version := versionFunc(),
Expand All @@ -43,19 +43,19 @@ lazy val root = (project in file("."))

// Sbt uses Ivy for dependency resolution, so it supports its version syntax: http://ant.apache.org/ivy/history/latest-milestone/ivyfile/dependency.html#revision
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-http" % "[10.2.4]",
"com.typesafe.akka" %% "akka-http-xml" % "[10.2.4]",
"com.typesafe.akka" %% "akka-http" % "[10.2.7]",
"com.typesafe.akka" %% "akka-http-xml" % "[10.2.7]",
// "com.typesafe.akka" %% "akka-stream" % "[2.6.14,)",
// "com.typesafe.akka" %% "akka-http-spray-json" % "[10.2.1,)",
"de.heikoseeberger" %% "akka-http-jackson" % "[1.37.0]", // version 1.35.3 pulls in akka 2.6.10 and akkahttp 10.2.2
"de.heikoseeberger" %% "akka-http-jackson" % "[1.39.2]", // version 1.35.3 pulls in akka 2.6.10 and akkahttp 10.2.2
// "com.typesafe.akka" %% "akka-http-jackson" % "[10.2.1,)", //<- can not find any recent documentation on how to use this

"org.json4s" %% "json4s-native" % "3.6.6", // Version 3.7.0-M3 is incompatible.
"org.json4s" %% "json4s-jackson" % "3.6.6", // Version 3.7.0-M3 is incompatible.
"org.json4s" %% "json4s-native" % "4.0.5", // Version 3.7.0-M3 is incompatible.
"org.json4s" %% "json4s-jackson" % "4.0.5", // Version 3.7.0-M3 is incompatible.

"javax.ws.rs" % "javax.ws.rs-api" % "[2.1.1,)", // this is from 8/2014. Version 2.1.1 from 9/2018 gets an error loading
//"org.glassfish.jersey.core" % "jersey-common" % "1.2.1", // required at runtime by javax.ws.rs-api
"com.github.swagger-akka-http" %% "swagger-akka-http" % "[2.4.2]", // Version 2.5.0 now requires v10.2.6 Akka modules.
"com.github.swagger-akka-http" %% "swagger-akka-http" % "[2.5.2]", // Version 2.5.0 now requires v10.2.6 Akka modules.
"com.github.swagger-akka-http" %% "swagger-scala-module" % "[1.0.6,)",
"io.swagger.core.v3" % "swagger-core" % "[2.1.5,)", // Version 2.1.3 causes incompatability error with Jackson Databind -- https://mvnrepository.com/artifact/io.swagger.core.v3/swagger-core
"io.swagger.core.v3" % "swagger-annotations" % "[2.1.5,)", // Version 2.1.3 causes incompatability error with Jackson Databind -- https://mvnrepository.com/artifact/io.swagger.core.v3/swagger-annotations
Expand All @@ -64,11 +64,11 @@ lazy val root = (project in file("."))

"com.typesafe.slick" %% "slick" % "[3.3.3]",
"com.typesafe.slick" %% "slick-hikaricp" % "[3.3.3]",
"com.github.tminglei" %% "slick-pg" % "[0.19.3]",
"com.github.tminglei" %% "slick-pg_json4s" % "[0.19.3]",
"org.postgresql" % "postgresql" % "42.2.19", // Version number must be manually specified to prevent Maven from selecting a jre6/7 version of this dependency.
"com.github.tminglei" %% "slick-pg" % "[0.20.3]",
"com.github.tminglei" %% "slick-pg_json4s" % "[0.20.3]",
"org.postgresql" % "postgresql" % "[42.3.4,)", // Version number must be manually specified to prevent Maven from selecting a jre6/7 version of this dependency.
//"com.zaxxer" % "HikariCP" % "[3.4.5,)",
"org.slf4j" % "slf4j-simple" % "[1.7.30]", // Needed by scalacache, slick, and swagger.
"org.slf4j" % "slf4j-simple" % "[1.7.36]", // Needed by scalacache, slick, and swagger.
//"ch.qos.logback" % "logback-classic" % "1.3.0-alpha5",
"com.mchange" % "c3p0" % "[0.9.5.5,)",
"org.scalaj" %% "scalaj-http" % "[2.4.2,)",
Expand All @@ -78,9 +78,9 @@ lazy val root = (project in file("."))
"com.github.cb372" %% "scalacache-guava" % "[0.28.0,)",
"com.osinka.i18n" %% "scala-i18n" % "[1.0.3,)",

"com.typesafe.akka" %% "akka-http-testkit" % "[10.2.4]" % Test,
"com.typesafe.akka" %% "akka-testkit" % "[2.6.14]" % Test,
"com.typesafe.akka" %% "akka-stream-testkit" % "[2.6.14]" % Test,
"com.typesafe.akka" %% "akka-http-testkit" % "[10.2.7]" % Test,
"com.typesafe.akka" %% "akka-testkit" % "[2.6.16]" % Test,
"com.typesafe.akka" %% "akka-stream-testkit" % "[2.6.16]" % Test,

"org.scalatest" %% "scalatest" % "[3.3.0-SNAP2,)" % "test",
"org.scalatestplus" %% "junit-4-12" % "[3.3.0.0-SNAP2,)" % "test",
Expand Down
2 changes: 1 addition & 1 deletion doc/openapi-3-developer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"name" : "Apache License Version 2.0",
"url" : "https://www.apache.org/licenses/LICENSE-2.0"
},
"version" : "2.87.1"
"version" : "2.87.2"
},
"externalDocs" : {
"description" : "Open-horizon ExchangeAPI",
Expand Down
2 changes: 1 addition & 1 deletion doc/openapi-3-user.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"name" : "Apache License Version 2.0",
"url" : "https://www.apache.org/licenses/LICENSE-2.0"
},
"version" : "2.87.1"
"version" : "2.87.2"
},
"externalDocs" : {
"description" : "Open-horizon ExchangeAPI",
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
"User": ["READ_MYSELF", "WRITE_MYSELF", "CREATE_NODE", "READ_MY_NODES", "WRITE_MY_NODES", "CREATE_AGBOT", "READ_MY_AGBOTS", "WRITE_MY_AGBOTS", "DATA_HEARTBEAT_MY_AGBOTS", "READ_ALL_AGBOTS", "STATUS", "UTILITIES", "MAXCHANGEID", "READ_MY_SERVICES", "READ_ALL_SERVICES", "WRITE_MY_SERVICES", "CREATE_SERVICES", "READ_MY_PATTERNS", "READ_ALL_PATTERNS", "WRITE_MY_PATTERNS", "CREATE_PATTERNS", "READ_MY_BUSINESS", "READ_ALL_BUSINESS", "WRITE_MY_BUSINESS", "CREATE_BUSINESS", "READ_MY_ORG", "READ_IBM_ORGS"]
},
"akka": {
"akka.http.server.backlog": "100",
"akka.http.server.bind-timeout": "1s",
"akka.http.server.idle-timeout": "60s",
"akka.http.server.linger-timeout": "1m",
"akka.http.server.max-connections": "1024",
"akka.http.server.pipelining-limit": "1",
"akka.http.server.request-timeout": "45s",
"akka.http.server.server-header": "" // Removes the Server header from response.
// add additional entries like: "akka.http.server.max-connections": 512
Expand Down
16 changes: 16 additions & 0 deletions src/main/resources/swagger/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
html {
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}

*,
*:before,
*:after {
box-sizing: inherit;
}

body {
margin: 0;
background: #fafafa;
}
24 changes: 2 additions & 22 deletions src/main/resources/swagger/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,16 @@
<meta charset="UTF-8">
<title>Swagger UI</title>
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" />
<link rel="stylesheet" type="text/css" href="index.css" />
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
<style>
html
{
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}

*,
*:before,
*:after
{
box-sizing: inherit;
}

body
{
margin:0;
background: #fafafa;
}
</style>
</head>

<body>
<div id="swagger-ui"></div>

<script src="./swagger-ui-bundle.js" charset="UTF-8"> </script>
<script src="./swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
<script src="./swagger-initializer.js" charset="UTF-8"> </script>
<script>
window.onload = function() {
// Begin Swagger UI call region
Expand Down
10 changes: 7 additions & 3 deletions src/main/resources/swagger/oauth2-redirect.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,13 @@
window.close();
}

window.addEventListener('DOMContentLoaded', function () {
run();
});
if (document.readyState !== 'loading') {
run();
} else {
document.addEventListener('DOMContentLoaded', function () {
run();
});
}
</script>
</body>
</html>
20 changes: 20 additions & 0 deletions src/main/resources/swagger/swagger-initializer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
window.onload = function() {
//<editor-fold desc="Changeable Configuration Block">

// the following lines will be replaced by docker/configurator, when it runs in a docker-container
window.ui = SwaggerUIBundle({
url: "https://petstore.swagger.io/v2/swagger.json",
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
});

//</editor-fold>
};
2 changes: 1 addition & 1 deletion src/main/resources/swagger/swagger-ui-bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/main/resources/swagger/swagger-ui-bundle.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/main/resources/swagger/swagger-ui-es-bundle-core.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/main/resources/swagger/swagger-ui-es-bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/main/resources/swagger/swagger-ui-es-bundle.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/main/resources/swagger/swagger-ui-standalone-preset.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/main/resources/swagger/swagger-ui.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/main/resources/swagger/swagger-ui.css.map

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions src/main/resources/swagger/swagger-ui.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/main/resources/swagger/swagger-ui.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/main/resources/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.87.0
2.87.2
7 changes: 3 additions & 4 deletions src/main/scala/com/horizon/exchangeapi/ExchangeApiApp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import akka.http.scaladsl.model.headers.CacheDirectives.{`max-age`, `must-revali
import akka.http.scaladsl.model.headers.{RawHeader, `Cache-Control`}
import akka.http.scaladsl.server._
import akka.http.scaladsl.server.{ExceptionHandler, Route}
import akka.stream.ActorMaterializer
import akka.stream.{ActorMaterializer, Materializer}
import com.horizon.exchangeapi.tables.{AgbotMsgsTQ, NodeMsgsTQ, ResourceChangesTQ}
import org.json4s._
import slick.jdbc.TransactionIsolation.Serializable
Expand Down Expand Up @@ -100,7 +100,6 @@ object ExchangeApiApp extends App
}
//val actorConfig = ConfigFactory.parseString("akka.loglevel=" + ExchConfig.getLogLevel)
implicit val system: ActorSystem = ActorSystem("actors", ExchConfig.getAkkaConfig) // includes the loglevel
implicit val materializer: ActorMaterializer = ActorMaterializer()
implicit val executionContext: ExecutionContext = system.dispatcher
ExchangeApi.defaultExecutionContext = executionContext // need this set in an object that doesn't use DelayedInit

Expand Down Expand Up @@ -309,7 +308,7 @@ object ExchangeApiApp extends App
val Cleanup = "cleanup";
class ChangesCleanupActor(timerInterval: Int = ExchConfig.getInt("api.resourceChanges.cleanupInterval")) extends Actor with Timers{
override def preStart(): Unit = {
timers.startPeriodicTimer(interval = timerInterval.seconds, key = "trimResourceChanges", msg = Cleanup)
timers.startTimerAtFixedRate(interval = timerInterval.seconds, key = "trimResourceChanges", msg = Cleanup)
logger.info("Scheduling change record cleanup every "+ timerInterval.seconds + " seconds")
super.preStart()
}
Expand Down Expand Up @@ -339,7 +338,7 @@ object ExchangeApiApp extends App
class MsgsCleanupActor(timerInterval: Int = ExchConfig.getInt("api.defaults.msgs.expired_msgs_removal_interval")) extends Actor with Timers {
override def preStart(): Unit = {
timers.startSingleTimer(key = "removeExpiredMsgsOnStart", msg = CleanupExpiredMessages, timeout = 0.seconds)
timers.startPeriodicTimer(interval = timerInterval.seconds, key = "removeExpiredMsgs", msg = CleanupExpiredMessages)
timers.startTimerAtFixedRate(interval = timerInterval.seconds, key = "removeExpiredMsgs", msg = CleanupExpiredMessages)
logger.info("Scheduling Agreement Bot message and Node message cleanup every "+ timerInterval.seconds + " seconds")
super.preStart()
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/com/horizon/exchangeapi/tables/Nodes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ final case class NodeRow(id: String,
val swv: Map[String, String] = if (softwareVersions != "") read[Map[String,String]](softwareVersions) else Map[String,String]()
val rsvc: List[RegService] = if (regServices != "") read[List[RegService]](regServices) else List[RegService]()
// Default new configState attr if it doesnt exist. This ends up being called by GET nodes, GET nodes/id, and POST search/nodes
val rsvc2: List[RegService] = rsvc.map(rs => RegService(rs.url, rs.numAgreements, rs.configState.orElse(Some("active")), rs.policy, rs.properties, rs.version.orElse(Some(""))))
val rsvc2: List[RegService] = rsvc.map(rs => RegService(rs.url, rs.numAgreements, rs.configState.orElse(Option("active")), rs.policy, rs.properties, rs.version.orElse(Option(""))))
val input: List[OneUserInputService] = if (userInput != "") read[List[OneUserInputService]](userInput) else List[OneUserInputService]()
val hbInterval: NodeHeartbeatIntervals = if (heartbeatIntervals != "") read[NodeHeartbeatIntervals](heartbeatIntervals) else NodeHeartbeatIntervals(0, 0, 0)
new Node(tok, name, owner, nt, pattern, rsvc2, input, msgEndPoint, swv, lastHeartbeat.orNull, publicKey, arch, hbInterval, lastUpdated)
Expand Down Expand Up @@ -191,7 +191,7 @@ object NodesTQ {
def getLastUpdated(id: String): Query[Rep[String], String, Seq] = rows.filter(_.id === id).map(_.lastUpdated)
def getNodeUsingPolicy(id: String): Query[(Rep[String], Rep[String]), (String, String), Seq] = rows.filter(_.id === id).map(x => (x.pattern, x.publicKey))

def setLastHeartbeat(id: String, lastHeartbeat: String): FixedSqlAction[Int, NoStream, Effect.Write] = rows.filter(_.id === id).map(_.lastHeartbeat).update(Some(lastHeartbeat))
def setLastHeartbeat(id: String, lastHeartbeat: String): FixedSqlAction[Int, NoStream, Effect.Write] = rows.filter(_.id === id).map(_.lastHeartbeat).update(Option(lastHeartbeat))
def setLastUpdated(id: String, lastUpdated: String): FixedSqlAction[Int, NoStream, Effect.Write] = rows.filter(_.id === id).map(_.lastUpdated).update(lastUpdated)


Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/com/horizon/exchangeapi/AdminSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import scala.collection.mutable.ListBuffer
import org.json4s.jackson.JsonMethods.parse
import org.json4s.jvalue2extractable
import org.json4s.native.Serialization.write
import org.json4s.string2JsonInput
import org.json4s.convertToJsonInput
import org.junit.runner.RunWith
import org.scalatest.BeforeAndAfterAll
import org.scalatest.funsuite.AnyFunSuite
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/com/horizon/exchangeapi/NodesSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import java.time.ZonedDateTime
import java.util.Base64

import scala.collection.immutable.{List, Map}
import org.json4s.{DefaultFormats, Formats, JValue, JsonInput, jvalue2extractable, string2JsonInput}
import org.json4s.{DefaultFormats, Formats, JValue, JsonInput, jvalue2extractable, convertToJsonInput}
import org.json4s.jackson.JsonMethods.parse
import org.json4s.native.Serialization.write
import org.junit.runner.RunWith
Expand Down
Loading

0 comments on commit 9d141da

Please sign in to comment.