summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--application/src/main/java/com/yahoo/application/container/handler/Headers.java2
-rw-r--r--bundle-plugin/src/main/scala/com/yahoo/container/plugin/bundle/AnalyzeBundle.scala8
-rw-r--r--bundle-plugin/src/test/scala/com/yahoo/container/plugin/bundle/AnalyzeBundleTest.scala6
-rw-r--r--bundle-plugin/src/test/scala/com/yahoo/container/plugin/classanalysis/AnalyzeClassTest.scala7
-rw-r--r--bundle-plugin/src/test/scala/com/yahoo/container/plugin/classanalysis/AnalyzeMethodBodyTest.scala6
-rw-r--r--bundle-plugin/src/test/scala/com/yahoo/container/plugin/osgi/ExportPackageParserTest.scala8
-rw-r--r--bundle-plugin/src/test/scala/com/yahoo/container/plugin/osgi/ImportPackageTest.scala8
-rw-r--r--bundle-plugin/src/test/scala/com/yahoo/container/plugin/util/IOTest.scala9
-rw-r--r--container-core/src/main/java/com/yahoo/container/core/config/HandlersConfigurerDi.java16
-rw-r--r--container-core/src/main/scala/com/yahoo/container/handler/observability/Graphviz.scala33
-rw-r--r--container-core/src/main/scala/com/yahoo/container/handler/observability/HtmlUtil.scala42
-rw-r--r--container-core/src/main/scala/com/yahoo/container/handler/observability/OverviewHandler.scala118
-rw-r--r--pom.xml12
-rw-r--r--service-monitor/pom.xml2
14 files changed, 38 insertions, 239 deletions
diff --git a/application/src/main/java/com/yahoo/application/container/handler/Headers.java b/application/src/main/java/com/yahoo/application/container/handler/Headers.java
index 3b5a62471ac..8c49d36c078 100644
--- a/application/src/main/java/com/yahoo/application/container/handler/Headers.java
+++ b/application/src/main/java/com/yahoo/application/container/handler/Headers.java
@@ -79,7 +79,7 @@ public class Headers implements Map<String, List<String>> {
}
@Override
- public Set<Entry<String, List<String>>> entrySet() {
+ public Set<Map.Entry<String, List<String>>> entrySet() {
return h.entrySet();
}
diff --git a/bundle-plugin/src/main/scala/com/yahoo/container/plugin/bundle/AnalyzeBundle.scala b/bundle-plugin/src/main/scala/com/yahoo/container/plugin/bundle/AnalyzeBundle.scala
index f1bbf644ac6..1b3979476bd 100644
--- a/bundle-plugin/src/main/scala/com/yahoo/container/plugin/bundle/AnalyzeBundle.scala
+++ b/bundle-plugin/src/main/scala/com/yahoo/container/plugin/bundle/AnalyzeBundle.scala
@@ -1,11 +1,11 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.plugin.bundle
-import java.util.jar.{Manifest => JarManifest}
import java.io.File
-import com.yahoo.container.plugin.osgi.{ExportPackages, ExportPackageParser}
-import ExportPackages.Export
-import collection.immutable.LinearSeq
+import java.util.jar.{Manifest => JarManifest}
+
+import com.yahoo.container.plugin.osgi.ExportPackageParser
+import com.yahoo.container.plugin.osgi.ExportPackages.Export
import com.yahoo.container.plugin.util.JarFiles
diff --git a/bundle-plugin/src/test/scala/com/yahoo/container/plugin/bundle/AnalyzeBundleTest.scala b/bundle-plugin/src/test/scala/com/yahoo/container/plugin/bundle/AnalyzeBundleTest.scala
index cf6ae3ccf9c..3ef1b1fea87 100644
--- a/bundle-plugin/src/test/scala/com/yahoo/container/plugin/bundle/AnalyzeBundleTest.scala
+++ b/bundle-plugin/src/test/scala/com/yahoo/container/plugin/bundle/AnalyzeBundleTest.scala
@@ -1,16 +1,18 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.plugin.bundle
-import org.scalatest.junit.{JUnitSuite, ShouldMatchersForJUnit}
+import org.scalatest.junit.{AssertionsForJUnit, JUnitSuite}
import org.junit.Test
import com.yahoo.container.plugin.bundle.AnalyzeBundle.PublicPackages
import com.yahoo.container.plugin.osgi.ExportPackages
import java.io.File
+import org.scalatest.Matchers
+
/**
* @author tonytv
*/
-class AnalyzeBundleTest extends JUnitSuite with ShouldMatchersForJUnit {
+class AnalyzeBundleTest extends JUnitSuite with AssertionsForJUnit with Matchers {
val jarDir = new File("src/test/resources/jar")
val PublicPackages(exports, globals) = AnalyzeBundle.publicPackagesAggregated(
diff --git a/bundle-plugin/src/test/scala/com/yahoo/container/plugin/classanalysis/AnalyzeClassTest.scala b/bundle-plugin/src/test/scala/com/yahoo/container/plugin/classanalysis/AnalyzeClassTest.scala
index 3377315e3d8..e2d0e3c6f10 100644
--- a/bundle-plugin/src/test/scala/com/yahoo/container/plugin/classanalysis/AnalyzeClassTest.scala
+++ b/bundle-plugin/src/test/scala/com/yahoo/container/plugin/classanalysis/AnalyzeClassTest.scala
@@ -2,19 +2,22 @@
package com.yahoo.container.plugin.classanalysis
import org.junit.Test
-import org.scalatest.junit.{ShouldMatchersForJUnit, JUnitSuite}
+import org.scalatest.junit.{AssertionsForJUnit, JUnitSuite}
import java.awt.Image
import java.awt.image.{ImagingOpException, Kernel}
+
import sampleclasses._
import TestUtilities._
import com.yahoo.osgi.annotation.{ExportPackage, Version}
import javax.security.auth.login.LoginException
+import org.scalatest.Matchers
+
/**
* Tests that analysis of class files works.
* @author tonytv
*/
-class AnalyzeClassTest extends JUnitSuite with ShouldMatchersForJUnit {
+class AnalyzeClassTest extends JUnitSuite with AssertionsForJUnit with Matchers {
@Test def require_that_full_class_name_is_returned() {
analyzeClass[Base].name should be(name[Base])
}
diff --git a/bundle-plugin/src/test/scala/com/yahoo/container/plugin/classanalysis/AnalyzeMethodBodyTest.scala b/bundle-plugin/src/test/scala/com/yahoo/container/plugin/classanalysis/AnalyzeMethodBodyTest.scala
index 231aba36325..43f52884f39 100644
--- a/bundle-plugin/src/test/scala/com/yahoo/container/plugin/classanalysis/AnalyzeMethodBodyTest.scala
+++ b/bundle-plugin/src/test/scala/com/yahoo/container/plugin/classanalysis/AnalyzeMethodBodyTest.scala
@@ -1,17 +1,19 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.plugin.classanalysis
-import org.scalatest.junit.{JUnitSuite, ShouldMatchersForJUnit}
+import org.scalatest.junit.{AssertionsForJUnit, JUnitSuite}
import sampleclasses._
import TestUtilities._
import org.junit.Test
import java.io.PrintStream
+import org.scalatest.Matchers
+
/**
* Tests that classes used in method bodies are included in the imports list.
* @author tonytv
*/
-class AnalyzeMethodBodyTest extends JUnitSuite with ShouldMatchersForJUnit {
+class AnalyzeMethodBodyTest extends JUnitSuite with AssertionsForJUnit with Matchers {
@Test def require_that_class_of_locals_are_included() {
analyzeClass[Methods].referencedClasses should contain(name[Base])
}
diff --git a/bundle-plugin/src/test/scala/com/yahoo/container/plugin/osgi/ExportPackageParserTest.scala b/bundle-plugin/src/test/scala/com/yahoo/container/plugin/osgi/ExportPackageParserTest.scala
index 37399ec8c00..5ddc7fef16d 100644
--- a/bundle-plugin/src/test/scala/com/yahoo/container/plugin/osgi/ExportPackageParserTest.scala
+++ b/bundle-plugin/src/test/scala/com/yahoo/container/plugin/osgi/ExportPackageParserTest.scala
@@ -1,15 +1,15 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.plugin.osgi
-import org.scalatest.junit.{JUnitSuite, ShouldMatchersForJUnit}
+import org.scalatest.junit.{AssertionsForJUnit, JUnitSuite}
import org.junit.Test
-
-import ExportPackages.{Parameter, Export}
+import ExportPackages.{Export, Parameter}
+import org.scalatest.Matchers
/**
* @author tonytv
*/
-class ExportPackageParserTest extends JUnitSuite with ShouldMatchersForJUnit {
+class ExportPackageParserTest extends JUnitSuite with AssertionsForJUnit with Matchers {
val versionParameter = Parameter("version", "1.2.3.sample")
@Test
diff --git a/bundle-plugin/src/test/scala/com/yahoo/container/plugin/osgi/ImportPackageTest.scala b/bundle-plugin/src/test/scala/com/yahoo/container/plugin/osgi/ImportPackageTest.scala
index b39c8da7df6..4011f170da9 100644
--- a/bundle-plugin/src/test/scala/com/yahoo/container/plugin/osgi/ImportPackageTest.scala
+++ b/bundle-plugin/src/test/scala/com/yahoo/container/plugin/osgi/ImportPackageTest.scala
@@ -1,16 +1,16 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.plugin.osgi
-import org.scalatest.junit.{JUnitSuite, ShouldMatchersForJUnit}
+import org.scalatest.junit.{AssertionsForJUnit, JUnitSuite}
import org.junit.Test
-
import ImportPackages.Import
-import ExportPackages.{Parameter, Export}
+import ExportPackages.{Export, Parameter}
+import org.scalatest.Matchers
/**
* @author tonytv
*/
-class ImportPackageTest extends JUnitSuite with ShouldMatchersForJUnit {
+class ImportPackageTest extends JUnitSuite with AssertionsForJUnit with Matchers {
val referencedPackages = Set("com.yahoo.exported")
val exports = exportByPackageName(Export(List("com.yahoo.exported"), List()))
val exportsWithVersion = exportByPackageName(exports.head._2.copy(parameters = List(Parameter("version", "1.3"))))
diff --git a/bundle-plugin/src/test/scala/com/yahoo/container/plugin/util/IOTest.scala b/bundle-plugin/src/test/scala/com/yahoo/container/plugin/util/IOTest.scala
index d96273d81e1..7efb0392f5e 100644
--- a/bundle-plugin/src/test/scala/com/yahoo/container/plugin/util/IOTest.scala
+++ b/bundle-plugin/src/test/scala/com/yahoo/container/plugin/util/IOTest.scala
@@ -1,22 +1,23 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.plugin.util
-import org.scalatest.junit.{JUnitSuite, ShouldMatchersForJUnit}
+import org.scalatest.junit.{AssertionsForJUnit, JUnitSuite}
import org.junit.Test
-
import IO.using
import java.io.Closeable
+import org.scalatest.Matchers
+
/**
* @author tonytv
*/
-class IOTest extends JUnitSuite with ShouldMatchersForJUnit {
+class IOTest extends JUnitSuite with AssertionsForJUnit with Matchers {
class ClosingException extends RuntimeException
class FunctionException extends RuntimeException
object throwWhenClosingResource extends Closeable {
def close() {
- throw new ClosingException();
+ throw new ClosingException()
}
}
diff --git a/container-core/src/main/java/com/yahoo/container/core/config/HandlersConfigurerDi.java b/container-core/src/main/java/com/yahoo/container/core/config/HandlersConfigurerDi.java
index 01ff6918f7b..66fb4c73560 100644
--- a/container-core/src/main/java/com/yahoo/container/core/config/HandlersConfigurerDi.java
+++ b/container-core/src/main/java/com/yahoo/container/core/config/HandlersConfigurerDi.java
@@ -13,12 +13,9 @@ import com.yahoo.container.core.DiagnosticsConfig;
import com.yahoo.container.di.ComponentDeconstructor;
import com.yahoo.container.di.Container;
import com.yahoo.container.di.componentgraph.core.ComponentGraph;
-import com.yahoo.container.di.componentgraph.core.DotGraph;
import com.yahoo.container.di.config.SubscriberFactory;
import com.yahoo.container.di.osgi.OsgiUtil;
-import com.yahoo.container.handler.observability.OverviewHandler;
import com.yahoo.container.logging.AccessLog;
-import com.yahoo.container.logging.AccessLogInterface;
import com.yahoo.jdisc.application.OsgiFramework;
import com.yahoo.jdisc.handler.RequestHandler;
import com.yahoo.jdisc.service.ClientProvider;
@@ -28,14 +25,12 @@ import com.yahoo.language.simple.SimpleLinguistics;
import com.yahoo.log.LogLevel;
import com.yahoo.osgi.OsgiImpl;
import com.yahoo.statistics.Statistics;
-
import org.osgi.framework.Bundle;
import org.osgi.framework.wiring.BundleWiring;
import scala.collection.immutable.Set;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.List;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.logging.Logger;
@@ -153,7 +148,6 @@ public class HandlersConfigurerDi {
RegistriesHack registriesHack = currentGraph.getInstance(RegistriesHack.class);
assert (registriesHack != null);
- injectDotGraph();
}
@SuppressWarnings("deprecation")
@@ -176,16 +170,6 @@ public class HandlersConfigurerDi {
});
}
- private void injectDotGraph() {
- try {
- OverviewHandler overviewHandler = currentGraph.getInstance(OverviewHandler.class);
- overviewHandler.setDotGraph(DotGraph.generate(currentGraph));
- } catch (Exception e) {
- log.fine("No overview handler");
- }
-
- }
-
public void reloadConfig(long generation) {
container.reloadConfig(generation);
}
diff --git a/container-core/src/main/scala/com/yahoo/container/handler/observability/Graphviz.scala b/container-core/src/main/scala/com/yahoo/container/handler/observability/Graphviz.scala
deleted file mode 100644
index 845f0857323..00000000000
--- a/container-core/src/main/scala/com/yahoo/container/handler/observability/Graphviz.scala
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.container.handler.observability
-
-import com.yahoo.text.Utf8
-import com.yahoo.io.IOUtils
-import java.io.{IOException, InputStreamReader, InputStream}
-import com.google.common.io.ByteStreams
-
-/**
- * @author tonytv
- */
-
-object Graphviz {
-
- @throws(classOf[IOException])
- def runDot(outputType: String, graph: String) = {
- val process = Runtime.getRuntime.exec(Array("/bin/sh", "-c", "unflatten -l7 | dot -T" + outputType))
- process.getOutputStream.write(Utf8.toBytes(graph))
- process.getOutputStream.close()
-
- val result = ByteStreams.toByteArray(process.getInputStream)
- process.waitFor() match {
- case 0 => result
- case 127 => throw new RuntimeException("Couldn't find dot, please ensure that Graphviz is installed.")
- case _ => throw new RuntimeException("Failed running dot: " + readString(process.getErrorStream))
- }
- }
-
- private def readString(inputStream: InputStream): String = {
- IOUtils.readAll(new InputStreamReader(inputStream, "UTF-8"))
- }
-
-}
diff --git a/container-core/src/main/scala/com/yahoo/container/handler/observability/HtmlUtil.scala b/container-core/src/main/scala/com/yahoo/container/handler/observability/HtmlUtil.scala
deleted file mode 100644
index 6469d4604d2..00000000000
--- a/container-core/src/main/scala/com/yahoo/container/handler/observability/HtmlUtil.scala
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.container.handler.observability
-
-import xml.{PrettyPrinter, Elem}
-
-
-/**
- * @author gjoranv
- * @author tonytv
- */
-object HtmlUtil {
- def link(target: String, anchor: String): Elem =
- <a href={target}>{anchor}</a>
-
- def link(targetAndAnchor: String): Elem = link(targetAndAnchor, targetAndAnchor)
-
- def unorderedList(items: Elem*) =
- <ul>
- {items}
- </ul>
-
- def li[T](children: T*) =
- <li>{children}</li>
-
- def h1(name: String) =
- <h1>{name}</h1>
-
- def html(title: String, body: Elem*) =
- <html>
- <head>
- <title>{title}</title>
- </head>
- <body>
- {body}
- </body>
- </html>
-
- def prettyPrintXhtml(elem: Elem): String = {
- """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">""" +
- "\n" + new PrettyPrinter(120, 2).format(elem)
- }
-}
diff --git a/container-core/src/main/scala/com/yahoo/container/handler/observability/OverviewHandler.scala b/container-core/src/main/scala/com/yahoo/container/handler/observability/OverviewHandler.scala
deleted file mode 100644
index fcb00bb72ef..00000000000
--- a/container-core/src/main/scala/com/yahoo/container/handler/observability/OverviewHandler.scala
+++ /dev/null
@@ -1,118 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.container.handler.observability
-
-import java.util.concurrent.Executor
-
-import HtmlUtil._
-import OverviewHandler._
-import com.yahoo.container.jdisc.{HttpResponse, HttpRequest, ThreadedHttpRequestHandler}
-import com.yahoo.text.Utf8
-import java.io.{PrintWriter, OutputStream}
-
-
-/**
- * @author gjoranv
- * @author tonytv
- */
-class OverviewHandler(executor: Executor) extends ThreadedHttpRequestHandler(executor) {
-
- @volatile
- private var dotGraph: String = _
-
- def handle(request: HttpRequest): HttpResponse = {
- val path = request.getUri.getPath
-
- try {
- if (path.endsWith("/ComponentGraph"))
- handleComponentGraph(request)
- else if (path.endsWith("/Overview"))
- handleOverview(request)
- else
- null
- } catch {
- case e: Exception => errorResponse(e.getMessage)
- }
-
- }
-
- def handleOverview(request: HttpRequest): HttpResponse = {
- new HttpResponse(com.yahoo.jdisc.Response.Status.OK) {
- def render(stream: OutputStream) {
- stream.write(Utf8.toBytes(overviewPageText))
- }
-
- override def getContentType: String = {
- "text/html"
- }
- }
- }
-
- def errorResponse(message: String): HttpResponse = {
- new HttpResponse(com.yahoo.jdisc.Response.Status.BAD_REQUEST) {
- def render(stream: OutputStream) {
- new PrintWriter(stream).println(message)
- }
- }
- }
-
- def handleComponentGraph(request: HttpRequest): HttpResponse = {
- var graphType = request.getProperty("type");
- if (graphType == null)
- graphType = "text"
-
- graphType match {
- case "text" => textualComponentGraph(dotGraph)
- case t if componentGraphTypes.contains(t) => graphicalComponentGraph(t, Graphviz.runDot(graphType,dotGraph))
- case t => errorResponse(t)
- }
- }
-
- def textualComponentGraph(dotGraph: String) =
- new HttpResponse(com.yahoo.jdisc.Response.Status.OK) {
- def render(stream: OutputStream) {
- stream.write(Utf8.toBytes(dotGraph))
- }
-
- override def getContentType: String = {
- "text/plain"
- }
- }
-
- def graphicalComponentGraph(graphType: String, image: Array[Byte] ): HttpResponse =
- new HttpResponse(com.yahoo.jdisc.Response.Status.OK) {
- def render(output: OutputStream) {
- output.write(image)
- }
-
- override def getContentType: String = {
- componentGraphTypes(graphType)
- }
- }
-
- def setDotGraph(dotGraph: String) {
- this.dotGraph = dotGraph
- }
-}
-
-object OverviewHandler {
- val componentGraphTypes = Map(
- "svg" -> "image/svg+xml",
- "png" -> "image/png",
- "text" -> "text/plain")
-
- val overviewPageText = prettyPrintXhtml(overviewPage)
-
- private def overviewPage = {
- def componentGraphLink(graphType: String) = link("Overview/ComponentGraph?type=" + graphType, graphType)
-
-
- html(
- title = "Container Overview",
- body =
- h1("Container Overview"),
- unorderedList(
- li(link("ApplicationStatus")),
- li("ComponentGraph" +: (componentGraphTypes.keys map {componentGraphLink}).toSeq :_*)))
- }
-
-}
diff --git a/pom.xml b/pom.xml
index 480c94d66b6..e49f181a3bb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -953,22 +953,22 @@
<dependency>
<groupId>org.scala-lang.modules</groupId>
<artifactId>scala-parser-combinators_${scala.major-version}</artifactId>
- <version>1.0.1</version>
+ <version>1.0.6</version>
</dependency>
<dependency>
<groupId>org.scala-lang.modules</groupId>
<artifactId>scala-xml_${scala.major-version}</artifactId>
- <version>1.0.2</version>
+ <version>1.0.6</version>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_${scala.major-version}</artifactId>
- <version>2.2.2</version>
+ <version>3.0.3</version>
</dependency>
<dependency>
<groupId>org.json4s</groupId>
<artifactId>json4s-native_${scala.major-version}</artifactId>
- <version>3.3.0</version>
+ <version>3.5.2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
@@ -1082,8 +1082,8 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<test.hide>true</test.hide>
<doclint>all</doclint>
- <scala.major-version>2.11</scala.major-version>
- <scala.version>${scala.major-version}.4</scala.version>
+ <scala.major-version>2.12</scala.major-version>
+ <scala.version>${scala.major-version}.2</scala.version>
<surefire.version>2.19.1</surefire.version> <!-- NOTE bjorncs 15.06.2017: Version 2.20 has OoM issues -->
</properties>
diff --git a/service-monitor/pom.xml b/service-monitor/pom.xml
index a23760c435b..f0678974ec2 100644
--- a/service-monitor/pom.xml
+++ b/service-monitor/pom.xml
@@ -27,7 +27,7 @@
<dependency>
<groupId>io.reactivex</groupId>
<artifactId>rxscala_${scala.major-version}</artifactId>
- <version>0.23.1</version>
+ <version>0.26.5</version>
</dependency>
<dependency>
<groupId>com.yahoo.vespa</groupId>