diff --git a/adapter/adapter-service/src/test/resources/shrine.conf b/adapter/adapter-service/src/test/resources/shrine.conf
index acf870393..5cde0c66f 100644
--- a/adapter/adapter-service/src/test/resources/shrine.conf
+++ b/adapter/adapter-service/src/test/resources/shrine.conf
@@ -1,20 +1,23 @@
shrine {
+ problem {
+ problemHandler = "net.shrine.problem.LoggingProblemHandler$"
+ }
adapter {
create = true
audit {
collectQepAudit = false
database {
slickProfileClassName = "slick.driver.H2Driver$"
createTablesOnStart = true //for testing with H2 in memory, when not running unit tests. Set to false normally
dataSourceFrom = "testDataSource" //Can be JNDI or testDataSource . Use testDataSource for tests, JNDI everywhere else
testDataSource {
driverClassName = "org.h2.Driver"
url = "jdbc:h2:mem:test;DB_CLOSE_DELAY=-1" //H2 embedded in-memory for unit tests ;TRACE_LEVEL_SYSTEM_OUT=2 for H2's trace
}
}
}
}
}
\ No newline at end of file
diff --git a/apps/dashboard-app/src/main/scala/net/shrine/dashboard/DashboardConfigSource.scala b/apps/dashboard-app/src/main/scala/net/shrine/dashboard/DashboardConfigSource.scala
index be83a2c20..bf22e4f1e 100644
--- a/apps/dashboard-app/src/main/scala/net/shrine/dashboard/DashboardConfigSource.scala
+++ b/apps/dashboard-app/src/main/scala/net/shrine/dashboard/DashboardConfigSource.scala
@@ -1,14 +1,14 @@
package net.shrine.dashboard
import net.shrine.source.ConfigSource
/**
* Source of typesafe config for the dashboard app.
*
* @author david
* @since 4/29/15
*/
object DashboardConfigSource extends ConfigSource {
- override val configName = "dashboard"
+ override val configName = "shrine"
}
diff --git a/apps/dashboard-app/src/test/resources/dashboard.conf b/apps/dashboard-app/src/test/resources/shrine.conf
similarity index 100%
rename from apps/dashboard-app/src/test/resources/dashboard.conf
rename to apps/dashboard-app/src/test/resources/shrine.conf
diff --git a/apps/dashboard-war/src/test/resources/dashboard.conf b/apps/dashboard-war/src/test/resources/shrine.conf
similarity index 100%
rename from apps/dashboard-war/src/test/resources/dashboard.conf
rename to apps/dashboard-war/src/test/resources/shrine.conf
diff --git a/apps/shrine-app/src/test/resources/shrine.conf b/apps/shrine-app/src/test/resources/shrine.conf
index cba2b4707..c1765938a 100644
--- a/apps/shrine-app/src/test/resources/shrine.conf
+++ b/apps/shrine-app/src/test/resources/shrine.conf
@@ -1,77 +1,81 @@
shrine {
+ problem {
+ problemHandler = "net.shrine.problem.LoggingProblemHandler$"
+ }
+
keystore {
file = "shrine.keystore"
password = "chiptesting"
privateKeyAlias = "test-cert"
keyStoreType = "JKS"
caCertAliases = [carra ca]
}
queryEntryPoint {
audit {
collectQepAudit = false
database {
slickProfileClassName = "slick.driver.H2Driver$"
createTablesOnStart = true //for testing with H2 in memory, when not running unit tests. Set to false normally
dataSourceFrom = "testDataSource" //Can be JNDI or testDataSource . Use testDataSource for tests, JNDI everywhere else
testDataSource {
driverClassName = "org.h2.Driver"
url = "jdbc:h2:mem:test;DB_CLOSE_DELAY=-1" //H2 embedded in-memory for unit tests ;TRACE_LEVEL_SYSTEM_OUT=2 for H2's trace
}
}
}
authenticationType = "pm" //can be none, pm, or ecommons
authorizationType = "shrine-steward" //can be none, shrine-steward, or hms-steward
shrineSteward {
qepUserName = "qep"
qepPassword = "trustme"
stewardBaseUrl = "https://localhost:6443"
}
}
adapter {
create = true
audit {
collectQepAudit = false
database {
slickProfileClassName = "slick.driver.H2Driver$"
createTablesOnStart = true //for testing with H2 in memory, when not running unit tests. Set to false normally
dataSourceFrom = "testDataSource" //Can be JNDI or testDataSource . Use testDataSource for tests, JNDI everywhere else
testDataSource {
driverClassName = "org.h2.Driver"
url = "jdbc:h2:mem:test;DB_CLOSE_DELAY=-1" //H2 embedded in-memory for unit tests ;TRACE_LEVEL_SYSTEM_OUT=2 for H2's trace
}
}
}
}
squerylDataSource {
database {
dataSourceFrom = "testDataSource" //Can be JNDI or testDataSource . Use testDataSource for tests, JNDI everywhere else
testDataSource {
driverClassName = "org.h2.Driver"
url = "jdbc:h2:mem:test;DB_CLOSE_DELAY=-1" //H2 embedded in-memory for unit tests ;TRACE_LEVEL_SYSTEM_OUT=2 for H2's trace
}
}
}
// squerylDataSource {
// database {
// dataSourceFrom = "testDataSource" //Can be JNDI or testDataSource . Use testDataSource for tests, JNDI everywhere else
//
// testDataSource {
// driverClassName = "org.h2.Driver"
// url = "jdbc:h2:mem:test;DB_CLOSE_DELAY=-1" //H2 embedded in-memory for unit tests ;TRACE_LEVEL_SYSTEM_OUT=2 for H2's trace
// }
// }
// }
}
\ No newline at end of file
diff --git a/apps/steward-app/src/main/scala/net/shrine/steward/StewardConfigSource.scala b/apps/steward-app/src/main/scala/net/shrine/steward/StewardConfigSource.scala
index a67b319a3..386ce59f4 100644
--- a/apps/steward-app/src/main/scala/net/shrine/steward/StewardConfigSource.scala
+++ b/apps/steward-app/src/main/scala/net/shrine/steward/StewardConfigSource.scala
@@ -1,31 +1,31 @@
package net.shrine.steward
import net.shrine.authorization.steward.TopicState
import net.shrine.source.ConfigSource
/**
* Source of typesafe config for the data steward app.
*
* @author david
* @since 4/29/15
*/
object StewardConfigSource extends ConfigSource {
- override val configName = "steward"
+ override val configName = "shrine"
val createTopicsModeConfigKey = "shrine.steward.createTopicsMode"
def createTopicsInState:CreateTopicsMode = CreateTopicsMode.namesToCreateTopicsMode(config.getString(createTopicsModeConfigKey))
}
sealed case class CreateTopicsMode(name:String,topicState: TopicState)
object CreateTopicsMode{
val Pending = CreateTopicsMode(TopicState.pending)
val Approved = CreateTopicsMode(TopicState.approved)
val TopicsIgnoredJustLog = CreateTopicsMode("TopicsIgnoredJustLog",TopicState.approved)
val all = Set(Pending,Approved,TopicsIgnoredJustLog)
val namesToCreateTopicsMode: Map[String, CreateTopicsMode] = all.map(x => (x.name,x)).toMap
def apply(topicState: TopicState):CreateTopicsMode = CreateTopicsMode(topicState.name,topicState)
}
\ No newline at end of file
diff --git a/commons/auth/src/test/resources/dashboard.conf b/commons/auth/src/test/resources/shrine.conf
similarity index 100%
rename from commons/auth/src/test/resources/dashboard.conf
rename to commons/auth/src/test/resources/shrine.conf
diff --git a/adapter/adapter-service/src/test/resources/dashboard.conf b/commons/protocol/src/test/resources/shrine.conf
similarity index 100%
rename from adapter/adapter-service/src/test/resources/dashboard.conf
rename to commons/protocol/src/test/resources/shrine.conf
diff --git a/commons/util/src/main/scala/net/shrine/problem/ProblemConfigSource.scala b/commons/util/src/main/scala/net/shrine/problem/ProblemConfigSource.scala
index 52f1e86e9..73eebb352 100644
--- a/commons/util/src/main/scala/net/shrine/problem/ProblemConfigSource.scala
+++ b/commons/util/src/main/scala/net/shrine/problem/ProblemConfigSource.scala
@@ -1,18 +1,18 @@
package net.shrine.problem
import com.typesafe.config.{Config, ConfigValue, ConfigValueFactory}
import net.shrine.source.ConfigSource
/**
* Source of typesafe config for the problems database
*
* @author ty
* @since 7/22/16
*/
object ProblemConfigSource extends ConfigSource {
- override val configName: String = "dashboard"
+ override val configName: String = "shrine"
def getObject[T](path: String, config:Config):T = {
objectForName(config.getString(path))
}
}
diff --git a/commons/util/src/main/scala/net/shrine/source/ConfigSource.scala b/commons/util/src/main/scala/net/shrine/source/ConfigSource.scala
index b7a2b0c64..610751690 100644
--- a/commons/util/src/main/scala/net/shrine/source/ConfigSource.scala
+++ b/commons/util/src/main/scala/net/shrine/source/ConfigSource.scala
@@ -1,37 +1,37 @@
package net.shrine.source
import com.typesafe.config.{Config, ConfigFactory}
/**
* @author ty
* @since 7/22/16
*/
trait ConfigSource {
- val configName: String
+ val configName: String = "shrine"
lazy val atomicConfig = new AtomicConfigSource(ConfigFactory.load(configName))
def config: Config = {
atomicConfig.config
}
def configForBlock[T](key: String, value: AnyRef, origin: String)(block: => T): T = {
atomicConfig.configForBlock(key, value, origin)(block)
}
def configForBlock[T](config:Config,origin:String)(block: => T):T = {
atomicConfig.configForBlock(config,origin)(block)
}
def objectForName[T](objectName: String): T = {
import scala.reflect.runtime.universe
val runtimeMirror = universe.runtimeMirror(getClass.getClassLoader)
val module = runtimeMirror.staticModule(objectName)
val reflectedObj = runtimeMirror.reflectModule(module)
val obj = reflectedObj.instance
obj.asInstanceOf[T]
}
}
diff --git a/commons/util/src/test/resources/dashboard.conf b/commons/util/src/test/resources/shrine.conf
similarity index 100%
rename from commons/util/src/test/resources/dashboard.conf
rename to commons/util/src/test/resources/shrine.conf
diff --git a/hms-support/hms-core/src/test/resources/dashboard.conf b/hms-support/hms-core/src/test/resources/dashboard.conf
deleted file mode 100644
index e280c18e3..000000000
--- a/hms-support/hms-core/src/test/resources/dashboard.conf
+++ /dev/null
@@ -1,5 +0,0 @@
-shrine {
- problem {
- problemHandler = "net.shrine.problem.LoggingProblemHandler$"
- }
-}
\ No newline at end of file
diff --git a/apps/shrine-app/src/test/resources/dashboard.conf b/hms-support/hms-core/src/test/resources/shrine.conf
similarity index 100%
rename from apps/shrine-app/src/test/resources/dashboard.conf
rename to hms-support/hms-core/src/test/resources/shrine.conf
diff --git a/hub/broadcaster-aggregator/src/test/resources/dashboard.conf b/hub/broadcaster-aggregator/src/test/resources/dashboard.conf
deleted file mode 100644
index e280c18e3..000000000
--- a/hub/broadcaster-aggregator/src/test/resources/dashboard.conf
+++ /dev/null
@@ -1,5 +0,0 @@
-shrine {
- problem {
- problemHandler = "net.shrine.problem.LoggingProblemHandler$"
- }
-}
\ No newline at end of file
diff --git a/commons/protocol/src/test/resources/dashboard.conf b/hub/broadcaster-aggregator/src/test/resources/shrine.conf
similarity index 100%
rename from commons/protocol/src/test/resources/dashboard.conf
rename to hub/broadcaster-aggregator/src/test/resources/shrine.conf
diff --git a/integration/src/test/resources/dashboard.conf b/integration/src/test/resources/dashboard.conf
deleted file mode 100644
index b245b7025..000000000
--- a/integration/src/test/resources/dashboard.conf
+++ /dev/null
@@ -1,21 +0,0 @@
-shrine {
- problem {
- problemHandler = "net.shrine.problem.DatabaseProblemHandler$"
- }
- dashboard {
- database {
- dataSourceFrom = "testDataSource"
- slickProfileClassName = "slick.driver.H2Driver$"
- createTablesOnStart = true
- createTestValuesOnStart = false
- // For testing without JNDI
- testDataSource {
-
- //typical test settings for unit tests
- driverClassName = "org.h2.Driver"
- numThreads = 30
- url = "jdbc:h2:mem:test;DB_CLOSE_DELAY=-1"
- }
- }
- }
-}
\ No newline at end of file
diff --git a/integration/src/test/resources/shrine.conf b/integration/src/test/resources/shrine.conf
index d1f91a408..fc8e08588 100644
--- a/integration/src/test/resources/shrine.conf
+++ b/integration/src/test/resources/shrine.conf
@@ -1,132 +1,117 @@
shrine {
+ problem {
+ problemHandler = "net.shrine.problem.DatabaseProblemHandler$"
+ }
+ dashboard {
+ database {
+ dataSourceFrom = "testDataSource"
+ slickProfileClassName = "slick.driver.H2Driver$"
+ createTablesOnStart = true
+ createTestValuesOnStart = false
+ testDataSource {
+ driverClassName = "org.h2.Driver"
+ numThreads = 30
+ url = "jdbc:h2:mem:test;DB_CLOSE_DELAY=-1"
+ }
+ }
+ }
pmEndpoint {
url = "http://services.i2b2.org/i2b2/rest/PMService/getServices"
acceptAllCerts = true
timeout {
- seconds = 1
+ seconds = 1
}
}
-
ontEndpoint {
url = "http://example.com:9090/i2b2/rest/OntologyService/"
acceptAllCerts = true
timeout {
- seconds = 1
+ seconds = 1
}
}
-
hiveCredentials {
domain = "HarvardDemo"
username = "demo"
password = "demouser"
crcProjectId = "Demo"
ontProjectId = "SHRINE"
}
-
queryEntryPoint {
- attachSigningCert = true
-
+ attachSigningCert = true
authenticationType = "ecommons"
-
authorizationType = "hms-steward" //can be none, shrine-steward, or hms-steward
-
- //hms-steward config
sheriffEndpoint {
url = "http://localhost:8080/shrine-hms-authorization/queryAuthorization"
acceptAllCerts = true
timeout {
seconds = 1
}
}
-
sheriffCredentials {
username = "sheriffUsername"
password = "sheriffPassword"
}
-
- //shrine-steward config
-// shrineSteward {
-// qepUserName = "qep"
-// qepPassword = "trustme"
-// stewardBaseUrl = "https://localhost:6443
-// }
-
includeAggregateResults = false
-
maxQueryWaitTime {
minutes = 5
}
-
broadcasterServiceEndpoint {
url = "http://example.com/shrine/rest/broadcaster/broadcast"
acceptAllCerts = true
timeout {
- seconds = 1
+ seconds = 1
}
}
audit {
database {
slickProfileClassName = "slick.driver.H2Driver$"
- createTablesOnStart = true //for testing with H2 in memory, when not running unit tests. Set to false normally
-
- dataSourceFrom = "testDataSource" //Can be JNDI or testDataSource . Use testDataSource for tests, JNDI everywhere else
-
+ createTablesOnStart = true
+ dataSourceFrom = "testDataSource"
testDataSource {
driverClassName = "org.h2.Driver"
- url = "jdbc:h2:mem:test;DB_CLOSE_DELAY=-1" //H2 embedded in-memory for unit tests ;TRACE_LEVEL_SYSTEM_OUT=2 for H2's trace
+ url = "jdbc:h2:mem:test;DB_CLOSE_DELAY=-1"
}
}
}
}
-
hub {
create = true
maxQueryWaitTime {
minutes = 4.5
}
-
downstreamNodes {
- "some hospital" = "http://example.com/foo"
+ some hospital = "http://example.com/foo"
CHB = "http://example.com/chb"
PHS = "http://example.com/phs"
}
-
shouldQuerySelf = true
}
-
adapter {
crcEndpoint {
url = "http://services.i2b2.org/i2b2/rest/QueryToolService/"
acceptAllCerts = true
timeout {
seconds = 1
}
}
-
setSizeObfuscation = true
-
adapterLockoutAttemptsThreshold = 10
-
adapterMappingsFileName = "AdapterMappings.xml"
-
maxSignatureAge {
minutes = 5
}
-
immediatelyRunIncomingQueries = false
}
-
networkStatusQuery = "\\\\SHRINE\\SHRINE\\Diagnoses\\Mental Illness\\Disorders usually diagnosed in infancy, childhood, or adolescence\\Pervasive developmental disorders\\Infantile autism, current or active state\\"
-
humanReadableNodeName = "SHRINE Cell"
-
shrineDatabaseType = "mysql"
-
keystore {
file = "shrine.keystore"
password = "chiptesting"
privateKeyAlias = "test-cert"
keyStoreType = "PKCS12"
- caCertAliases = [carra ca]
+ caCertAliases = [
+ "carra ca"
+ ]
}
}
diff --git a/integration/src/test/scala/net/shrine/integration/ProblemCreation.scala b/integration/src/test/scala/net/shrine/integration/ProblemCreation.scala
index cca8028a8..c09f65a78 100644
--- a/integration/src/test/scala/net/shrine/integration/ProblemCreation.scala
+++ b/integration/src/test/scala/net/shrine/integration/ProblemCreation.scala
@@ -1,140 +1,141 @@
package net.shrine.integration
import java.net.{URL, URLConnection, URLStreamHandler, URLStreamHandlerFactory}
import java.sql.SQLException
import net.shrine.adapter.AbstractQueryRetrievalTestCase.BogusRequest
import net.shrine.adapter._
import net.shrine.adapter.client.{CouldNotParseXmlFromAdapter, HttpErrorCodeFromAdapter}
import net.shrine.adapter.components.QueryNotInDatabase
import net.shrine.adapter.dao.BotDetectedException
import net.shrine.adapter.service.{CouldNotVerifySignature, UnknownRequestType}
import net.shrine.aggregation._
import net.shrine.authentication.{NotAuthenticatedException, NotAuthenticatedProblem}
import net.shrine.authorization.{CouldNotInterpretResponseFromPmCell, CouldNotReachPmCell, ErrorStatusFromDataStewardApp, MissingRequiredRoles}
import net.shrine.broadcaster.CouldNotParseResultsException
import net.shrine.client.HttpResponse
import net.shrine.hms.authorization.HMSNotAuthenticatedProblem
import net.shrine.problem._
import net.shrine.protocol.QueryResult.StatusType
import net.shrine.protocol.query.QueryDefinition
import net.shrine.protocol._
import net.shrine.qep.queries.QepDatabaseProblem
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import org.scalatest.{FlatSpec, Matchers}
import slick.driver.H2Driver.api._
import scala.concurrent.duration.FiniteDuration
import scala.xml.{NodeSeq, SAXParseException}
/**
* Created by ty on 8/29/16.
* Tests that we can successfully log every problem in the codebase.
* Due to the time nature of logging problems, we create the succeed
* early loop at the bottom to give every problem a chance at being
* created on time.
*/
@RunWith(classOf[JUnitRunner])
class ProblemCreation extends FlatSpec with Matchers {
val throwable = new IllegalArgumentException("Boo")
val credential: Credential = Credential("string", isToken = true)
val authInfo = AuthenticationInfo("domain", "username", credential)
val authExecption = AdapterLockoutException(authInfo, "url")
val bogus: ShrineRequest = new BogusRequest
val seconds = new FiniteDuration(10, java.util.concurrent.TimeUnit.SECONDS)
val queryDefinition = QueryDefinition("string", None)
val runQueryRequest = new RunQueryRequest("id", seconds, authInfo, 10, None, None, Set(), queryDefinition)
val saxxException: SAXParseException = new SAXParseException("hey", null)
val xmlResponse: String = ""
val someXml = Heyo!
val teapot: HttpResponse = HttpResponse(418, "body")
val nodeId: NodeId = NodeId("name")
val couldNotParseException: CouldNotParseResultsException = CouldNotParseResultsException(5, "url", "body", throwable)
val queryResult = QueryResult(5l, 5l, None, 5l, None, None, None, StatusType("name", isDone=false), None)
val readyQueryResponse = ReadQueryResultResponse(5l, queryResult)
val foo: NonI2b2ableResponse = new Foo()
"Problems" should "all be successfully created and logged" in {
URL.setURLStreamHandlerFactory(new BogusUrlFactory)
val db = Problems.DatabaseConnector
val queries = Problems.Queries
+ db.runBlocking(db.IO.resetTable)
val problemSize = () => db.runBlocking(queries.size.result)
problemSize() shouldBe 0
val problems: Seq[AbstractProblem] = Seq(
HttpErrorCodeFromAdapter("url", 5, "string response body"),
CouldNotParseXmlFromAdapter("url", 6, "responseBody", saxxException),
QueryNotFound(10l),
QueryResultNotAvailable(10l),
CouldNotRetrieveQueryFromCrc(10l, throwable),
AdapterLockout(authInfo, authExecption),
CrcCouldNotBeInvoked("crcUrl", bogus, CrcInvocationException("url", bogus, throwable)),
AdapterMappingProblem(AdapterMappingException(runQueryRequest, "message", throwable)),
AdapterDatabaseProblem(new SQLException("reason", "state", 5)),
BotDetected(BotDetectedException("domain", "user", 5l, 5l, 5l)),
CannotParseXmlFromCrc(saxxException, xmlResponse),
ExceptionWhileLoadingCrcResponse(throwable, xmlResponse),
ErrorFromCrcBreakdown(ErrorFromCrcException("message")),
CannotInterpretCrcBreakdownXml(MissingCrCXmlResultException(someXml, throwable)),
QueryNotInDatabase(I2b2AdminReadQueryDefinitionRequest("project", seconds, authInfo, 5l)),
// Difficult to test, as I would have to pull it out of the defining code,
// Change it from an object to a case class, and make sure that I'm not breaking
// Any breakdown logic by doing so.
// BreakdownFailure,
CouldNotVerifySignature(BroadcastMessage(5l, authInfo, bogus)),
UnknownRequestType(RequestType("apple", None)),
NotAuthenticatedProblem(NotAuthenticatedException("string", "string", "message", throwable)),
MissingRequiredRoles("pid", Set(), authInfo),
CouldNotReachPmCell("url", authInfo, throwable),
CouldNotInterpretResponseFromPmCell("url", authInfo, teapot, throwable),
ErrorStatusFromDataStewardApp(spray.http.HttpResponse(), new URL("bogus", "host", 5, "file")),
CouldNotConnectToAdapter(nodeId, throwable),
TimedOutWithAdapter(nodeId),
CouldNotParseResultsProblem(couldNotParseException),
HttpErrorResponseProblem(couldNotParseException),
NoValidResponsesToAggregate(),
// Difficult to test since I can't grab private value:
//InvalidResultProblem(Invalid(None, "error")),
HMSNotAuthenticatedProblem(authInfo),
ErrorStatusFromCrc(None, ""),
QepDatabaseProblem(throwable),
ProblemNotYetEncoded("summary", Some(throwable)),
NoI2b2AnalogExists(foo.getClass),
TestProblem()
)
var count = 0
// give it up to 1 second to finish
while(problemSize() != problems.length && count < 20) {
Thread.sleep(50)
count+=1
}
problemSize() shouldBe problems.length
db.runBlocking(queries.result) should contain theSameElementsAs problems.map(_.toDigest)
}
}
class Foo extends ShrineResponse with NonI2b2ableResponse {
override def toXml: NodeSeq = Yay
}
class BogusUrlFactory extends URLStreamHandlerFactory {
override def createURLStreamHandler(protocol: String): URLStreamHandler = new BogusUrlHandler
}
class BogusUrlHandler extends URLStreamHandler {
override def openConnection(u: URL): URLConnection = new BogusUrlConnection(u)
}
class BogusUrlConnection(u: URL) extends URLConnection(u) {
override def connect(): Unit = {}
}
\ No newline at end of file