|
Play Framework/Scala example source code file (DebugConfigurationSpec.scala)
The DebugConfigurationSpec.scala Play Framework example source code/* * * * Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com> * */ package play.api.libs.ws.ssl.debug import org.specs2.mutable._ import play.api.libs.ws.ssl.SSLDebugConfig object DebugConfigurationSpec extends Specification { sequential // global settings, must be sequential // Loggers not needed, but useful to doublecheck that the code is doing what it should. // ./build test-only play.api.libs.ws.ssl.debug.DebugConfigurationSpec val internalDebugLogger = org.slf4j.LoggerFactory.getLogger("play.api.libs.ws.ssl.debug.FixInternalDebugLogging") val certpathDebugLogger = org.slf4j.LoggerFactory.getLogger("play.api.libs.ws.ssl.debug.FixCertpathDebugLogging") def setLoggerDebug(slf4jLogger: org.slf4j.Logger) { val logbackLogger = slf4jLogger.asInstanceOf[ch.qos.logback.classic.Logger] logbackLogger.setLevel(ch.qos.logback.classic.Level.DEBUG) } "configure" should { "turn on java.security.debug code" in { //setLoggerDebug(certpathDebugLogger) Option(System.getProperty("java.security.debug")) must beLike { case Some(value) => value must be empty case None => ok } val debugConfig = SSLDebugConfig(certpath = true) val config = new DebugConfiguration() config.configure(debugConfig) System.getProperty("java.security.debug") must contain("certpath") }.after { System.clearProperty("java.security.debug") } "turn off java.security.debug code" in { System.setProperty("java.security.debug", "certpath") val debugConfig = SSLDebugConfig(certpath = false) val config = new DebugConfiguration() config.configure(debugConfig) System.getProperty("java.security.debug") must not contain("certpath") }.after { System.clearProperty("java.security.debug") } "turn on javax.ssl.debug code" in { //setLoggerDebug(internalDebugLogger) Option(System.getProperty("javax.net.debug")) must beLike { case Some(value) => value must be empty case None => ok } val debugConfig = SSLDebugConfig(ssl = true) val config = new DebugConfiguration() config.configure(debugConfig) System.getProperty("javax.net.debug") must contain("ssl") }.after { System.clearProperty("javax.net.debug") } "turn off javax.ssl.debug code" in { System.setProperty("javax.net.debug", "ssl") val debugConfig = SSLDebugConfig(ssl = false) val config = new DebugConfiguration() config.configure(debugConfig) System.getProperty("javax.net.debug") must not contain("ssl") }.after { System.clearProperty("javax.net.debug") } } } Other Play Framework source code examplesHere is a short list of links related to this Play Framework DebugConfigurationSpec.scala source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.