diff --git a/ambari-agent/pom.xml b/ambari-agent/pom.xml
index 9389ac375dc..7321f16887b 100644
--- a/ambari-agent/pom.xml
+++ b/ambari-agent/pom.xml
@@ -90,6 +90,7 @@
com.google.guava
guava
+ 18.0
org.apache.hadoop
diff --git a/ambari-project/pom.xml b/ambari-project/pom.xml
index 96fb7cc83c0..33e53752d0e 100644
--- a/ambari-project/pom.xml
+++ b/ambari-project/pom.xml
@@ -291,7 +291,7 @@
com.google.guava
guava
- 18.0
+ 24.1.1-jre
com.google.code.findbugs
diff --git a/ambari-server-spi/src/main/java/org/apache/ambari/spi/net/HttpURLConnectionProvider.java b/ambari-server-spi/src/main/java/org/apache/ambari/spi/net/HttpURLConnectionProvider.java
new file mode 100644
index 00000000000..b98202553cf
--- /dev/null
+++ b/ambari-server-spi/src/main/java/org/apache/ambari/spi/net/HttpURLConnectionProvider.java
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.spi.net;
+
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * The {@link HttpURLConnectionProvider} is used as a way to provide
+ * {@link HttpURLConnection} instances which are backed by Ambari's truststore,
+ * cookie store, and timeout configurations.
+ */
+public interface HttpURLConnectionProvider {
+
+ /**
+ * Gets a {@link HttpURLConnection} which is initialized and ready to read.
+ *
+ * @param url
+ * the URL to retrieve information from.
+ * @param headers
+ * the HTTP headers to use in the request.
+ *
+ * @return an iniitalized HTTP connection which is ready to read.
+ * @throws IOException
+ * if the URL could not be opened.
+ */
+ HttpURLConnection getConnection(String url, Map> headers) throws IOException;
+
+}
diff --git a/ambari-server-spi/src/main/java/org/apache/ambari/spi/net/package-info.java b/ambari-server-spi/src/main/java/org/apache/ambari/spi/net/package-info.java
new file mode 100644
index 00000000000..be24533c456
--- /dev/null
+++ b/ambari-server-spi/src/main/java/org/apache/ambari/spi/net/package-info.java
@@ -0,0 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+/**
+ * Provides classes for working with network connections and streaming.
+ */
+package org.apache.ambari.spi.net;
\ No newline at end of file
diff --git a/ambari-server-spi/src/main/java/org/apache/ambari/spi/upgrade/UpgradeCheckRequest.java b/ambari-server-spi/src/main/java/org/apache/ambari/spi/upgrade/UpgradeCheckRequest.java
index 62e76732e47..ce3b87f7571 100644
--- a/ambari-server-spi/src/main/java/org/apache/ambari/spi/upgrade/UpgradeCheckRequest.java
+++ b/ambari-server-spi/src/main/java/org/apache/ambari/spi/upgrade/UpgradeCheckRequest.java
@@ -17,11 +17,13 @@
*/
package org.apache.ambari.spi.upgrade;
+import java.net.HttpURLConnection;
import java.util.HashMap;
import java.util.Map;
import org.apache.ambari.spi.ClusterInformation;
import org.apache.ambari.spi.RepositoryVersion;
+import org.apache.ambari.spi.net.HttpURLConnectionProvider;
/**
* Represents a request to run the upgrade checks before an upgrade begins.
@@ -32,6 +34,7 @@ public class UpgradeCheckRequest {
private boolean m_revert = false;
private final RepositoryVersion m_targetRepositoryVersion;
private final Map m_checkConfigurations;
+ private final HttpURLConnectionProvider m_httpURLConnectionProvider;
/**
* Used for tracking results during a check request.
@@ -51,13 +54,19 @@ public class UpgradeCheckRequest {
* @param checkConfigurations
* any configurations specified in the upgrade pack which can be used
* to when
+ * @param httpURLConnectionProvider
+ * provides a mechanism for an {@link UpgradeCheck} to make URL
+ * requests while using Ambari's truststore and configured stream
+ * timeout settings.
*/
public UpgradeCheckRequest(ClusterInformation clusterInformation, UpgradeType upgradeType,
- RepositoryVersion targetRepositoryVersion, Map checkConfigurations) {
+ RepositoryVersion targetRepositoryVersion, Map checkConfigurations,
+ HttpURLConnectionProvider httpURLConnectionProvider) {
m_clusterInformation = clusterInformation;
m_upgradeType = upgradeType;
m_targetRepositoryVersion = targetRepositoryVersion;
m_checkConfigurations = checkConfigurations;
+ m_httpURLConnectionProvider = httpURLConnectionProvider;
}
/**
@@ -133,4 +142,14 @@ public void addResult(UpgradeCheckDescription description, UpgradeCheckStatus st
public UpgradeCheckStatus getResult(UpgradeCheckDescription description) {
return m_results.get(description);
}
+
+ /**
+ * Gets a class which can construct {@link HttpURLConnection} instances which
+ * are backed by Ambari's cookie store, truststore, and timeout settings.
+ *
+ * @return the httpURLConnectionProvider an instance of the provider.
+ */
+ public HttpURLConnectionProvider getHttpURLConnectionProvider() {
+ return m_httpURLConnectionProvider;
+ }
}
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/UpgradeCheckRegistry.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/UpgradeCheckRegistry.java
index 2e36f363474..35dc74985ef 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/UpgradeCheckRegistry.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/UpgradeCheckRegistry.java
@@ -17,10 +17,13 @@
*/
package org.apache.ambari.server.checks;
+import java.net.URL;
+import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -41,6 +44,10 @@
import org.apache.ambari.spi.upgrade.UpgradeType;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
+import org.reflections.Reflections;
+import org.reflections.scanners.SubTypesScanner;
+import org.reflections.scanners.TypeAnnotationsScanner;
+import org.reflections.util.ConfigurationBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -171,7 +178,18 @@ public Set getFailedPluginClassNames() {
/**
* Uses the library classloader from the the target stack in order to find any
- * plugin-in {@link UpgradeCheck}s which are declared in the upgrade pack.
+ * plugin-in {@link UpgradeCheck}s which are declared in the upgrade pack as
+ * well as any upgrade checks which are found in the classloader and marked as
+ * {@link UpgradeCheckInfo#required()} for this {@link UpgradeType}.
+ *
+ * This method uses a {@link Reflections} instance which has been created
+ * using only the {@link URL}s which the stack library is comprised of. This
+ * means that scanning the path for {@link UpgradeCheck} instances is quick.
+ * However, this also means that the {@link ClassLoader} is unable to load
+ * classes which are defined in the stack but ship with Ambari's
+ * {@link ClassLoader}. For this reason, we must use a different
+ * {@link ClassLoader} for loading explicitly defined classes versus those
+ * which are discovered by {@link Reflections}.
*
* @param upgradePack
* the upgrade pack which defines the upgrade check classes.
@@ -180,15 +198,19 @@ public Set getFailedPluginClassNames() {
*/
private void loadPluginUpgradeChecksFromStack(UpgradePack upgradePack,
PluginUpgradeChecks pluginChecks) throws AmbariException {
- List pluginCheckClassNames = upgradePack.getPrerequisiteChecks();
+ Set pluginCheckClassNames = new HashSet<>(upgradePack.getPrerequisiteChecks());
StackId ownerStackId = upgradePack.getOwnerStackId();
StackInfo stackInfo = metainfoProvider.get().getStack(ownerStackId);
- ClassLoader classLoader = stackInfo.getLibraryClassLoader();
+ URLClassLoader classLoader = stackInfo.getLibraryClassLoader();
if (null != classLoader) {
+
+ // first find all of the plugins which are explicitely defined in the
+ // upgrade pack and attempt to load and register them
for (String pluginCheckClassName : pluginCheckClassNames) {
try {
- UpgradeCheck upgradeCheck = stackInfo.getLibraryInstance(m_injector, pluginCheckClassName);
+ UpgradeCheck upgradeCheck = stackInfo.getLibraryInstance(m_injector,
+ pluginCheckClassName);
pluginChecks.m_loadedChecks.add(upgradeCheck);
@@ -200,10 +222,47 @@ private void loadPluginUpgradeChecksFromStack(UpgradePack upgradePack,
pluginChecks.m_failedChecks.add(pluginCheckClassName);
}
}
+
+ // next find all plugin checks which are required for this upgrade type by
+ // scanning just the classes shipped with the stack's library JAR
+ Reflections reflections = new Reflections(
+ new ConfigurationBuilder()
+ .addClassLoader(classLoader)
+ .addUrls(classLoader.getURLs())
+ .setScanners(new SubTypesScanner(),new TypeAnnotationsScanner()));
+
+ Set> upgradeChecksFromLoader = reflections.getSubTypesOf(
+ UpgradeCheck.class);
+
+ if(null != upgradeChecksFromLoader && !upgradeChecksFromLoader.isEmpty()) {
+ for (Class extends UpgradeCheck> clazz : upgradeChecksFromLoader) {
+ // first check to make sure we didn't already try to load this one if it
+ // was explicitely defined in the upgrade pack (from above)
+ if (pluginCheckClassNames.contains(clazz.getName())) {
+ continue;
+ }
+
+ // see if this check required by inspecting the annotation
+ UpgradeCheckInfo upgradeCheckInfo = clazz.getAnnotation(UpgradeCheckInfo.class);
+ if (null != upgradeCheckInfo && ArrayUtils.contains(upgradeCheckInfo.required(), upgradePack.getType())) {
+ // if the annotation says the check is required, then load it
+ try {
+ pluginChecks.m_loadedChecks.add(clazz.newInstance());
+
+ LOG.info("Registered pre-upgrade check {} for stack {}", clazz, ownerStackId);
+ } catch (Exception exception) {
+ LOG.error("Unable to load the upgrade check {}", clazz, exception);
+
+ // keep track of the failed check
+ pluginChecks.m_failedChecks.add(clazz.getName());
+ }
+ }
+ }
+ }
} else {
LOG.error(
"Unable to perform the following upgrade checks because no libraries could be loaded for the {} stack: {}",
- ownerStackId, StringUtils.join(pluginCheckClassNames, ","));
+ ownerStackId, StringUtils.join(pluginCheckClassNames, ", "));
pluginChecks.m_failedChecks.addAll(pluginCheckClassNames);
}
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PreUpgradeCheckResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PreUpgradeCheckResourceProvider.java
index 412730e5a3f..fea91bc1511 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PreUpgradeCheckResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PreUpgradeCheckResourceProvider.java
@@ -28,6 +28,7 @@
import org.apache.ambari.server.checks.UpgradeCheckRegistry;
import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.AmbariManagementController;
+import org.apache.ambari.server.controller.internal.URLStreamProvider.AmbariHttpUrlConnectionProvider;
import org.apache.ambari.server.controller.spi.NoSuchParentResourceException;
import org.apache.ambari.server.controller.spi.NoSuchResourceException;
import org.apache.ambari.server.controller.spi.Predicate;
@@ -215,7 +216,8 @@ public Set getResources(Request request, Predicate predicate) throws S
final UpgradeCheckRequest upgradeCheckRequest = new UpgradeCheckRequest(clusterInformation,
upgradeType, targetRepositoryVersion,
- upgradePack.getPrerequisiteCheckConfig().getAllProperties());
+ upgradePack.getPrerequisiteCheckConfig().getAllProperties(),
+ new AmbariHttpUrlConnectionProvider());
if (propertyMap.containsKey(UPGRADE_CHECK_FOR_REVERT_PROPERTY_ID)) {
Boolean forRevert = BooleanUtils.toBooleanObject(propertyMap.get(UPGRADE_CHECK_FOR_REVERT_PROPERTY_ID).toString());
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/URLStreamProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/URLStreamProvider.java
index d1e93493baa..765b93e519f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/URLStreamProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/URLStreamProvider.java
@@ -37,6 +37,8 @@
import org.apache.ambari.server.configuration.ComponentSSLConfiguration;
import org.apache.ambari.server.controller.utilities.StreamProvider;
+import org.apache.ambari.server.proxy.ProxyService;
+import org.apache.ambari.spi.net.HttpURLConnectionProvider;
import org.apache.commons.io.IOUtils;
import org.apache.http.HttpStatus;
import org.slf4j.Logger;
@@ -93,20 +95,20 @@ public URLStreamProvider(int connectionTimeout, int readTimeout,
public URLStreamProvider(int connectionTimeout, int readTimeout, String trustStorePath,
String trustStorePassword, String trustStoreType) {
- this.connTimeout = connectionTimeout;
+ connTimeout = connectionTimeout;
this.readTimeout = readTimeout;
this.trustStorePath = trustStorePath;
this.trustStorePassword = trustStorePassword;
this.trustStoreType = trustStoreType;
- this.setupTruststoreForHttps = true;
+ setupTruststoreForHttps = true;
}
public void setSetupTruststoreForHttps(boolean setupTruststoreForHttps) {
this.setupTruststoreForHttps = setupTruststoreForHttps;
}
-
+
public boolean getSetupTruststoreForHttps() {
- return this.setupTruststoreForHttps;
+ return setupTruststoreForHttps;
}
// ----- StreamProvider ----------------------------------------------------
@@ -178,7 +180,7 @@ public HttpURLConnection processURL(String spec, String requestMethod, byte[] bo
LOG.debug("readFrom spec:{}", spec);
}
- HttpURLConnection connection = (spec.startsWith("https") && this.setupTruststoreForHttps) ?
+ HttpURLConnection connection = (spec.startsWith("https") && setupTruststoreForHttps) ?
getSSLConnection(spec) : getConnection(spec);
AppCookieManager appCookieManager = getAppCookieManager();
@@ -323,7 +325,39 @@ protected HttpsURLConnection getSSLConnection(String spec) throws IOException, I
.openConnection());
connection.setSSLSocketFactory(sslSocketFactory);
-
+
return connection;
}
+
+ /**
+ * A default implementation of {@link HttpURLConnectionProvider}, this class
+ * will use the {@link URLStreamProvider} in order to provide an
+ * {@link HttpURLConnection} which is able to use Ambari's cookie store,
+ * truststore, and timeout values.
+ */
+ public static final class AmbariHttpUrlConnectionProvider implements HttpURLConnectionProvider {
+
+ /**
+ * The stream provider.
+ */
+ private final URLStreamProvider m_streamProvider;
+
+ /**
+ * Constructor.
+ *
+ */
+ public AmbariHttpUrlConnectionProvider() {
+ m_streamProvider = new URLStreamProvider(ProxyService.URL_CONNECT_TIMEOUT,
+ ProxyService.URL_READ_TIMEOUT, ComponentSSLConfiguration.instance());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public HttpURLConnection getConnection(String url, Map> headers)
+ throws IOException {
+ return m_streamProvider.processURL(url, "GET", (InputStream) null, headers);
+ }
+ }
}
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java
index 287ee89a782..23f916cb40f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java
@@ -42,6 +42,8 @@
import org.apache.commons.lang.builder.EqualsBuilder;
+import com.google.common.base.MoreObjects;
+
@Entity
@Table(name = "clusterconfig",
uniqueConstraints = {@UniqueConstraint(name = "UQ_config_type_tag", columnNames = {"cluster_id", "type_name", "version_tag"}),
@@ -303,7 +305,7 @@ public void setServiceConfigEntities(Collection serviceConf
*/
@Override
public String toString() {
- return com.google.common.base.Objects.toStringHelper(this)
+ return MoreObjects.toStringHelper(this)
.add("clusterId", clusterId)
.add("type", type)
.add("version", version)
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java
index 3a2506d62a6..eba273f6155 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java
@@ -41,6 +41,7 @@
import org.apache.ambari.server.state.MaintenanceState;
import org.apache.ambari.server.state.State;
+import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
@@ -278,7 +279,7 @@ public void setRestartRequired(boolean restartRequired) {
*/
@Override
public String toString() {
- return Objects.toStringHelper(this).add("serviceName", serviceName).add("componentName",
+ return MoreObjects.toStringHelper(this).add("serviceName", serviceName).add("componentName",
componentName).add("hostId", hostId).add("desiredState", desiredState).toString();
}
}
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntity.java
index 0d295a4597d..dacaa55c10f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntity.java
@@ -36,7 +36,7 @@
import org.apache.ambari.server.state.State;
import org.apache.ambari.server.state.UpgradeState;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
@Entity
@Table(name = "hostcomponentstate")
@@ -260,7 +260,7 @@ public void setHostEntity(HostEntity hostEntity) {
*/
@Override
public String toString() {
- return Objects.toStringHelper(this).add("serviceName", serviceName).add("componentName",
+ return MoreObjects.toStringHelper(this).add("serviceName", serviceName).add("componentName",
componentName).add("hostId", hostId).add("state", currentState).toString();
}
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeHistoryEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeHistoryEntity.java
index 0f7ac720b6d..d1c93245dfa 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeHistoryEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeHistoryEntity.java
@@ -32,6 +32,7 @@
import org.apache.commons.lang.builder.EqualsBuilder;
+import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
/**
@@ -222,7 +223,7 @@ public int hashCode() {
*/
@Override
public String toString() {
- return Objects.toStringHelper(this)
+ return MoreObjects.toStringHelper(this)
.add("id", id)
.add("upgradeId", upgradeId)
.add("serviceName", serviceName)
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
index 67c0be97e5e..2b302824055 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
@@ -59,6 +59,7 @@
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.text.StrBuilder;
+import com.google.common.base.MoreObjects;
import com.google.inject.Inject;
/**
@@ -552,7 +553,7 @@ public boolean equals(Object object) {
*/
@Override
public String toString() {
- return com.google.common.base.Objects.toStringHelper(this)
+ return MoreObjects.toStringHelper(this)
.add("host", hostName)
.add("component", componentName)
.add("current", currentVersion)
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java b/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java
index 89eec3768a1..5b1a6bca991 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java
@@ -303,7 +303,7 @@ public StackRoleCommandOrder getRoleCommandOrder() {
* @return the class loader for 3rd party JARs supplied by the stack or
* {@code null} if there are no libraries for this stack.
*/
- public @Nullable ClassLoader getLibraryClassLoader() {
+ public @Nullable URLClassLoader getLibraryClassLoader() {
return libraryClassLoader;
}
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/upgrade/ConfigurationCondition.java b/ambari-server/src/main/java/org/apache/ambari/server/stack/upgrade/ConfigurationCondition.java
index 4e5910098b5..fafd5e7ca2e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/stack/upgrade/ConfigurationCondition.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/upgrade/ConfigurationCondition.java
@@ -31,7 +31,7 @@
import org.apache.ambari.server.state.Config;
import org.apache.commons.lang.StringUtils;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
/**
* The {@link ConfigurationCondition} class is used to represent a condition on
@@ -119,7 +119,7 @@ public enum ComparisonType {
*/
@Override
public String toString() {
- return Objects.toStringHelper(this).add("type", type).add("property", property).add("value",
+ return MoreObjects.toStringHelper(this).add("type", type).add("property", property).add("value",
value).add("comparison", comparisonType).omitNullValues().toString();
}
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/upgrade/Grouping.java b/ambari-server/src/main/java/org/apache/ambari/server/stack/upgrade/Grouping.java
index b2c02a6bd2e..dbc9f3b1315 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/stack/upgrade/Grouping.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/upgrade/Grouping.java
@@ -42,7 +42,7 @@
import org.apache.ambari.server.utils.SetUtils;
import org.apache.commons.lang.StringUtils;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
/**
*
@@ -417,6 +417,6 @@ private void addSkippedServices(Map> skippedServices,
*/
@Override
public String toString() {
- return Objects.toStringHelper(this).add("name", name).toString();
+ return MoreObjects.toStringHelper(this).add("name", name).toString();
}
}
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/upgrade/HostOrderItem.java b/ambari-server/src/main/java/org/apache/ambari/server/stack/upgrade/HostOrderItem.java
index 8fe361f8e20..87557e7f4ae 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/stack/upgrade/HostOrderItem.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/upgrade/HostOrderItem.java
@@ -22,7 +22,7 @@
import org.apache.ambari.spi.upgrade.UpgradeType;
import org.apache.commons.lang.StringUtils;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
/**
* The {@link HostOrderItem} class represents the orchestration order of hosts
@@ -96,7 +96,7 @@ public List getActionItems() {
*/
@Override
public String toString() {
- return Objects.toStringHelper(this).add("type", m_type).add("items",
+ return MoreObjects.toStringHelper(this).add("type", m_type).add("items",
StringUtils.join(m_actionItems, ", ")).omitNullValues().toString();
}
}
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/StackInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/state/StackInfo.java
index 99b2d3badcb..6b55e6684cc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/StackInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/StackInfo.java
@@ -19,6 +19,7 @@
package org.apache.ambari.server.state;
import java.io.File;
+import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -91,7 +92,7 @@ public class StackInfo implements Comparable, Validable {
* A {@link ClassLoader} for any JARs discovered in the stack's library
* folder.
*/
- private ClassLoader libraryClassLoader = null;
+ private URLClassLoader libraryClassLoader = null;
/**
* List of services removed from current stack
@@ -673,7 +674,7 @@ public StackReleaseVersion getReleaseVersion() {
* @return the class loader for 3rd party JARs supplied by the stack or
* {@code null} if there are no libraries for this stack.
*/
- public @Nullable ClassLoader getLibraryClassLoader() {
+ public @Nullable URLClassLoader getLibraryClassLoader() {
return libraryClassLoader;
}
@@ -684,7 +685,7 @@ public StackReleaseVersion getReleaseVersion() {
* @param libraryClassLoader
* the class loader.
*/
- public void setLibraryClassLoader(ClassLoader libraryClassLoader) {
+ public void setLibraryClassLoader(URLClassLoader libraryClassLoader) {
this.libraryClassLoader = libraryClassLoader;
}
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog270.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog270.java
index 6ba4ce2d912..b8fa5c35b6f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog270.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog270.java
@@ -1662,7 +1662,7 @@ protected void moveAmbariPropertiesToAmbariConfiguration() throws AmbariExceptio
final HostAndPort hostAndPort = HostAndPort.fromString(propertyValue);
AmbariServerConfigurationKey keyToBesaved = AmbariServerConfigurationKey.SERVER_HOST == key ? AmbariServerConfigurationKey.SERVER_HOST
: AmbariServerConfigurationKey.SECONDARY_SERVER_HOST;
- populateConfigurationToBeMoved(propertiesToBeMoved, oldPropertyName, keyToBesaved, hostAndPort.getHostText());
+ populateConfigurationToBeMoved(propertiesToBeMoved, oldPropertyName, keyToBesaved, hostAndPort.getHost());
keyToBesaved = AmbariServerConfigurationKey.SERVER_HOST == key ? AmbariServerConfigurationKey.SERVER_PORT : AmbariServerConfigurationKey.SECONDARY_SERVER_PORT;
populateConfigurationToBeMoved(propertiesToBeMoved, oldPropertyName, keyToBesaved, String.valueOf(hostAndPort.getPort()));
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/AmbariMetricsHadoopSinkVersionCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/AmbariMetricsHadoopSinkVersionCheckTest.java
index b41ff29ea0d..ef2e4230dbd 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/AmbariMetricsHadoopSinkVersionCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/AmbariMetricsHadoopSinkVersionCheckTest.java
@@ -206,7 +206,7 @@ public void testPerform() throws Exception {
ClusterInformation clusterInformation = new ClusterInformation("c1", false, null, null, null);
UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING,
- m_repositoryVersion, checkProperties);
+ m_repositoryVersion, checkProperties, null);
UpgradeCheckResult check = m_check.perform(request);
Assert.assertEquals(UpgradeCheckStatus.PASS, check.getStatus());
@@ -265,7 +265,7 @@ public void testPerformFail() throws Exception{
ClusterInformation clusterInformation = new ClusterInformation("c1", false, null, null, null);
UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING,
- m_repositoryVersion, checkProperties);
+ m_repositoryVersion, checkProperties, null);
UpgradeCheckResult check = m_check.perform(request);
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/AutoStartDisabledCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/AutoStartDisabledCheckTest.java
index 8f55d5bdea0..9ce6780c562 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/AutoStartDisabledCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/AutoStartDisabledCheckTest.java
@@ -98,7 +98,7 @@ public Clusters get() {
@Test
public void testIsApplicable() throws Exception {
UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING,
- repositoryVersion, m_configMap);
+ repositoryVersion, m_configMap, null);
CheckHelper checkHelper = new CheckHelper();
List applicableChecks = checkHelper.getApplicableChecks(request,
@@ -110,7 +110,7 @@ public void testIsApplicable() throws Exception {
@Test
public void testNoAutoStart() throws Exception {
UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING,
- repositoryVersion, null);
+ repositoryVersion, null, null);
UpgradeCheckResult check = m_check.perform(request);
@@ -121,7 +121,7 @@ public void testNoAutoStart() throws Exception {
@Test
public void testAutoStartFalse() throws Exception {
UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING,
- repositoryVersion, null);
+ repositoryVersion, null, null);
m_configMap.put(AutoStartDisabledCheck.RECOVERY_ENABLED_KEY, "false");
@@ -134,7 +134,7 @@ public void testAutoStartFalse() throws Exception {
@Test
public void testAutoStartTrue() throws Exception {
UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING,
- repositoryVersion, null);
+ repositoryVersion, null, null);
m_configMap.put(AutoStartDisabledCheck.RECOVERY_ENABLED_KEY, "true");
m_configMap.put(AutoStartDisabledCheck.RECOVERY_TYPE_KEY, AutoStartDisabledCheck.RECOVERY_AUTO_START);
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ClusterCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ClusterCheckTest.java
index c0fc8426e48..316d377147c 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ClusterCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ClusterCheckTest.java
@@ -172,7 +172,7 @@ public CheckHelper get() {
ClusterInformation clusterInformation = new ClusterInformation(clusterName, false, null, null, null);
UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING,
- repositoryVersion, null);
+ repositoryVersion, null, null);
// case, where we need at least one service to be present
check.setApplicableServices(oneServiceList);
@@ -249,7 +249,7 @@ public CheckHelper get() {
ClusterInformation clusterInformation = new ClusterInformation(clusterName, false, null, null, null);
UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING,
- repositoryVersion, null);
+ repositoryVersion, null, null);
// since the check is for SERVICE2, it should not match even though its
// installed since the repository is only for SERVICE1
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentExistsInRepoCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentExistsInRepoCheckTest.java
index 2fb327581bc..494fde276cc 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentExistsInRepoCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentExistsInRepoCheckTest.java
@@ -76,7 +76,7 @@ public void before() throws Exception {
expect(cluster.getCurrentStackVersion()).andReturn(sourceStackId).anyTimes();
ClusterInformation clusterInformation = new ClusterInformation("cluster", false, null, null, null);
- request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, repoVersion(), null);
+ request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, repoVersion(), null, null);
}
@Test
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentsInstallationCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentsInstallationCheckTest.java
index 7e0c4f7546e..f029e00608e 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentsInstallationCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentsInstallationCheckTest.java
@@ -311,7 +311,7 @@ public ComponentInfo answer(InvocationOnMock invocation) throws Throwable {
ClusterInformation clusterInformation = new ClusterInformation("cluster", false, null, null, null);
UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING,
- m_repositoryVersion, null);
+ m_repositoryVersion, null, null);
Mockito.when(hcsTezClient.getCurrentState()).thenReturn(State.INSTALLED);
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ConfigurationMergeCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ConfigurationMergeCheckTest.java
index 97d12a0b27b..206bdeaa478 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ConfigurationMergeCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ConfigurationMergeCheckTest.java
@@ -165,7 +165,7 @@ public AmbariMetaInfo get() {
ClusterInformation clusterInformation = new ClusterInformation("cluster", false, null, null, null);
UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING,
- m_repositoryVersion, null);
+ m_repositoryVersion, null, null);
UpgradeCheckResult check = cmc.perform(request);
Assert.assertEquals("Expect no warnings", 0, check.getFailedOn().size());
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/HealthCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/HealthCheckTest.java
index 7a9151a514c..4cfed34caa6 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/HealthCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/HealthCheckTest.java
@@ -82,7 +82,7 @@ public void testWarningWhenNoAlertsExist() throws AmbariException {
when(alertsDAO.findCurrentByCluster(eq(CLUSTER_ID))).thenReturn(Collections.emptyList());
ClusterInformation clusterInformation = new ClusterInformation(CLUSTER_NAME, false, null, null, null);
- UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, null, null);
+ UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, null, null, null);
UpgradeCheckResult result = healthCheck.perform(request);
Assert.assertEquals(UpgradeCheckStatus.PASS, result.getStatus());
@@ -115,7 +115,7 @@ private void expectWarning(AlertState alertState) throws AmbariException {
when(alertsDAO.findCurrentByCluster(eq(CLUSTER_ID))).thenReturn(asList(alertCurrentEntity));
ClusterInformation clusterInformation = new ClusterInformation(CLUSTER_NAME, false, null, null, null);
- UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, null, null);
+ UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, null, null, null);
UpgradeCheckResult result = healthCheck.perform(request);
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostMaintenanceModeCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostMaintenanceModeCheckTest.java
index 7bc28a46927..07cec84f883 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostMaintenanceModeCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostMaintenanceModeCheckTest.java
@@ -77,7 +77,7 @@ public Clusters get() {
Mockito.when(cluster.getHosts()).thenReturn(hosts);
ClusterInformation clusterInformation = new ClusterInformation("cluster", false, null, null, null);
- UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, null, null);
+ UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, null, null, null);
UpgradeCheckResult check = hostMaintenanceModeCheck.perform(request);
Assert.assertEquals(UpgradeCheckStatus.PASS, check.getStatus());
@@ -123,7 +123,7 @@ public Clusters get() {
Mockito.when(cluster.getHosts()).thenReturn(hosts);
ClusterInformation clusterInformation = new ClusterInformation("cluster", false, null, null, null);
- UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, null, null);
+ UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, null, null, null);
UpgradeCheckResult check = hostMaintenanceModeCheck.perform(request);
Assert.assertEquals(UpgradeCheckStatus.PASS, check.getStatus());
@@ -132,7 +132,7 @@ public Clusters get() {
// put a host into MM in order to trigger the warning
Mockito.when(host3.getMaintenanceState(1L)).thenReturn(MaintenanceState.ON);
- request = new UpgradeCheckRequest(clusterInformation, UpgradeType.HOST_ORDERED, null, null);
+ request = new UpgradeCheckRequest(clusterInformation, UpgradeType.HOST_ORDERED, null, null, null);
check = hostMaintenanceModeCheck.perform(request);
Assert.assertEquals(UpgradeCheckStatus.FAIL, check.getStatus());
Assert.assertFalse(check.getFailedDetail().isEmpty());
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsHeartbeatCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsHeartbeatCheckTest.java
index 9ca3ca14018..d98da91be39 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsHeartbeatCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsHeartbeatCheckTest.java
@@ -107,7 +107,7 @@ public Clusters get() {
Mockito.when(cluster.getHosts()).thenReturn(hosts);
ClusterInformation clusterInformation = new ClusterInformation("cluster", false, null, null, null);
- UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, null, null);
+ UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, null, null, null);
UpgradeCheckResult check = hostHeartbeatCheck.perform(request);
Assert.assertEquals(UpgradeCheckStatus.FAIL, check.getStatus());
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheckTest.java
index 5e09487f8fa..54bbbed01b2 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheckTest.java
@@ -127,7 +127,7 @@ public AmbariMetaInfo get() {
ClusterInformation clusterInformation = new ClusterInformation("cluster", false, null, null, null);
UpgradeCheckRequest checkRequest = new UpgradeCheckRequest(clusterInformation,
- UpgradeType.ROLLING, m_repositoryVersion, null);
+ UpgradeType.ROLLING, m_repositoryVersion, null, null);
UpgradeCheckResult result = hostsMasterMaintenanceCheck.perform(checkRequest);
Assert.assertEquals(UpgradeCheckStatus.FAIL, result.getStatus());
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheckTest.java
index a74b2823e37..e7639de9e5f 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheckTest.java
@@ -159,7 +159,7 @@ public CheckHelper get() {
ClusterInformation clusterInformation = new ClusterInformation("cluster", false, null, null, null);
UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING,
- m_repositoryVersion, null);
+ m_repositoryVersion, null, null);
UpgradeCheckResult check = hostsRepositoryVersionCheck.perform(request);
Assert.assertEquals(UpgradeCheckStatus.FAIL, check.getStatus());
@@ -247,7 +247,7 @@ public HostVersionDAO get() {
ClusterInformation clusterInformation = new ClusterInformation("cluster", false, null, null, null);
UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING,
- m_repositoryVersion, null);
+ m_repositoryVersion, null, null);
UpgradeCheckResult check = hostsRepositoryVersionCheck.perform(request);
Assert.assertEquals(UpgradeCheckStatus.PASS, check.getStatus());
@@ -309,7 +309,7 @@ public HostVersionDAO get() {
ClusterInformation clusterInformation = new ClusterInformation("cluster", false, null, null, null);
UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING,
- m_repositoryVersion, null);
+ m_repositoryVersion, null, null);
UpgradeCheckResult check = hostsRepositoryVersionCheck.perform(request);
Assert.assertEquals(UpgradeCheckStatus.PASS, check.getStatus());
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/InstallPackagesCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/InstallPackagesCheckTest.java
index dd024dd87be..1b4927e30c9 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/InstallPackagesCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/InstallPackagesCheckTest.java
@@ -159,7 +159,7 @@ public RepositoryVersionDAO get() {
ClusterInformation clusterInformation = new ClusterInformation("cluster", false, null, null, null);
UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING,
- m_repositoryVersion, null);
+ m_repositoryVersion, null, null);
// Case 1. Initialize with good values
UpgradeCheckResult check = installPackagesCheck.perform(request);
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/KerberosAdminPersistedCredentialCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/KerberosAdminPersistedCredentialCheckTest.java
index 59ecc83fd82..dfcad29d615 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/KerberosAdminPersistedCredentialCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/KerberosAdminPersistedCredentialCheckTest.java
@@ -159,7 +159,7 @@ private UpgradeCheckResult executeCheck(boolean kerberosEnabled, boolean manageI
ClusterInformation clusterInformation = new ClusterInformation(clusterName, false, null, null, null);
UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING,
- repositoryVersion, checkProperties);
+ repositoryVersion, checkProperties, null);
expect(upgradeHelper.suggestUpgradePack(eq(clusterName), anyObject(), anyObject(), eq(Direction.UPGRADE), eq(UpgradeType.ROLLING), anyObject()))
.andReturn(upgradePackWithRegenKeytab()).anyTimes();
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/LZOCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/LZOCheckTest.java
index a39974b6092..bbf1f1c9367 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/LZOCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/LZOCheckTest.java
@@ -97,7 +97,7 @@ public void testPerform() throws Exception {
ClusterInformation clusterInformation = new ClusterInformation("cluster", false, null, null, null);
UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING,
- m_repositoryVersion, null);
+ m_repositoryVersion, null, null);
UpgradeCheckResult result = lZOCheck.perform(request);
Assert.assertEquals(UpgradeCheckStatus.PASS, result.getStatus());
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/MissingOsInRepoVersionCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/MissingOsInRepoVersionCheckTest.java
index b30235f1460..6d3703ee6c7 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/MissingOsInRepoVersionCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/MissingOsInRepoVersionCheckTest.java
@@ -146,7 +146,7 @@ private UpgradeCheckRequest request(RepositoryVersionEntity targetRepo) {
ClusterInformation clusterInformation = new ClusterInformation(CLUSTER_NAME, false, null, null, null);
UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING,
- repositoryVersion, null);
+ repositoryVersion, null, null);
return request;
}
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/PluginChecksLoadedCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/PluginChecksLoadedCheckTest.java
index 980d6c189e8..02143059e00 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/PluginChecksLoadedCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/PluginChecksLoadedCheckTest.java
@@ -69,7 +69,7 @@ public void testPerform() throws Exception {
replayAll();
- UpgradeCheckRequest request = new UpgradeCheckRequest(null, UpgradeType.ROLLING, null, null);
+ UpgradeCheckRequest request = new UpgradeCheckRequest(null, UpgradeType.ROLLING, null, null, null);
UpgradeCheckResult check = m_check.perform(request);
Assert.assertEquals(UpgradeCheckStatus.WARNING, check.getStatus());
@@ -90,7 +90,7 @@ public void testPerformWithSuccess() throws Exception {
new HashSet<>()).atLeastOnce();
replayAll();
- UpgradeCheckRequest request = new UpgradeCheckRequest(null, UpgradeType.ROLLING, null, null);
+ UpgradeCheckRequest request = new UpgradeCheckRequest(null, UpgradeType.ROLLING, null, null, null);
UpgradeCheckResult check = m_check.perform(request);
Assert.assertEquals(UpgradeCheckStatus.PASS, check.getStatus());
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/PreviousUpgradeCompletedTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/PreviousUpgradeCompletedTest.java
index dc550256fc1..64143afadd9 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/PreviousUpgradeCompletedTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/PreviousUpgradeCompletedTest.java
@@ -74,7 +74,7 @@ public void setup() throws Exception {
ClusterInformation clusterInformation = new ClusterInformation(clusterName, false, null, null, null);
checkRequest = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING,
- null, null);
+ null, null, null);
puc.clustersProvider = new Provider() {
@Override
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/RequiredServicesInRepositoryCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/RequiredServicesInRepositoryCheckTest.java
index 24692482721..4b461810349 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/RequiredServicesInRepositoryCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/RequiredServicesInRepositoryCheckTest.java
@@ -122,7 +122,7 @@ public CheckHelper get() {
public void testNoMissingServices() throws Exception {
ClusterInformation clusterInformation = new ClusterInformation(CLUSTER_NAME, false, null, null, null);
UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING,
- m_repositoryVersion, null);
+ m_repositoryVersion, null, null);
UpgradeCheckResult check = m_requiredServicesCheck.perform(request);
Assert.assertEquals(UpgradeCheckStatus.PASS, check.getStatus());
@@ -140,7 +140,7 @@ public void testMissingRequiredService() throws Exception {
ClusterInformation clusterInformation = new ClusterInformation(CLUSTER_NAME, false, null, null, null);
UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING,
- m_repositoryVersion, null);
+ m_repositoryVersion, null, null);
UpgradeCheckResult check = m_requiredServicesCheck.perform(request);
Assert.assertEquals(UpgradeCheckStatus.FAIL, check.getStatus());
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServiceCheckValidityCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServiceCheckValidityCheckTest.java
index 918e1baa44e..a9facc6bfa0 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServiceCheckValidityCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServiceCheckValidityCheckTest.java
@@ -144,7 +144,7 @@ public void testWithNullCommandDetailAtCommand() throws AmbariException {
when(hostRoleCommandDAO.getLatestServiceChecksByRole(any(Long.class))).thenReturn(asList(lastServiceCheckDTO1, lastServiceCheckDTO2));
ClusterInformation clusterInformation = new ClusterInformation(CLUSTER_NAME, false, null, null, null);
- UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, null, null);
+ UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, null, null, null);
try {
UpgradeCheckResult result = serviceCheckValidityCheck.perform(request);
@@ -172,7 +172,7 @@ public void testFailWhenServiceWithOutdatedServiceCheckExists() throws AmbariExc
when(hostRoleCommandDAO.getLatestServiceChecksByRole(any(Long.class))).thenReturn(singletonList(lastServiceCheckDTO));
ClusterInformation clusterInformation = new ClusterInformation(CLUSTER_NAME, false, null, null, null);
- UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, null, null);
+ UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, null, null, null);
UpgradeCheckResult result = serviceCheckValidityCheck.perform(request);
Assert.assertEquals(UpgradeCheckStatus.FAIL, result.getStatus());
@@ -195,7 +195,7 @@ public void testFailWhenServiceWithNoServiceCheckExists() throws AmbariException
when(hostRoleCommandDAO.getLatestServiceChecksByRole(any(Long.class))).thenReturn(Collections.emptyList());
ClusterInformation clusterInformation = new ClusterInformation(CLUSTER_NAME, false, null, null, null);
- UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, null, null);
+ UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, null, null, null);
UpgradeCheckResult result = serviceCheckValidityCheck.perform(request);
Assert.assertEquals(UpgradeCheckStatus.FAIL, result.getStatus());
@@ -220,7 +220,7 @@ public void testFailWhenServiceWithOutdatedServiceCheckExistsRepeated() throws A
when(hostRoleCommandDAO.getLatestServiceChecksByRole(any(Long.class))).thenReturn(asList(lastServiceCheckDTO1, lastServiceCheckDTO2));
ClusterInformation clusterInformation = new ClusterInformation(CLUSTER_NAME, false, null, null, null);
- UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, null, null);
+ UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, null, null, null);
UpgradeCheckResult result = serviceCheckValidityCheck.perform(request);
Assert.assertEquals(UpgradeCheckStatus.FAIL, result.getStatus());
@@ -258,7 +258,7 @@ public void testPassWhenSimilarlyNamedServiceIsOutdated() throws AmbariException
when(hostRoleCommandDAO.getLatestServiceChecksByRole(any(Long.class))).thenReturn(asList(lastServiceCheckDTO1, lastServiceCheckDTO2));
ClusterInformation clusterInformation = new ClusterInformation(CLUSTER_NAME, false, null, null, null);
- UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, null, null);
+ UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, null, null, null);
UpgradeCheckResult result = serviceCheckValidityCheck.perform(request);
Assert.assertEquals(UpgradeCheckStatus.FAIL, result.getStatus()); }
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicePresenceCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicePresenceCheckTest.java
index 6e855a2cd1e..49d659eb863 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicePresenceCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicePresenceCheckTest.java
@@ -78,7 +78,7 @@ public void testPerformPass() throws Exception {
ClusterInformation clusterInformation = new ClusterInformation("cluster", false, null, null, null);
UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING,
- m_repositoryVersion, checkProperties);
+ m_repositoryVersion, checkProperties, null);
UpgradeCheckResult result = m_check.perform(request);
Assert.assertEquals(UpgradeCheckStatus.PASS, result.getStatus());
@@ -99,7 +99,7 @@ public void testPerformHasNoUpgradeSupportServices() throws Exception {
ClusterInformation clusterInformation = new ClusterInformation("cluster", false, null, null, null);
UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING,
- m_repositoryVersion, checkProperties);
+ m_repositoryVersion, checkProperties, null);
UpgradeCheckResult result = m_check.perform(request);
Assert.assertEquals(UpgradeCheckStatus.FAIL, result.getStatus());
@@ -122,7 +122,7 @@ public void testPerformHasReplacedServices() throws Exception {
ClusterInformation clusterInformation = new ClusterInformation("cluster", false, null, null, null);
UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING,
- m_repositoryVersion, checkProperties);
+ m_repositoryVersion, checkProperties, null);
UpgradeCheckResult result = m_check.perform(request);
Assert.assertEquals(UpgradeCheckStatus.FAIL, result.getStatus());
@@ -144,7 +144,7 @@ public void testPerformHasRemovedServices() throws Exception {
ClusterInformation clusterInformation = new ClusterInformation("cluster", false, null, null, null);
UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING,
- m_repositoryVersion, checkProperties);
+ m_repositoryVersion, checkProperties, null);
UpgradeCheckResult result = m_check.perform(request);
Assert.assertEquals(UpgradeCheckStatus.FAIL, result.getStatus());
@@ -169,7 +169,7 @@ public void testPerformMixOne() throws Exception {
ClusterInformation clusterInformation = new ClusterInformation("cluster", false, null, null, null);
UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING,
- m_repositoryVersion, checkProperties);
+ m_repositoryVersion, checkProperties, null);
UpgradeCheckResult result = m_check.perform(request);
Assert.assertEquals(UpgradeCheckStatus.FAIL, result.getStatus());
@@ -192,7 +192,7 @@ public void testPerformMixTwo() throws Exception {
ClusterInformation clusterInformation = new ClusterInformation("cluster", false, null, null, null);
UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING,
- m_repositoryVersion, checkProperties);
+ m_repositoryVersion, checkProperties, null);
UpgradeCheckResult result = m_check.perform(request);
Assert.assertEquals(UpgradeCheckStatus.FAIL, result.getStatus());
@@ -218,7 +218,7 @@ public void testPerformMixThree() throws Exception {
ClusterInformation clusterInformation = new ClusterInformation("cluster", false, null, null, null);
UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING,
- m_repositoryVersion, checkProperties);
+ m_repositoryVersion, checkProperties, null);
UpgradeCheckResult result = m_check.perform(request);
Assert.assertEquals(UpgradeCheckStatus.FAIL, result.getStatus());
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheckTest.java
index 3f27ce8cd93..97012d9006e 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheckTest.java
@@ -138,7 +138,7 @@ public CheckHelper get() {
ClusterInformation clusterInformation = new ClusterInformation("cluster", false, null, null, null);
UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING,
- m_repositoryVersion, null);
+ m_repositoryVersion, null, null);
UpgradeCheckResult check = servicesMaintenanceModeCheck.perform(request);
Assert.assertEquals(UpgradeCheckStatus.PASS, check.getStatus());
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesUpCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesUpCheckTest.java
index 967780e5f18..bb3dc6be230 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesUpCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesUpCheckTest.java
@@ -308,7 +308,7 @@ public ComponentInfo answer(InvocationOnMock invocation) throws Throwable {
ClusterInformation clusterInformation = new ClusterInformation("cluster", false, null, null, null);
UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING,
- m_repositoryVersion, null);
+ m_repositoryVersion, null, null);
UpgradeCheckResult check = servicesUpCheck.perform(request);
Assert.assertEquals(UpgradeCheckStatus.PASS, check.getStatus());
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/UpgradeTypeQualificationTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/UpgradeTypeQualificationTest.java
index e5c7a025793..66b40b280b4 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/UpgradeTypeQualificationTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/UpgradeTypeQualificationTest.java
@@ -44,8 +44,8 @@ public class UpgradeTypeQualificationTest {
*/
@Test
public void testRequired() throws Exception {
- UpgradeCheckRequest rolling = new UpgradeCheckRequest(null, UpgradeType.ROLLING, null, null);
- UpgradeCheckRequest express = new UpgradeCheckRequest(null, UpgradeType.NON_ROLLING, null, null);
+ UpgradeCheckRequest rolling = new UpgradeCheckRequest(null, UpgradeType.ROLLING, null, null, null);
+ UpgradeCheckRequest express = new UpgradeCheckRequest(null, UpgradeType.NON_ROLLING, null, null, null);
UpgradeTypeQualification rollingQualification = new UpgradeTypeQualification(RollingTestCheckImpl.class);
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/VersionMismatchCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/VersionMismatchCheckTest.java
index 147f422c148..81fdc17c45f 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/VersionMismatchCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/VersionMismatchCheckTest.java
@@ -86,7 +86,7 @@ public void testWarningWhenHostWithVersionMismatchExists() throws Exception {
ClusterInformation clusterInformation = new ClusterInformation(CLUSTER_NAME, false, null, null, null);
UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING,
- null, null);
+ null, null, null);
UpgradeCheckResult check = versionMismatchCheck.perform(request);
Assert.assertEquals(UpgradeCheckStatus.WARNING, check.getStatus());
@@ -98,7 +98,7 @@ public void testWarningWhenHostWithVersionMismatchDoesNotExist() throws Exceptio
ClusterInformation clusterInformation = new ClusterInformation(CLUSTER_NAME, false, null, null, null);
UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING,
- null, null);
+ null, null, null);
UpgradeCheckResult check = versionMismatchCheck.perform(request);
Assert.assertEquals(UpgradeCheckStatus.PASS, check.getStatus());
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/PreUpgradeCheckResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/PreUpgradeCheckResourceProviderTest.java
index 2e0c5d68d88..0b020056dc0 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/PreUpgradeCheckResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/PreUpgradeCheckResourceProviderTest.java
@@ -23,6 +23,8 @@
import static org.junit.Assert.assertNotNull;
import java.io.File;
+import java.net.URL;
+import java.net.URLClassLoader;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -106,6 +108,15 @@
import org.easymock.EasyMockSupport;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Matchers;
+import org.powermock.api.easymock.PowerMock;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.reflections.Configuration;
+import org.reflections.Reflections;
+import org.reflections.util.ConfigurationBuilder;
import org.springframework.security.crypto.password.PasswordEncoder;
import com.google.common.collect.Lists;
@@ -120,6 +131,8 @@
/**
* PreUpgradeCheckResourceProvider tests.
*/
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ UpgradeCheckRegistry.class })
public class PreUpgradeCheckResourceProviderTest extends EasyMockSupport {
private static final String TEST_SERVICE_CHECK_CLASS_NAME = "org.apache.ambari.server.sample.checks.SampleServiceCheck";
@@ -214,13 +227,25 @@ public void testGetResources() throws Exception{
String checks = ClassLoader.getSystemClassLoader().getResource("checks").getPath();
expect(serviceInfo.getChecksFolder()).andReturn(new File(checks));
- ClassLoader classLoader = createNiceMock(ClassLoader.class);
+ URL url = new URL("file://foo");
+ URLClassLoader classLoader = createNiceMock(URLClassLoader.class);
+ expect(classLoader.getURLs()).andReturn(new URL[] { url }).once();
+
StackInfo stackInfo = createNiceMock(StackInfo.class);
expect(ambariMetaInfo.getStack(targetStackId)).andReturn(stackInfo).atLeastOnce();
expect(stackInfo.getLibraryClassLoader()).andReturn(classLoader).atLeastOnce();
expect(stackInfo.getLibraryInstance(EasyMock.anyObject(), EasyMock.eq(TEST_SERVICE_CHECK_CLASS_NAME)))
.andReturn(new SampleServiceCheck()).atLeastOnce();
+ // mock out plugin check loading
+ Reflections reflectionsMock = createNiceMock(Reflections.class);
+
+ PowerMockito.whenNew(Reflections.class).withParameterTypes(
+ Configuration.class).withArguments(Matchers.any(ConfigurationBuilder.class)).thenReturn(
+ reflectionsMock);
+
+ PowerMock.replay(Reflections.class);
+
// replay
replayAll();
@@ -267,6 +292,8 @@ public void testGetResources() throws Exception{
Assert.assertEquals(CLUSTER_NAME, clusterName);
UpgradeType upgradeType = (UpgradeType) customUpgradeCheck.getPropertyValue(PreUpgradeCheckResourceProvider.UPGRADE_CHECK_UPGRADE_TYPE_PROPERTY_ID);
Assert.assertEquals(UpgradeType.NON_ROLLING, upgradeType);
+
+ PowerMock.verifyAll();
}
/**
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/PluginUpgradeServerActionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/PluginUpgradeServerActionTest.java
index 6e4b17b25b4..eeb818cefd3 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/PluginUpgradeServerActionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/PluginUpgradeServerActionTest.java
@@ -21,6 +21,7 @@
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.expectLastCall;
+import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -82,7 +83,7 @@ public class PluginUpgradeServerActionTest extends EasyMockSupport {
private final UpgradeContext m_mockUpgradeContext = createNiceMock(UpgradeContext.class);
private final UpgradePack m_mockUpgradePack = createNiceMock(UpgradePack.class);
- private final ClassLoader m_mockClassLoader = createNiceMock(ClassLoader.class);
+ private final URLClassLoader m_mockClassLoader = createNiceMock(URLClassLoader.class);
private final AmbariMetaInfo m_mockMetaInfo = createNiceMock(AmbariMetaInfo.class);
private final AmbariManagementController m_mockController = createNiceMock(AmbariManagementController.class);
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/CheckHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/CheckHelperTest.java
index d4d85859f26..bc55def2d41 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/CheckHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/CheckHelperTest.java
@@ -121,7 +121,7 @@ public void testPreUpgradeCheck() throws Exception {
updateChecksRegistry.add(m_mockCheck);
ClusterInformation clusterInformation = new ClusterInformation("cluster", false, null, null, null);
- UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, m_repositoryVersion, null);
+ UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, m_repositoryVersion, null, null);
helper.performChecks(request, updateChecksRegistry, configuration);
@@ -154,13 +154,13 @@ public void testPreUpgradeCheckNotApplicable() throws Exception {
ClusterInformation clusterInformation = new ClusterInformation("cluster", false, null, null, null);
UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation,
- UpgradeType.NON_ROLLING, m_repositoryVersion, null);
+ UpgradeType.NON_ROLLING, m_repositoryVersion, null, null);
helper.performChecks(request, updateChecksRegistry, configuration);
Assert.assertEquals(null, request.getResult(m_mockUpgradeCheckDescription));
- request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, m_repositoryVersion, null);
+ request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, m_repositoryVersion, null, null);
}
/**
@@ -183,7 +183,7 @@ public void testPreUpgradeCheckThrowsException() throws Exception {
Mockito.when(m_mockPerform.toString()).thenThrow(new RuntimeException());
ClusterInformation clusterInformation = new ClusterInformation("cluster", false, null, null, null);
- UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, m_repositoryVersion, null);
+ UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, m_repositoryVersion, null, null);
helper.performChecks(request, updateChecksRegistry, configuration);
@@ -210,7 +210,7 @@ public void testPreUpgradeCheckBypassesFailure() throws Exception {
Mockito.when(m_mockPerform.toString()).thenThrow(new RuntimeException());
ClusterInformation clusterInformation = new ClusterInformation("cluster", false, null, null, null);
- UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, m_repositoryVersion, null);
+ UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, m_repositoryVersion, null, null);
helper.performChecks(request, updateChecksRegistry, configuration);
@@ -253,7 +253,7 @@ public AmbariMetaInfo get() {
Mockito.when(m_mockPerform.toString()).thenThrow(new RuntimeException());
ClusterInformation clusterInformation = new ClusterInformation("cluster", false, null, null, null);
- UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, m_repositoryVersion, null);
+ UpgradeCheckRequest request = new UpgradeCheckRequest(clusterInformation, UpgradeType.ROLLING, m_repositoryVersion, null, null);
helper.performChecks(request, updateChecksRegistry, configuration);