AMBARI-21735 - Parameterize Maven Surefire Build argLine (jonathanhurley)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6424b5f5 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6424b5f5 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6424b5f5 Branch: refs/heads/branch-feature-AMBARI-21450 Commit: 6424b5f5613f36656ee05914411a0467a2aec4e1 Parents: aa4807c Author: Jonathan Hurley <[email protected]> Authored: Wed Aug 16 20:12:49 2017 -0400 Committer: Jonathan Hurley <[email protected]> Committed: Thu Aug 17 11:40:54 2017 -0400 ---------------------------------------------------------------------- ambari-project/pom.xml | 1 + ambari-server/pom.xml | 2 +- .../main/resources/Ambari-DDL-Derby-CREATE.sql | 8 ++-- .../main/resources/Ambari-DDL-MySQL-CREATE.sql | 5 ++- .../main/resources/Ambari-DDL-Oracle-CREATE.sql | 5 ++- .../resources/Ambari-DDL-Postgres-CREATE.sql | 2 +- .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql | 5 ++- .../resources/Ambari-DDL-SQLServer-CREATE.sql | 12 +++--- .../apache/ambari/server/orm/db/DDLTests.java | 39 +++++++++++--------- .../server/testing/DBInconsistencyTests.java | 20 ++++++---- pom.xml | 2 +- 11 files changed, 57 insertions(+), 44 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/6424b5f5/ambari-project/pom.xml ---------------------------------------------------------------------- diff --git a/ambari-project/pom.xml b/ambari-project/pom.xml index 91ddb45..bef248e 100644 --- a/ambari-project/pom.xml +++ b/ambari-project/pom.xml @@ -34,6 +34,7 @@ <checkstyle.skip>false</checkstyle.skip> <forkCount>4</forkCount> <reuseForks>false</reuseForks> + <surefire.argLine>-Xmx1024m -XX:MaxPermSize=512m -Xms512m</surefire.argLine> </properties> <profiles> <profile> http://git-wip-us.apache.org/repos/asf/ambari/blob/6424b5f5/ambari-server/pom.xml ---------------------------------------------------------------------- diff --git a/ambari-server/pom.xml b/ambari-server/pom.xml index 3ff8218..0f0786a 100644 --- a/ambari-server/pom.xml +++ b/ambari-server/pom.xml @@ -595,7 +595,7 @@ <artifactId>maven-surefire-plugin</artifactId> <configuration> <skip>${skipSurefireTests}</skip> - <argLine>-Xmx1024m -XX:MaxPermSize=512m -Xms512m</argLine> + <argLine>${surefire.argLine}</argLine> <!-- Each profile in the top-level pom.xml defines which test group categories to run. --> <groups>${testcase.groups}</groups> http://git-wip-us.apache.org/repos/asf/ambari/blob/6424b5f5/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql index e27430a..9cdf8e8 100644 --- a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql +++ b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql @@ -230,7 +230,7 @@ CREATE TABLE host_version ( CONSTRAINT PK_host_version PRIMARY KEY (id), CONSTRAINT FK_host_version_host_id FOREIGN KEY (host_id) REFERENCES hosts (host_id), CONSTRAINT FK_host_version_repovers_id FOREIGN KEY (repo_version_id) REFERENCES repo_version (repo_version_id), - CONSTRAINT UQ_host_repo UNIQUE(host_id, repo_version_id, state)); + CONSTRAINT UQ_host_repo UNIQUE(host_id, repo_version_id)); CREATE TABLE servicedesiredstate ( cluster_id BIGINT NOT NULL, @@ -275,6 +275,7 @@ CREATE TABLE groups ( principal_id BIGINT NOT NULL, group_name VARCHAR(255) NOT NULL, ldap_group INTEGER NOT NULL DEFAULT 0, + group_type VARCHAR(255) NOT NULL DEFAULT 'LOCAL', CONSTRAINT PK_groups PRIMARY KEY (group_id), UNIQUE (ldap_group, group_name), CONSTRAINT FK_groups_principal_id FOREIGN KEY (principal_id) REFERENCES adminprincipal(principal_id)); @@ -552,7 +553,7 @@ CREATE table viewurl( url_id BIGINT , url_name VARCHAR(255) NOT NULL , url_suffix VARCHAR(255) NOT NULL, - PRIMARY KEY(url_id) + CONSTRAINT PK_viewurl PRIMARY KEY(url_id) ); @@ -809,6 +810,7 @@ CREATE TABLE upgrade ( cluster_id BIGINT NOT NULL, request_id BIGINT NOT NULL, direction VARCHAR(255) DEFAULT 'UPGRADE' NOT NULL, + orchestration VARCHAR(255) DEFAULT 'STANDARD' NOT NULL, upgrade_package VARCHAR(255) NOT NULL, upgrade_type VARCHAR(32) NOT NULL, repo_version_id BIGINT NOT NULL, @@ -1624,4 +1626,4 @@ create index idx_qrtz_ft_inst_job_req_rcvry on qrtz_fired_triggers(SCHED_NAME,IN create index idx_qrtz_ft_j_g on qrtz_fired_triggers(SCHED_NAME,JOB_NAME,JOB_GROUP); create index idx_qrtz_ft_jg on qrtz_fired_triggers(SCHED_NAME,JOB_GROUP); create index idx_qrtz_ft_t_g on qrtz_fired_triggers(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP); -create index idx_qrtz_ft_tg on qrtz_fired_triggers(SCHED_NAME,TRIGGER_GROUP); \ No newline at end of file +create index idx_qrtz_ft_tg on qrtz_fired_triggers(SCHED_NAME,TRIGGER_GROUP); http://git-wip-us.apache.org/repos/asf/ambari/blob/6424b5f5/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql index c73db6e..d616e77 100644 --- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql +++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql @@ -571,7 +571,7 @@ CREATE table viewurl( url_id BIGINT , url_name VARCHAR(255) NOT NULL , url_suffix VARCHAR(255) NOT NULL, - PRIMARY KEY(url_id) + CONSTRAINT PK_viewurl PRIMARY KEY(url_id) ); @@ -827,6 +827,7 @@ CREATE TABLE upgrade ( cluster_id BIGINT NOT NULL, request_id BIGINT NOT NULL, direction VARCHAR(255) DEFAULT 'UPGRADE' NOT NULL, + orchestration VARCHAR(255) DEFAULT 'STANDARD' NOT NULL, upgrade_package VARCHAR(255) NOT NULL, upgrade_type VARCHAR(32) NOT NULL, repo_version_id BIGINT NOT NULL, @@ -1577,4 +1578,4 @@ create index idx_qrtz_ft_jg on QRTZ_FIRED_TRIGGERS(SCHED_NAME,JOB_GROUP); create index idx_qrtz_ft_t_g on QRTZ_FIRED_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP); create index idx_qrtz_ft_tg on QRTZ_FIRED_TRIGGERS(SCHED_NAME,TRIGGER_GROUP); -commit; \ No newline at end of file +commit; http://git-wip-us.apache.org/repos/asf/ambari/blob/6424b5f5/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql index 52f680d..0530651 100644 --- a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql +++ b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql @@ -551,7 +551,7 @@ CREATE table viewurl( url_id NUMBER , url_name VARCHAR(255) NOT NULL , url_suffix VARCHAR(255) NOT NULL, - PRIMARY KEY(url_id) + CONSTRAINT PK_viewurl PRIMARY KEY(url_id) ); @@ -806,6 +806,7 @@ CREATE TABLE upgrade ( cluster_id NUMBER(19) NOT NULL, request_id NUMBER(19) NOT NULL, direction VARCHAR2(255) DEFAULT 'UPGRADE' NOT NULL, + orchestration VARCHAR2(255) DEFAULT 'STANDARD' NOT NULL, upgrade_package VARCHAR2(255) NOT NULL, upgrade_type VARCHAR2(32) NOT NULL, repo_version_id NUMBER(19) NOT NULL, @@ -1562,4 +1563,4 @@ create index idx_qrtz_ft_inst_job_req_rcvry on qrtz_fired_triggers(SCHED_NAME,IN create index idx_qrtz_ft_j_g on qrtz_fired_triggers(SCHED_NAME,JOB_NAME,JOB_GROUP); create index idx_qrtz_ft_jg on qrtz_fired_triggers(SCHED_NAME,JOB_GROUP); create index idx_qrtz_ft_t_g on qrtz_fired_triggers(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP); -create index idx_qrtz_ft_tg on qrtz_fired_triggers(SCHED_NAME,TRIGGER_GROUP); \ No newline at end of file +create index idx_qrtz_ft_tg on qrtz_fired_triggers(SCHED_NAME,TRIGGER_GROUP); http://git-wip-us.apache.org/repos/asf/ambari/blob/6424b5f5/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql index 037e540..1d16eb6 100644 --- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql +++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql @@ -551,7 +551,7 @@ CREATE table viewurl( url_id BIGINT , url_name VARCHAR(255) NOT NULL , url_suffix VARCHAR(255) NOT NULL, - PRIMARY KEY(url_id) + CONSTRAINT PK_viewurl PRIMARY KEY(url_id) ); http://git-wip-us.apache.org/repos/asf/ambari/blob/6424b5f5/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql index 806a6ae..da23e95 100644 --- a/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql +++ b/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql @@ -548,7 +548,7 @@ CREATE table viewurl( url_id NUMERIC , url_name VARCHAR(255) NOT NULL , url_suffix VARCHAR(255) NOT NULL, - PRIMARY KEY(url_id) + CONSTRAINT PK_viewurl PRIMARY KEY(url_id) ); @@ -804,6 +804,7 @@ CREATE TABLE upgrade ( cluster_id NUMERIC(19) NOT NULL, request_id NUMERIC(19) NOT NULL, direction VARCHAR(255) DEFAULT 'UPGRADE' NOT NULL, + orchestration VARCHAR(255) DEFAULT 'STANDARD' NOT NULL, upgrade_type VARCHAR(32) NOT NULL, repo_version_id NUMERIC(19) NOT NULL, upgrade_package VARCHAR(255) NOT NULL, @@ -1571,4 +1572,4 @@ create index idx_qrtz_ft_jg on QRTZ_FIRED_TRIGGERS(SCHED_NAME,JOB_GROUP); create index idx_qrtz_ft_t_g on QRTZ_FIRED_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP); create index idx_qrtz_ft_tg on QRTZ_FIRED_TRIGGERS(SCHED_NAME,TRIGGER_GROUP); -commit; \ No newline at end of file +commit; http://git-wip-us.apache.org/repos/asf/ambari/blob/6424b5f5/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql index cabc32a..e410555 100644 --- a/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql +++ b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql @@ -202,10 +202,9 @@ CREATE TABLE hostcomponentdesiredstate ( security_state VARCHAR(32) NOT NULL DEFAULT 'UNSECURED', restart_required BIT NOT NULL DEFAULT 0, CONSTRAINT PK_hostcomponentdesiredstate PRIMARY KEY CLUSTERED (id), - CONSTRAINT UQ_hcdesiredstate_name UNIQUE NONCLUSTERED (component_name, service_name, host_id, cluster_id), - CONSTRAINT hstcmpnntdesiredstatecmpnntnme FOREIGN KEY (component_name, service_name, cluster_id) REFERENCES servicecomponentdesiredstate (component_name, service_name, cluster_id), - CONSTRAINT hstcmponentdesiredstatehstid FOREIGN KEY (host_id) REFERENCES hosts (host_id)); - + CONSTRAINT UQ_hcdesiredstate_name UNIQUE (component_name, service_name, host_id, cluster_id), + CONSTRAINT FK_hcdesiredstate_host_id FOREIGN KEY (host_id) REFERENCES hosts (host_id), + CONSTRAINT hstcmpnntdesiredstatecmpnntnme FOREIGN KEY (component_name, service_name, cluster_id) REFERENCES servicecomponentdesiredstate (component_name, service_name, cluster_id)); CREATE TABLE hostcomponentstate ( id BIGINT NOT NULL, @@ -558,7 +557,7 @@ CREATE table viewurl( url_id BIGINT , url_name VARCHAR(255) NOT NULL , url_suffix VARCHAR(255) NOT NULL, - PRIMARY KEY CLUSTERED (url_id) + CONSTRAINT PK_viewurl PRIMARY KEY CLUSTERED (url_id) ); @@ -826,6 +825,7 @@ CREATE TABLE upgrade ( cluster_id BIGINT NOT NULL, request_id BIGINT NOT NULL, direction VARCHAR(255) DEFAULT 'UPGRADE' NOT NULL, + orchestration VARCHAR(255) DEFAULT 'STANDARD' NOT NULL, upgrade_package VARCHAR(255) NOT NULL, upgrade_type VARCHAR(32) NOT NULL, repo_version_id BIGINT NOT NULL, @@ -1585,4 +1585,4 @@ create index idx_qrtz_ft_inst_job_req_rcvry on qrtz_fired_triggers(SCHED_NAME,IN create index idx_qrtz_ft_j_g on qrtz_fired_triggers(SCHED_NAME,JOB_NAME,JOB_GROUP); create index idx_qrtz_ft_jg on qrtz_fired_triggers(SCHED_NAME,JOB_GROUP); create index idx_qrtz_ft_t_g on qrtz_fired_triggers(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP); -create index idx_qrtz_ft_tg on qrtz_fired_triggers(SCHED_NAME,TRIGGER_GROUP); \ No newline at end of file +create index idx_qrtz_ft_tg on qrtz_fired_triggers(SCHED_NAME,TRIGGER_GROUP); http://git-wip-us.apache.org/repos/asf/ambari/blob/6424b5f5/ambari-server/src/test/java/org/apache/ambari/server/orm/db/DDLTests.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/db/DDLTests.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/db/DDLTests.java index 779c937..39b3f79 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/orm/db/DDLTests.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/db/DDLTests.java @@ -17,17 +17,23 @@ */ package org.apache.ambari.server.orm.db; -import com.google.common.base.Joiner; -import com.google.common.base.Optional; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.apache.commons.lang.StringUtils; import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.*; +import com.google.common.base.Joiner; +import com.google.common.base.Optional; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; /** @@ -50,11 +56,6 @@ public class DDLTests { } @Test - public void testVerifyPostgresEmbedded() throws Exception { - verifyDDL("Postgres-EMBEDDED"); - } - - @Test public void testVerifyMySQL() throws Exception { verifyDDL("MySQL"); } @@ -119,11 +120,6 @@ public class DDLTests { } @Test - public void testComparePostgresEmbedded() throws Exception { - compareAgainstPostgres("Postgres-EMBEDDED"); - } - - @Test public void testCompareDerby() throws Exception { compareAgainstPostgres("Derby"); } @@ -159,7 +155,12 @@ public class DDLTests { else { LOG.info("{} differences found:", diffs.size()); for (String diff: diffs) { LOG.info(diff); } - Assert.fail("Found " + diffs.size() + " differences when comparing " + other + " against Postgres."); + StringBuilder buffer = new StringBuilder(); + buffer.append("Found ").append(diffs.size()).append(" differences when comparing ").append( + other).append(" against Postgres:").append(System.lineSeparator()).append( + StringUtils.join(diffs, System.lineSeparator())); + + Assert.fail(buffer.toString()); } } @@ -171,7 +172,9 @@ public class DDLTests { int uqCount = 0; for (Table t: ddl.tables.values()) { colCount += t.columns.size(); - if (t.primaryKey.isPresent()) pkCount ++; + if (t.primaryKey.isPresent()) { + pkCount ++; + } fkCount += t.foreignKeys.size(); uqCount += t.uniqueConstraints.size(); } http://git-wip-us.apache.org/repos/asf/ambari/blob/6424b5f5/ambari-server/src/test/java/org/apache/ambari/server/testing/DBInconsistencyTests.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/testing/DBInconsistencyTests.java b/ambari-server/src/test/java/org/apache/ambari/server/testing/DBInconsistencyTests.java index 05a75b3..2a847fc 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/testing/DBInconsistencyTests.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/testing/DBInconsistencyTests.java @@ -17,10 +17,12 @@ */ package org.apache.ambari.server.testing; -import com.google.inject.Guice; -import com.google.inject.Inject; -import com.google.inject.Injector; -import com.google.inject.persist.PersistService; +import java.util.Collection; +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.EntityTransaction; + import org.apache.ambari.server.orm.GuiceJpaInitializer; import org.apache.ambari.server.orm.InMemoryDefaultTestModule; import org.apache.ambari.server.orm.OrmTestHelper; @@ -46,10 +48,10 @@ import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.persistence.EntityManager; -import javax.persistence.EntityTransaction; -import java.util.Collection; -import java.util.List; +import com.google.inject.Guice; +import com.google.inject.Inject; +import com.google.inject.Injector; +import com.google.inject.persist.PersistService; public class DBInconsistencyTests { @@ -96,6 +98,8 @@ public class DBInconsistencyTests { helper.addHost(clusters, cluster, "h1"); + helper.initializeClusterWithStack(cluster); + helper.installHdfsService(cluster, serviceFactory, serviceComponentFactory, serviceComponentHostFactory, "h1"); http://git-wip-us.apache.org/repos/asf/ambari/blob/6424b5f5/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index e7d75e4..751b256 100644 --- a/pom.xml +++ b/pom.xml @@ -146,7 +146,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> - <version>2.19</version> + <version>2.20</version> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId>
