Skip to content
This repository has been archived by the owner on Oct 14, 2020. It is now read-only.

Commit

Permalink
Merge pull request #381 from ajm01/switch-to-underscores-boost-props
Browse files Browse the repository at this point in the history
move boost var names to use underscores vs dots
  • Loading branch information
scottkurz authored Sep 13, 2019
2 parents 9eec39a + 31db787 commit eabd692
Show file tree
Hide file tree
Showing 40 changed files with 98 additions and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public Properties getDatasourceProperties() {

Properties datasourceProperties = new Properties();

// Find and add all "boost.db." properties.
// Find and add all "boost_db_" properties.
for (String key : boostConfigProperties.stringPropertyNames()) {
if (key.startsWith(BoostProperties.DATASOURCE_PREFIX)) {
String value = (String) boostConfigProperties.get(key);
Expand Down
35 changes: 19 additions & 16 deletions boost-common/src/main/java/boost/common/config/BoostProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,25 @@

public final class BoostProperties {

// Boost specific
public static final String BOOST_PROP_PREFIX = "boost_";

// HTTP Endpoint properties
public static final String ENDPOINT_HOST = "boost.http.host";
public static final String ENDPOINT_HTTP_PORT = "boost.http.port";
public static final String ENDPOINT_HTTPS_PORT = "boost.http.securePort";
public static final String ENDPOINT_HOST = "boost_http_host";
public static final String ENDPOINT_HTTP_PORT = "boost_http_port";
public static final String ENDPOINT_HTTPS_PORT = "boost_http_securePort";

// Datasource default properties
public static final String DATASOURCE_PREFIX = "boost.db.";
public static final String DATASOURCE_DATABASE_NAME = "boost.db.databaseName";
public static final String DATASOURCE_SERVER_NAME = "boost.db.serverName";
public static final String DATASOURCE_PORT_NUMBER = "boost.db.portNumber";
public static final String DATASOURCE_USER = "boost.db.user";
public static final String DATASOURCE_PASSWORD = "boost.db.password";
public static final String DATASOURCE_CREATE_DATABASE = "boost.db.createDatabase";
public static final String DATASOURCE_URL = "boost.db.url";
public static final String DATASOURCE_PREFIX = "boost_db_";
public static final String DATASOURCE_DATABASE_NAME = "boost_db_databaseName";
public static final String DATASOURCE_SERVER_NAME = "boost_db_serverName";
public static final String DATASOURCE_PORT_NUMBER = "boost_db_portNumber";
public static final String DATASOURCE_USER = "boost_db_user";
public static final String DATASOURCE_PASSWORD = "boost_db_password";
public static final String DATASOURCE_CREATE_DATABASE = "boost_db_createDatabase";
public static final String DATASOURCE_URL = "boost_db_url";

public static final String AES_ENCRYPTION_KEY = "boost.aes.key";
public static final String AES_ENCRYPTION_KEY = "boost_aes_key";

public static final String INTERNAL_COMPILER_TARGET = "boost.internal.compiler.target";

Expand All @@ -57,22 +60,22 @@ public static Properties getConfiguredBoostProperties(Properties projectProperti

Properties boostProperties = new Properties();

// Add project properties first to allow them to be overriden by
// Add project properties first to allow them to be overriden by
// system properties (set at command line)
for (Map.Entry<Object, Object> entry : projectProperties.entrySet()) {

if (entry.getKey().toString().startsWith("boost.")) {
if (entry.getKey().toString().startsWith(BOOST_PROP_PREFIX)) {

// logger.debug("Found boost property: " +
// entry.getKey() + ":" + entry.getValue());

boostProperties.put(entry.getKey(), entry.getValue());
}
}

for (Map.Entry<Object, Object> entry : systemProperties.entrySet()) {

if (entry.getKey().toString().startsWith("boost.")) {
if (entry.getKey().toString().startsWith(BOOST_PROP_PREFIX)) {

// logger.debug("Found boost property: " +
// entry.getKey() + ":" + entry.getValue());
Expand Down
16 changes: 8 additions & 8 deletions boost-gradle/src/test/groovy/BoostPackageJdbcDb2AesTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class BoostPackageJdbcDb2AesTest extends AbstractBoostTest {
BuildResult result = GradleRunner.create()
.withProjectDir(testProjectDir)
.forwardOutput()
.withArguments("clean", "boostPackage", "-Dboost.db.databaseName=myCustomDB", "-Dboost.db.user=user", "-Dboost.db.password=password", "-Dboost.aes.key=test", "-i", "-s")
.withArguments("clean", "boostPackage", "-Dboost_db_databaseName=myCustomDB", "-Dboost_db_user=user", "-Dboost_db_password=password", "-Dboost_aes_key=test", "-i", "-s")
.build()

assertEquals(SUCCESS, result.task(":boostPackage").getOutcome())
Expand All @@ -67,10 +67,10 @@ public class BoostPackageJdbcDb2AesTest extends AbstractBoostTest {

bootstrapProperties.load(input)

assertEquals("Incorrect boost.db.user found in bootstrap.properties.", DB_USER, bootstrapProperties.getProperty("boost.db.user"))
assertEquals("Incorrect boost.db.databaseName found in bootstrap.properties.", DB_NAME, bootstrapProperties.getProperty("boost.db.databaseName"))
assertEquals("Incorrect boost_db_user found in bootstrap.properties.", DB_USER, bootstrapProperties.getProperty("boost_db_user"))
assertEquals("Incorrect boost_db_databaseName found in bootstrap.properties.", DB_NAME, bootstrapProperties.getProperty("boost_db_databaseName"))
//AES hashed password changes so we're just going to look for the aes flag.
assertTrue("Incorrect boost.db.password found in bootstrap.properties.", bootstrapProperties.getProperty("boost.db.password").contains(AES_HASHED_PASSWORD_FLAG))
assertTrue("Incorrect boost_db_password found in bootstrap.properties.", bootstrapProperties.getProperty("boost_db_password").contains(AES_HASHED_PASSWORD_FLAG))
} catch (IOException ex) {
ex.printStackTrace()
} finally {
Expand All @@ -92,7 +92,7 @@ public class BoostPackageJdbcDb2AesTest extends AbstractBoostTest {
BuildResult result = GradleRunner.create()
.withProjectDir(testProjectDir)
.forwardOutput()
.withArguments("clean", "boostPackage", "-Dboost.db.databaseName=myCustomDB", "-Dboost.db.user=user", "-Dboost.db.password={aes}Lz4sLCgwLTs=", "-Dboost.aes.key=test", "-i", "-s")
.withArguments("clean", "boostPackage", "-Dboost_db_databaseName=myCustomDB", "-Dboost_db_user=user", "-Dboost_db_password={aes}Lz4sLCgwLTs=", "-Dboost_aes_key=test", "-i", "-s")
.build()

assertEquals(SUCCESS, result.task(":boostPackage").getOutcome())
Expand All @@ -105,9 +105,9 @@ public class BoostPackageJdbcDb2AesTest extends AbstractBoostTest {

bootstrapProperties.load(input)

assertEquals("Incorrect boost.db.user found in bootstrap.properties.", DB_USER, bootstrapProperties.getProperty("boost.db.user"))
assertEquals("Incorrect boost.db.password found in bootstrap.properties.", AES_HASHED_PASSWORD, bootstrapProperties.getProperty("boost.db.password"))
assertEquals("Incorrect boost.db.databaseName found in bootstrap.properties.", DB_NAME, bootstrapProperties.getProperty("boost.db.databaseName"))
assertEquals("Incorrect boost_db_user found in bootstrap.properties.", DB_USER, bootstrapProperties.getProperty("boost_db_user"))
assertEquals("Incorrect boost_db_password found in bootstrap.properties.", AES_HASHED_PASSWORD, bootstrapProperties.getProperty("boost_db_password"))
assertEquals("Incorrect boost_db_databaseName found in bootstrap.properties.", DB_NAME, bootstrapProperties.getProperty("boost_db_databaseName"))
} catch (IOException ex) {
ex.printStackTrace()
} finally {
Expand Down
2 changes: 1 addition & 1 deletion boost-maven/boost-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
<boostRuntime>${boostRuntime}</boostRuntime>
<!-- Explicitly set the boost port to 9000
for testing purposes across multiple runtimes -->
<boost.http.port>9000</boost.http.port>
<boost_http_port>9000</boost_http_port>
</properties>
</configuration>
<executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</pomIncludes>
<properties>
<boostRuntime>${boostRuntime}</boostRuntime>
<boost.http.port>${boost.http.port}</boost.http.port>
<boost_http_port>${boost_http_port}</boost_http_port>
</properties>
</configuration>
<executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static void init() {
String runtime = System.getProperty("boostRuntime");
org.junit.Assume.assumeTrue("ol".equals(runtime) || "wlp".equals(runtime));

String port = System.getProperty("boost.http.port");
String port = System.getProperty("boost_http_port");
URL = "http://localhost:" + port + "/population";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static void init() {
String runtime = System.getProperty("boostRuntime");
org.junit.Assume.assumeTrue("ol".equals(runtime) || "wlp".equals(runtime));

String port = System.getProperty("boost.http.port");
String port = System.getProperty("boost_http_port");
URL = "http://localhost:" + port + "/api/hello";

if (System.getProperty("os.name").contains("Windows")) {
Expand Down Expand Up @@ -98,8 +98,8 @@ public void testServlet() throws Exception {
}

/*
* Execute mvn compile Note the command will be different in Windows,
* Linux/MAC and Cygwin. Thus all the
* Execute mvn compile Note the command will be different in Windows, Linux/MAC
* and Cygwin. Thus all the
*/
private void mavenCompile() throws IOException {

Expand Down Expand Up @@ -167,9 +167,8 @@ private void mavenCompile() throws IOException {
}

/*
* get file name path setup correctly for environment. This file will be
* edited on the fly by the testcase This is to test loosApplication
* function.
* get file name path setup correctly for environment. This file will be edited
* on the fly by the testcase This is to test loosApplication function.
*/
private static void setupHelloResources() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class EndpointIT {

@BeforeClass
public static void init() {
String port = System.getProperty("boost.http.port");
String port = System.getProperty("boost_http_port");
URL = "http://localhost:" + port + "/api/hello";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class EndpointIT {

@BeforeClass
public static void init() {
String port = System.getProperty("boost.http.port");
String port = System.getProperty("boost_http_port");
URL = "http://localhost:" + port + "/api/hello";
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Using profiles to configure failsafe to run certain tests
invoker.goals.1 = clean install -PnoEncoding -Dboost.db.databaseName=myCustomDB -Dboost.db.user=user -Dboost.db.password=password -Dboost.aes.key=test
invoker.goals.1 = clean install -PnoEncoding -Dboost_db_databaseName=myCustomDB -Dboost_db_user=user -Dboost_db_password=password -Dboost_aes_key=test
#Running aes hashed password test to see if it rehashes
invoker.goals.2 = clean install -Paes -Dboost.db.databaseName=myCustomDB -Dboost.db.user=user -Dboost.db.password="{aes}Lz4sLCgwLTs="
invoker.goals.2 = clean install -Paes -Dboost_db_databaseName=myCustomDB -Dboost_db_user=user -Dboost_db_password="{aes}Lz4sLCgwLTs="
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ public static void init() {
public void checkPropertiesTest() throws Exception {
String variablesXml = "target/liberty/wlp/usr/servers/defaultServer/configDropins/defaults/variables.xml";

assertEquals("Incorrect boost.db.user found in server config.", DB_USER,
assertEquals("Incorrect boost_db_user found in server config.", DB_USER,
LibertyConfigFileUtils.findVariableInXml(variablesXml, DATASOURCE_USER));
assertEquals("Incorrect boost.db.password found in server config.", ENCODED_DB_PASS,

assertEquals("Incorrect boost_db_password found in server config.", ENCODED_DB_PASS,
LibertyConfigFileUtils.findVariableInXml(variablesXml, DATASOURCE_PASSWORD));
assertEquals("Incorrect boost.db.databaseName found in server config.", DB_NAME,

assertEquals("Incorrect boost_db_databaseName found in server config.", DB_NAME,
LibertyConfigFileUtils.findVariableInXml(variablesXml, DATASOURCE_DATABASE_NAME));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ public static void init() {

@Test
public void checkPropertiesTest() throws Exception {
String variablesXml = "target/liberty/wlp/usr/servers/defaultServer/configDropins/defaults/variables.xml";

assertEquals("Incorrect boost.db.user found in generated config.", DB_USER,
LibertyConfigFileUtils.findVariableInXml(variablesXml, DATASOURCE_USER));
assertEquals("Incorrect boost.db.databaseName found in generated config.", DB_NAME,
LibertyConfigFileUtils.findVariableInXml(variablesXml, DATASOURCE_DATABASE_NAME));
String variablesXml = "target/liberty/wlp/usr/servers/defaultServer/configDropins/defaults/variables.xml";

assertEquals("Incorrect boost_db_user found in generated config.", DB_USER,
LibertyConfigFileUtils.findVariableInXml(variablesXml, DATASOURCE_USER));

assertEquals("Incorrect boost_db_databaseName found in generated config.", DB_NAME,
LibertyConfigFileUtils.findVariableInXml(variablesXml, DATASOURCE_DATABASE_NAME));

// AES hashed password changes so we're just going to look for the
// aes flag.
assertTrue("Incorrect boost.db.password found in generated config",
LibertyConfigFileUtils.findVariableInXml(variablesXml, DATASOURCE_PASSWORD).contains(AES_HASHED_PASSWORD_FLAG));
assertTrue("Incorrect boost_db_password found in generated config", LibertyConfigFileUtils
.findVariableInXml(variablesXml, DATASOURCE_PASSWORD).contains(AES_HASHED_PASSWORD_FLAG));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@

public interface BoostConstants {

public static final String DATASOURCE_PREFIX = "boost.db.";
public static final String DATASOURCE_DATABASE_NAME = "boost.db.databaseName";
public static final String DATASOURCE_SERVER_NAME = "boost.db.serverName";
public static final String DATASOURCE_PORT_NUMBER = "boost.db.portNumber";
public static final String DATASOURCE_USER = "boost.db.user";
public static final String DATASOURCE_PASSWORD = "boost.db.password";
public static final String DATASOURCE_CREATE_DATABASE = "boost.db.createDatabase";
public static final String DATASOURCE_URL = "boost.db.url";
public static final String DATASOURCE_PREFIX = "boost_db_";
public static final String DATASOURCE_DATABASE_NAME = "boost_db_databaseName";
public static final String DATASOURCE_SERVER_NAME = "boost_db_serverName";
public static final String DATASOURCE_PORT_NUMBER = "boost_db_portNumber";
public static final String DATASOURCE_USER = "boost_db_user";
public static final String DATASOURCE_PASSWORD = "boost_db_password";
public static final String DATASOURCE_CREATE_DATABASE = "boost_db_createDatabase";
public static final String DATASOURCE_URL = "boost_db_url";
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
invoker.goals.1 = clean install -Pderby

# MySQL - JDBC url
invoker.goals.2 = clean install -Pmysql -Dboost.db.url=jdbc:mysql://localhost:3306/testdb -Dboost.db.user=mysql -Dboost.db.password=mysql
invoker.goals.2 = clean install -Pmysql -Dboost_db_url=jdbc:mysql://localhost:3306/testdb -Dboost_db_user=mysql -Dboost_db_password=mysql

# MySQL - separate JDBC properties
invoker.goals.3 = clean install -Pmysql -Dboost.db.serverName=localhost -Dboost.db.portNumber=3306 -Dboost.db.databaseName=testdb -Dboost.db.user=mysql -Dboost.db.password=mysql
invoker.goals.3 = clean install -Pmysql -Dboost_db_serverName=localhost -Dboost_db_portNumber=3306 -Dboost_db_databaseName=testdb -Dboost_db_user=mysql -Dboost_db_password=mysql
2 changes: 1 addition & 1 deletion boost-maven/boost-maven-plugin/src/it/test-jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@
</goals>
<configuration>
<systemPropertyVariables>
<test.port>${boost.http.port}</test.port>
<test.port>${boost_http_port}</test.port>
</systemPropertyVariables>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class EndpointIT {

@BeforeClass
public static void init() {
String port = System.getProperty("boost.http.port");
String port = System.getProperty("boost_http_port");
URL = "http://localhost:" + port + "/population";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public HealthCheck(String dbName) {
@Test
public void testServlet() throws Exception {

String port = System.getProperty("boost.http.port");
String port = System.getProperty("boost_http_port");
String urlString = "http://localhost:" + port + "/health";

URL url = new URL(urlString);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class EndpointIT {

@BeforeClass
public static void init() {
String port = System.getProperty("boost.http.port");
String port = System.getProperty("boost_http_port");
URL = "http://localhost:" + port;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class EndpointIT {

@BeforeClass
public static void init() {
String port = System.getProperty("boost.http.port");
String port = System.getProperty("boost_http_port");
URL = "http://localhost:" + port;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# User port 9080 to match mpConfig property
invoker.goals.1 = clean install -Dboost.http.port=9080
invoker.goals.1 = clean install -Dboost_http_port=9080
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class HealthTestUtil {
public static final String INV_MAINTENANCE_TRUE = "io_openliberty_guides_inventory_inMaintenance\":true";

static {
String port = System.getProperty("boost.http.port");
String port = System.getProperty("boost_http_port");
baseUrl = "http://localhost:" + port;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# User port 9080 to match mpConfig property
invoker.goals.1 = clean install -Dboost.http.port=9080
invoker.goals.1 = clean install -Dboost_http_port=9080
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class HealthTestUtil {
public static final String INV_MAINTENANCE_TRUE = "io_openliberty_guides_inventory_inMaintenance\":true";

static {
String port = System.getProperty("boost.http.port");
String port = System.getProperty("boost_http_port");
baseUrl = "http://localhost:" + port;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void setup() throws Exception {
// until the failures are addressed.
String runtime = System.getProperty("boostRuntime");
org.junit.Assume.assumeTrue("ol".equals(runtime) || "wlp".equals(runtime));
String port = System.getProperty("boost.http.port");
String port = System.getProperty("boost_http_port");
baseUrl = "http://localhost:" + port;

JwtVerifier jwtvf = new JwtVerifier();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class MetricsIT {

@BeforeClass
public static void oneTimeSetup() {
httpPort = System.getProperty("boost.http.port");
httpPort = System.getProperty("boost_http_port");
baseHttpUrl = "http://localhost:" + httpPort + "/";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class MetricsIT {

@BeforeClass
public static void oneTimeSetup() {
httpPort = System.getProperty("boost.http.port");
httpPort = System.getProperty("boost_http_port");
baseHttpUrl = "http://localhost:" + httpPort + "/";
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# User port 9000 to match mpConfig property
invoker.goals.1 = clean install -Dboost.http.port=9000
invoker.goals.1 = clean install -Dboost_http_port=9000
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class RestClientIT {
@BeforeClass
public static void oneTimeSetup() {
// port = System.getProperty("liberty.test.port");
port = System.getProperty("boost.http.port");
port = System.getProperty("boost_http_port");
// port = "9000";
}

Expand Down
Loading

0 comments on commit eabd692

Please sign in to comment.