You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by tb...@apache.org on 2013/03/22 20:18:57 UTC
svn commit: r1459936 - in /incubator/ambari/trunk: ./
ambari-server/src/main/java/org/apache/ambari/server/api/handlers/
ambari-server/src/main/java/org/apache/ambari/server/api/services/parsers/
ambari-server/src/main/java/org/apache/ambari/server/con...
Author: tbeerbower
Date: Fri Mar 22 19:18:57 2013
New Revision: 1459936
URL: http://svn.apache.org/r1459936
Log:
AMBARI-1686 - Implement Test IvoryService to functional test mirroring API
Added:
incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TestIvoryProviderModule.java
Modified:
incubator/ambari/trunk/CHANGES.txt
incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/api/handlers/QueryCreateHandler.java
incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/api/services/parsers/JsonRequestBodyParser.java
incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/FeedResourceProvider.java
incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TargetClusterResourceProvider.java
incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory/Cluster.java
incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory/Feed.java
incubator/ambari/trunk/ambari-server/src/main/resources/key_properties.json
incubator/ambari/trunk/ambari-server/src/main/resources/properties.json
incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/api/handlers/QueryCreateHandlerTest.java
incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/api/services/parsers/JsonRequestBodyParserTest.java
incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/FeedResourceProviderTest.java
incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TargetClusterResourceProviderTest.java
incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TestIvoryService.java
incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/ivory/ClusterTest.java
incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/ivory/FeedTest.java
Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1459936&r1=1459935&r2=1459936&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Fri Mar 22 19:18:57 2013
@@ -145,6 +145,9 @@ Trunk (unreleased changes):
IMPROVEMENTS
+ AMBARI-1686. Implement Test IvoryService to functional test mirroring API.
+ (tbeerbower)
+
AMBARI-1672. Security Wizard - integrate with cluster-level config API. (jaimin)
AMBARI-1669. Security Wizard UI tweaks. (jaimin)
Modified: incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/api/handlers/QueryCreateHandler.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/api/handlers/QueryCreateHandler.java?rev=1459936&r1=1459935&r2=1459936&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/api/handlers/QueryCreateHandler.java (original)
+++ incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/api/handlers/QueryCreateHandler.java Fri Mar 22 19:18:57 2013
@@ -107,16 +107,21 @@ public class QueryCreateHandler extends
Object keyVal = r.getPropertyValue(resourceKeyProperty);
for (NamedPropertySet namedProps : setRequestProps) {
- Map<String, Object> mapResourceProps = new HashMap<String, Object>(namedProps.getProperties());
- Resource.Type createType = getCreateType(resource, namedProps.getName());
- mapResourceProps.put(controller.getSchema(createType).
- getKeyPropertyId(resource.getResourceDefinition().getType()), keyVal);
- Set<Map<String, Object>> setCreateProps = mapProps.get(createType);
- if (setCreateProps == null) {
- setCreateProps = new HashSet<Map<String, Object>>();
- mapProps.put(createType, setCreateProps);
+ for (Map.Entry<String, Object> entry : namedProps.getProperties().entrySet()) {
+ Set<Map<String, Object>> set = (Set<Map<String, Object>>) entry.getValue();
+ for (Map<String, Object> map : set) {
+ Map<String, Object> mapResourceProps = new HashMap<String, Object>(map);
+ Resource.Type createType = getCreateType(resource, entry.getKey());
+ mapResourceProps.put(controller.getSchema(createType).
+ getKeyPropertyId(resource.getResourceDefinition().getType()), keyVal);
+ Set<Map<String, Object>> setCreateProps = mapProps.get(createType);
+ if (setCreateProps == null) {
+ setCreateProps = new HashSet<Map<String, Object>>();
+ mapProps.put(createType, setCreateProps);
+ }
+ setCreateProps.add(mapResourceProps);
+ }
}
- setCreateProps.add(mapResourceProps);
}
}
return mapProps;
Modified: incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/api/services/parsers/JsonRequestBodyParser.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/api/services/parsers/JsonRequestBodyParser.java?rev=1459936&r1=1459935&r2=1459936&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/api/services/parsers/JsonRequestBodyParser.java (original)
+++ incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/api/services/parsers/JsonRequestBodyParser.java Fri Mar 22 19:18:57 2013
@@ -83,12 +83,15 @@ public class JsonRequestBodyParser imple
JsonNode child = node.get(name);
if (child.isArray()) {
//array
- Iterator<JsonNode> arrayIter = child.getElements();
+ Iterator<JsonNode> arrayIter = child.getElements();
+ Set<Map<String, Object>> arraySet = new HashSet<Map<String, Object>>();
+
while (arrayIter.hasNext()) {
NamedPropertySet arrayPropertySet = new NamedPropertySet(name, new HashMap<String, Object>());
processNode(arrayIter.next(), "", arrayPropertySet, body);
- body.addPropertySet(arrayPropertySet);
+ arraySet.add(arrayPropertySet.getProperties());
}
+ propertySet.getProperties().put(PropertyHelper.getPropertyId(path, name), arraySet);
} else if (child.isContainerNode()) {
// object
if (name.equals(BODY_TITLE)) {
Modified: incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/FeedResourceProvider.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/FeedResourceProvider.java?rev=1459936&r1=1459935&r2=1459936&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/FeedResourceProvider.java (original)
+++ incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/FeedResourceProvider.java Fri Mar 22 19:18:57 2013
@@ -46,12 +46,21 @@ public class FeedResourceProvider extend
// ----- Property ID constants ---------------------------------------------
- protected static final String FEED_NAME_PROPERTY_ID = PropertyHelper.getPropertyId("Feed", "name");
- protected static final String FEED_DESCRIPTION_PROPERTY_ID = PropertyHelper.getPropertyId("Feed", "description");
- protected static final String FEED_STATUS_PROPERTY_ID = PropertyHelper.getPropertyId("Feed", "status");
- protected static final String FEED_SCHEDULE_PROPERTY_ID = PropertyHelper.getPropertyId("Feed", "schedule");
- protected static final String FEED_SOURCE_CLUSTER_NAME_PROPERTY_ID = PropertyHelper.getPropertyId("Feed", "sourceClusterName");
- protected static final String FEED_TARGET_CLUSTER_NAME_PROPERTY_ID = PropertyHelper.getPropertyId("Feed", "targetClusterName");
+ protected static final String FEED_NAME_PROPERTY_ID = PropertyHelper.getPropertyId("Feed", "name");
+ protected static final String FEED_DESCRIPTION_PROPERTY_ID = PropertyHelper.getPropertyId("Feed", "description");
+ protected static final String FEED_STATUS_PROPERTY_ID = PropertyHelper.getPropertyId("Feed", "status");
+ protected static final String FEED_SCHEDULE_PROPERTY_ID = PropertyHelper.getPropertyId("Feed", "frequency");
+ protected static final String FEED_SOURCE_CLUSTER_NAME_PROPERTY_ID = PropertyHelper.getPropertyId("Feed/sourceCluster", "name");
+ protected static final String FEED_SOURCE_CLUSTER_START_PROPERTY_ID = PropertyHelper.getPropertyId("Feed/sourceCluster/validity", "start");
+ protected static final String FEED_SOURCE_CLUSTER_END_PROPERTY_ID = PropertyHelper.getPropertyId("Feed/sourceCluster/validity", "end");
+ protected static final String FEED_SOURCE_CLUSTER_LIMIT_PROPERTY_ID = PropertyHelper.getPropertyId("Feed/sourceCluster/retention", "limit");
+ protected static final String FEED_SOURCE_CLUSTER_ACTION_PROPERTY_ID = PropertyHelper.getPropertyId("Feed/sourceCluster/retention", "action");
+ protected static final String FEED_TARGET_CLUSTER_NAME_PROPERTY_ID = PropertyHelper.getPropertyId("Feed/targetCluster", "name");
+ protected static final String FEED_TARGET_CLUSTER_START_PROPERTY_ID = PropertyHelper.getPropertyId("Feed/targetCluster/validity", "start");
+ protected static final String FEED_TARGET_CLUSTER_END_PROPERTY_ID = PropertyHelper.getPropertyId("Feed/targetCluster/validity", "end");
+ protected static final String FEED_TARGET_CLUSTER_LIMIT_PROPERTY_ID = PropertyHelper.getPropertyId("Feed/targetCluster/retention", "limit");
+ protected static final String FEED_TARGET_CLUSTER_ACTION_PROPERTY_ID = PropertyHelper.getPropertyId("Feed/targetCluster/retention", "action");
+ protected static final String FEED_PROPERTIES_PROPERTY_ID = PropertyHelper.getPropertyId("Feed", "properties");
private static Set<String> pkPropertyIds =
new HashSet<String>(Arrays.asList(new String[]{
@@ -109,8 +118,26 @@ public class FeedResourceProvider extend
feed.getSchedule(), requestedIds);
setResourceProperty(resource, FEED_SOURCE_CLUSTER_NAME_PROPERTY_ID,
feed.getSourceClusterName(), requestedIds);
+ setResourceProperty(resource, FEED_SOURCE_CLUSTER_START_PROPERTY_ID,
+ feed.getSourceClusterStart(), requestedIds);
+ setResourceProperty(resource, FEED_SOURCE_CLUSTER_END_PROPERTY_ID,
+ feed.getSourceClusterEnd(), requestedIds);
+ setResourceProperty(resource, FEED_SOURCE_CLUSTER_LIMIT_PROPERTY_ID,
+ feed.getSourceClusterLimit(), requestedIds);
+ setResourceProperty(resource, FEED_SOURCE_CLUSTER_ACTION_PROPERTY_ID,
+ feed.getSourceClusterAction(), requestedIds);
setResourceProperty(resource, FEED_TARGET_CLUSTER_NAME_PROPERTY_ID,
feed.getTargetClusterName(), requestedIds);
+ setResourceProperty(resource, FEED_TARGET_CLUSTER_START_PROPERTY_ID,
+ feed.getTargetClusterStart(), requestedIds);
+ setResourceProperty(resource, FEED_TARGET_CLUSTER_END_PROPERTY_ID,
+ feed.getTargetClusterEnd(), requestedIds);
+ setResourceProperty(resource, FEED_TARGET_CLUSTER_LIMIT_PROPERTY_ID,
+ feed.getTargetClusterLimit(), requestedIds);
+ setResourceProperty(resource, FEED_TARGET_CLUSTER_ACTION_PROPERTY_ID,
+ feed.getTargetClusterAction(), requestedIds);
+ setResourceProperty(resource, FEED_PROPERTIES_PROPERTY_ID,
+ feed.getProperties(), requestedIds);
if (predicate == null || predicate.evaluate(resource)) {
resources.add(resource);
@@ -189,13 +216,31 @@ public class FeedResourceProvider extend
* @return a new feed
*/
protected static Feed getFeed(String feedName, Map<String, Object> propertyMap) {
+ Map<String, String> properties = new HashMap<String, String>();
+ for ( Map.Entry<String, Object> entry : propertyMap.entrySet()) {
+ String property = entry.getKey();
+ String category = PropertyHelper.getPropertyCategory(property);
+ if (category.equals(FEED_PROPERTIES_PROPERTY_ID)) {
+ properties.put(PropertyHelper.getPropertyName(property), (String) entry.getValue());
+ }
+ }
+
return new Feed(
feedName,
(String) propertyMap.get(FEED_DESCRIPTION_PROPERTY_ID),
(String) propertyMap.get(FEED_STATUS_PROPERTY_ID),
(String) propertyMap.get(FEED_SCHEDULE_PROPERTY_ID),
(String) propertyMap.get(FEED_SOURCE_CLUSTER_NAME_PROPERTY_ID),
- (String) propertyMap.get(FEED_TARGET_CLUSTER_NAME_PROPERTY_ID));
+ (String) propertyMap.get(FEED_SOURCE_CLUSTER_START_PROPERTY_ID),
+ (String) propertyMap.get(FEED_SOURCE_CLUSTER_END_PROPERTY_ID),
+ (String) propertyMap.get(FEED_SOURCE_CLUSTER_LIMIT_PROPERTY_ID),
+ (String) propertyMap.get(FEED_SOURCE_CLUSTER_ACTION_PROPERTY_ID),
+ (String) propertyMap.get(FEED_TARGET_CLUSTER_NAME_PROPERTY_ID),
+ (String) propertyMap.get(FEED_TARGET_CLUSTER_START_PROPERTY_ID),
+ (String) propertyMap.get(FEED_TARGET_CLUSTER_END_PROPERTY_ID),
+ (String) propertyMap.get(FEED_TARGET_CLUSTER_LIMIT_PROPERTY_ID),
+ (String) propertyMap.get(FEED_TARGET_CLUSTER_ACTION_PROPERTY_ID),
+ properties);
}
/**
@@ -215,7 +260,16 @@ public class FeedResourceProvider extend
updateMap.put(FEED_SCHEDULE_PROPERTY_ID, resource.getPropertyValue(FEED_SCHEDULE_PROPERTY_ID));
updateMap.put(FEED_STATUS_PROPERTY_ID, resource.getPropertyValue(FEED_STATUS_PROPERTY_ID));
updateMap.put(FEED_SOURCE_CLUSTER_NAME_PROPERTY_ID, resource.getPropertyValue(FEED_SOURCE_CLUSTER_NAME_PROPERTY_ID));
+ updateMap.put(FEED_SOURCE_CLUSTER_START_PROPERTY_ID, resource.getPropertyValue(FEED_SOURCE_CLUSTER_START_PROPERTY_ID));
+ updateMap.put(FEED_SOURCE_CLUSTER_END_PROPERTY_ID, resource.getPropertyValue(FEED_SOURCE_CLUSTER_END_PROPERTY_ID));
+ updateMap.put(FEED_SOURCE_CLUSTER_LIMIT_PROPERTY_ID, resource.getPropertyValue(FEED_SOURCE_CLUSTER_LIMIT_PROPERTY_ID));
+ updateMap.put(FEED_SOURCE_CLUSTER_ACTION_PROPERTY_ID, resource.getPropertyValue(FEED_SOURCE_CLUSTER_ACTION_PROPERTY_ID));
updateMap.put(FEED_TARGET_CLUSTER_NAME_PROPERTY_ID, resource.getPropertyValue(FEED_TARGET_CLUSTER_NAME_PROPERTY_ID));
+ updateMap.put(FEED_TARGET_CLUSTER_START_PROPERTY_ID, resource.getPropertyValue(FEED_TARGET_CLUSTER_START_PROPERTY_ID));
+ updateMap.put(FEED_TARGET_CLUSTER_END_PROPERTY_ID, resource.getPropertyValue(FEED_TARGET_CLUSTER_END_PROPERTY_ID));
+ updateMap.put(FEED_TARGET_CLUSTER_LIMIT_PROPERTY_ID, resource.getPropertyValue(FEED_TARGET_CLUSTER_LIMIT_PROPERTY_ID));
+ updateMap.put(FEED_TARGET_CLUSTER_ACTION_PROPERTY_ID, resource.getPropertyValue(FEED_TARGET_CLUSTER_ACTION_PROPERTY_ID));
+ updateMap.put(FEED_PROPERTIES_PROPERTY_ID, resource.getPropertyValue(FEED_PROPERTIES_PROPERTY_ID));
updateMap.putAll(propertyMap);
return updateMap;
Modified: incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TargetClusterResourceProvider.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TargetClusterResourceProvider.java?rev=1459936&r1=1459935&r2=1459936&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TargetClusterResourceProvider.java (original)
+++ incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TargetClusterResourceProvider.java Fri Mar 22 19:18:57 2013
@@ -32,6 +32,7 @@ import org.apache.ambari.server.controll
import org.apache.ambari.server.controller.utilities.PropertyHelper;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -69,7 +70,8 @@ public class TargetClusterResourceProvid
}
@Override
- public RequestStatus createResources(Request request) throws SystemException, UnsupportedPropertyException, ResourceAlreadyExistsException, NoSuchParentResourceException {
+ public RequestStatus createResources(Request request) throws SystemException, UnsupportedPropertyException,
+ ResourceAlreadyExistsException, NoSuchParentResourceException {
IvoryService service = getService();
Set<Map<String, Object>> propertiesSet = request.getProperties();
@@ -81,7 +83,8 @@ public class TargetClusterResourceProvid
}
@Override
- public Set<Resource> getResources(Request request, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
+ public Set<Resource> getResources(Request request, Predicate predicate) throws SystemException,
+ UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
IvoryService service = getService();
List<String> clusterNames = service.getClusterNames();
Set<String> requestedIds = getRequestPropertyIds(request, predicate);
@@ -111,7 +114,8 @@ public class TargetClusterResourceProvid
}
@Override
- public RequestStatus updateResources(Request request, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
+ public RequestStatus updateResources(Request request, Predicate predicate) throws SystemException,
+ UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
IvoryService service = getService();
Iterator<Map<String,Object>> iterator = request.getProperties().iterator();
@@ -131,7 +135,8 @@ public class TargetClusterResourceProvid
}
@Override
- public RequestStatus deleteResources(Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
+ public RequestStatus deleteResources(Predicate predicate) throws SystemException, UnsupportedPropertyException,
+ NoSuchResourceException, NoSuchParentResourceException {
IvoryService service = getService();
// get all the clusters that pass the predicate check
@@ -149,14 +154,42 @@ public class TargetClusterResourceProvid
return pkPropertyIds;
}
+
// ----- helper methods -----------------------------------------------------
protected static Cluster getCluster(String clusterName, Map<String, Object> propertyMap) {
+
+ Map<String, String> properties = new HashMap<String, String>();
+ for ( Map.Entry<String, Object> entry : propertyMap.entrySet()) {
+ String property = entry.getKey();
+ String category = PropertyHelper.getPropertyCategory(property);
+ if (category.equals(CLUSTER_PROPERTIES_PROPERTY_ID)) {
+ properties.put(PropertyHelper.getPropertyName(property), (String) entry.getValue());
+ }
+ }
+
return new Cluster(
clusterName,
(String) propertyMap.get(CLUSTER_COLO_PROPERTY_ID),
- (Set<String>) propertyMap.get(CLUSTER_INTERFACES_PROPERTY_ID),
- (Set<String>) propertyMap.get(CLUSTER_LOCATIONS_PROPERTY_ID),
- (Map<String, String>) propertyMap.get(CLUSTER_PROPERTIES_PROPERTY_ID));
+ getInterfaces((Set<Map<String, Object>>) propertyMap.get(CLUSTER_INTERFACES_PROPERTY_ID)),
+ getLocations((Set<Map<String, Object>>) propertyMap.get(CLUSTER_LOCATIONS_PROPERTY_ID)),
+ properties);
+ }
+
+ protected static Set<Cluster.Interface> getInterfaces(Set<Map<String, Object>> maps) {
+ Set<Cluster.Interface> interfaces = new HashSet<Cluster.Interface>();
+ for (Map<String, Object> map : maps) {
+ interfaces.add(new Cluster.Interface((String) map.get("type"), (String) map.get("endpoint"), (String) map.get("version")));
+ }
+ return interfaces;
+ }
+
+ protected static Set<Cluster.Location> getLocations(Set<Map<String, Object>> maps) {
+ Set<Cluster.Location> locations = new HashSet<Cluster.Location>();
+ for (Map<String, Object> map : maps) {
+ locations.add(new Cluster.Location((String) map.get("name"), (String) map.get("path")));
+ }
+ return locations;
}
+
}
Modified: incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory/Cluster.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory/Cluster.java?rev=1459936&r1=1459935&r2=1459936&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory/Cluster.java (original)
+++ incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory/Cluster.java Fri Mar 22 19:18:57 2013
@@ -27,8 +27,8 @@ public class Cluster {
private final String name;
private final String colo;
- private final Set<String> interfaces;
- private final Set<String> locations;
+ private final Set<Interface> interfaces;
+ private final Set<Location> locations;
private final Map<String, String> properties;
/**
@@ -40,7 +40,7 @@ public class Cluster {
* @param locations the locations
* @param properties the properties
*/
- public Cluster(String name, String colo, Set<String> interfaces, Set<String> locations, Map<String, String> properties) {
+ public Cluster(String name, String colo, Set<Interface> interfaces, Set<Location> locations, Map<String, String> properties) {
this.name = name;
this.colo = colo;
this.interfaces = interfaces;
@@ -71,7 +71,7 @@ public class Cluster {
*
* @return the interfaces
*/
- public Set<String> getInterfaces() {
+ public Set<Interface> getInterfaces() {
return interfaces;
}
@@ -80,7 +80,7 @@ public class Cluster {
*
* @return the locations
*/
- public Set<String> getLocations() {
+ public Set<Location> getLocations() {
return locations;
}
@@ -116,4 +116,133 @@ public class Cluster {
result = 31 * result + (properties != null ? properties.hashCode() : 0);
return result;
}
+
+ // ----- inner classes -----------------------------------------------------
+
+ /**
+ * Cluster interface.
+ */
+ public static class Interface {
+
+ private final String type;
+ private final String endpoint;
+ private final String version;
+
+ /**
+ * Construct an interface.
+ *
+ * @param type the type
+ * @param endpoint the endpoint
+ * @param version the version
+ */
+ public Interface(String type, String endpoint, String version) {
+ this.type = type;
+ this.endpoint = endpoint;
+ this.version = version;
+ }
+
+ /**
+ * Get the type.
+ *
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Get the endpoint.
+ *
+ * @return the endpoint
+ */
+ public String getEndpoint() {
+ return endpoint;
+ }
+
+ /**
+ * Get the version.
+ *
+ * @return the version
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ Interface that = (Interface) o;
+
+ return !(endpoint != null ? !endpoint.equals(that.endpoint) : that.endpoint != null) &&
+ !(type != null ? !type.equals(that.type) : that.type != null) &&
+ !(version != null ? !version.equals(that.version) : that.version != null);
+
+ }
+
+ @Override
+ public int hashCode() {
+ int result = type != null ? type.hashCode() : 0;
+ result = 31 * result + (endpoint != null ? endpoint.hashCode() : 0);
+ result = 31 * result + (version != null ? version.hashCode() : 0);
+ return result;
+ }
+ }
+
+ /**
+ * Cluster location
+ */
+ public static class Location {
+ private final String name;
+ private final String path;
+
+ /**
+ * Construct a location.
+ *
+ * @param name the name
+ * @param path the path
+ */
+ public Location(String name, String path) {
+ this.name = name;
+ this.path = path;
+ }
+
+ /**
+ * Get the name.
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Get the path.
+ *
+ * @return the path
+ */
+ public String getPath() {
+ return path;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ Location location = (Location) o;
+
+ return !(name != null ? !name.equals(location.name) : location.name != null) &&
+ !(path != null ? !path.equals(location.path) : location.path != null);
+
+ }
+
+ @Override
+ public int hashCode() {
+ int result = name != null ? name.hashCode() : 0;
+ result = 31 * result + (path != null ? path.hashCode() : 0);
+ return result;
+ }
+ }
}
Modified: incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory/Feed.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory/Feed.java?rev=1459936&r1=1459935&r2=1459936&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory/Feed.java (original)
+++ incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory/Feed.java Fri Mar 22 19:18:57 2013
@@ -17,6 +17,8 @@
*/
package org.apache.ambari.server.controller.ivory;
+import java.util.Map;
+
/**
* Ivory feed.
*/
@@ -27,25 +29,58 @@ public class Feed {
private final String status;
private final String schedule;
private final String sourceClusterName;
+ private final String sourceClusterStart;
+ private final String sourceClusterEnd;
+ private final String sourceClusterLimit;
+ private final String sourceClusterAction;
private final String targetClusterName;
+ private final String targetClusterStart;
+ private final String targetClusterEnd;
+ private final String targetClusterLimit;
+ private final String targetClusterAction;
+ private final Map<String, String> properties;
/**
* Construct a feed.
*
- * @param name the feed name
- * @param description the description
- * @param status the status
- * @param schedule the schedule
- * @param sourceClusterName the source cluster name
- * @param targetClusterName the target cluster name
- */
- public Feed(String name, String description, String status, String schedule, String sourceClusterName, String targetClusterName) {
+ * @param name the feed name
+ * @param description the description
+ * @param status the status
+ * @param schedule the schedule
+ * @param sourceClusterName the source cluster name
+ * @param sourceClusterStart the source cluster validity start time
+ * @param sourceClusterEnd the source cluster validity end time
+ * @param sourceClusterLimit the source cluster retention limit
+ * @param sourceClusterAction the source cluster retention action
+ * @param targetClusterName the target cluster name
+ * @param targetClusterStart the target cluster validity start time
+ * @param targetClusterEnd the target cluster validity end time
+ * @param targetClusterLimit the target cluster retention limit
+ * @param targetClusterAction the target cluster retention action
+ * @param properties the properties
+
+ */
+ public Feed(String name, String description, String status, String schedule,
+ String sourceClusterName, String sourceClusterStart, String sourceClusterEnd,
+ String sourceClusterLimit, String sourceClusterAction,
+ String targetClusterName, String targetClusterStart, String targetClusterEnd,
+ String targetClusterLimit, String targetClusterAction,
+ Map<String, String> properties) {
this.name = name;
this.description = description;
this.status = status;
this.schedule = schedule;
this.sourceClusterName = sourceClusterName;
+ this.sourceClusterStart = sourceClusterStart;
+ this.sourceClusterEnd = sourceClusterEnd;
+ this.sourceClusterLimit = sourceClusterLimit;
+ this.sourceClusterAction = sourceClusterAction;
this.targetClusterName = targetClusterName;
+ this.targetClusterStart = targetClusterStart;
+ this.targetClusterEnd = targetClusterEnd;
+ this.targetClusterLimit = targetClusterLimit;
+ this.targetClusterAction = targetClusterAction;
+ this.properties = properties;
}
/**
@@ -94,6 +129,42 @@ public class Feed {
}
/**
+ * Get the source cluster validity start time.
+ *
+ * @return the source cluster validity start time
+ */
+ public String getSourceClusterStart() {
+ return sourceClusterStart;
+ }
+
+ /**
+ * Get the source cluster validity end time.
+ *
+ * @return the source cluster validity end time
+ */
+ public String getSourceClusterEnd() {
+ return sourceClusterEnd;
+ }
+
+ /**
+ * Get the source cluster retention limit.
+ *
+ * @return the source cluster retention limit
+ */
+ public String getSourceClusterLimit() {
+ return sourceClusterLimit;
+ }
+
+ /**
+ * Get the source cluster retention action.
+ *
+ * @return the source cluster retention action
+ */
+ public String getSourceClusterAction() {
+ return sourceClusterAction;
+ }
+
+ /**
* Get the target cluster name.
*
* @return the target cluster name
@@ -102,6 +173,51 @@ public class Feed {
return targetClusterName;
}
+ /**
+ * Get the target cluster validity start time.
+ *
+ * @return the target cluster validity start time
+ */
+ public String getTargetClusterStart() {
+ return targetClusterStart;
+ }
+
+ /**
+ * Get the target cluster validity end time.
+ *
+ * @return the target cluster validity end time
+ */
+ public String getTargetClusterEnd() {
+ return targetClusterEnd;
+ }
+
+ /**
+ * Get the target cluster retention limit.
+ *
+ * @return the target cluster retention limit
+ */
+ public String getTargetClusterLimit() {
+ return targetClusterLimit;
+ }
+
+ /**
+ * Get the target cluster retention action.
+ *
+ * @return the target cluster retention action
+ */
+ public String getTargetClusterAction() {
+ return targetClusterAction;
+ }
+
+ /**
+ * Get the properties.
+ *
+ * @return the properties
+ */
+ public Map<String, String> getProperties() {
+ return properties;
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) return true;
Modified: incubator/ambari/trunk/ambari-server/src/main/resources/key_properties.json
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/resources/key_properties.json?rev=1459936&r1=1459935&r2=1459936&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/resources/key_properties.json (original)
+++ incubator/ambari/trunk/ambari-server/src/main/resources/key_properties.json Fri Mar 22 19:18:57 2013
@@ -85,7 +85,7 @@
"DRTargetCluster":"Cluster/name"
},
"DRInstance":{
- "DRFeed":"Feed/name",
+ "DRFeed":"Instance/feedName",
"DRInstance":"Instance/id"
}
}
Modified: incubator/ambari/trunk/ambari-server/src/main/resources/properties.json
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/resources/properties.json?rev=1459936&r1=1459935&r2=1459936&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/resources/properties.json (original)
+++ incubator/ambari/trunk/ambari-server/src/main/resources/properties.json Fri Mar 22 19:18:57 2013
@@ -163,9 +163,10 @@
"Feed/name",
"Feed/description",
"Feed/status",
- "Feed/schedule",
- "Feed/sourceClusterName",
- "Feed/targetClusterName"
+ "Feed/frequency",
+ "Feed/sourceCluster",
+ "Feed/targetCluster",
+ "Feed/properties"
],
"DRTargetCluster":[
"Cluster/name",
Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/api/handlers/QueryCreateHandlerTest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/api/handlers/QueryCreateHandlerTest.java?rev=1459936&r1=1459935&r2=1459936&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/api/handlers/QueryCreateHandlerTest.java (original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/api/handlers/QueryCreateHandlerTest.java Fri Mar 22 19:18:57 2013
@@ -89,10 +89,22 @@ public class QueryCreateHandlerTest {
Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
Set<NamedPropertySet> setRequestProps = new HashSet<NamedPropertySet>();
- setRequestProps.add(new NamedPropertySet("components", Collections.<String, Object>singletonMap(
- PropertyHelper.getPropertyId("ServiceComponentInfo", "component_name"), "SECONDARY_NAMENODE")));
- setRequestProps.add(new NamedPropertySet("components", Collections.<String, Object>singletonMap(
- PropertyHelper.getPropertyId("ServiceComponentInfo", "component_name"), "HDFS_CLIENT")));
+
+ Map<String, Object> mapProperties = new HashMap<String, Object>();
+ Set<Map<String, Object>> arraySet = new HashSet<Map<String, Object>>();
+
+ mapProperties.put("components", arraySet);
+
+ Map<String, Object> map = new HashMap<String, Object>();
+ map.put(PropertyHelper.getPropertyId("ServiceComponentInfo", "component_name"), "SECONDARY_NAMENODE");
+ arraySet.add(map);
+
+ map = new HashMap<String, Object>();
+ map.put(PropertyHelper.getPropertyId("ServiceComponentInfo", "component_name"), "HDFS_CLIENT");
+ arraySet.add(map);
+
+ setRequestProps.add(new NamedPropertySet("", mapProperties));
+
Set<Map<String, Object>> setCreateProps = new HashSet<Map<String, Object>>();
Map<String, Object> map1 = new HashMap<String, Object>();
@@ -236,10 +248,20 @@ public class QueryCreateHandlerTest {
Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
Set<NamedPropertySet> setRequestProps = new HashSet<NamedPropertySet>();
- setRequestProps.add(new NamedPropertySet("", Collections.<String, Object>singletonMap(
- PropertyHelper.getPropertyId("ServiceComponentInfo", "component_name"), "SECONDARY_NAMENODE")));
- setRequestProps.add(new NamedPropertySet("", Collections.<String, Object>singletonMap(
- PropertyHelper.getPropertyId("ServiceComponentInfo", "component_name"), "HDFS_CLIENT")));
+ Map<String, Object> mapProperties = new HashMap<String, Object>();
+ Set<Map<String, Object>> arraySet = new HashSet<Map<String, Object>>();
+
+ mapProperties.put("", arraySet);
+
+ Map<String, Object> map = new HashMap<String, Object>();
+ map.put(PropertyHelper.getPropertyId("ServiceComponentInfo", "component_name"), "SECONDARY_NAMENODE");
+ arraySet.add(map);
+
+ map = new HashMap<String, Object>();
+ map.put(PropertyHelper.getPropertyId("ServiceComponentInfo", "component_name"), "HDFS_CLIENT");
+ arraySet.add(map);
+
+ setRequestProps.add(new NamedPropertySet("", mapProperties));
TreeNode<Resource> resultTree = new TreeNodeImpl<Resource>(null, null, "result");
resultTree.addChild(resource1, "resource1");
@@ -326,10 +348,20 @@ public class QueryCreateHandlerTest {
Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
Set<NamedPropertySet> setRequestProps = new HashSet<NamedPropertySet>();
- setRequestProps.add(new NamedPropertySet("INVALID", Collections.<String, Object>singletonMap(
- PropertyHelper.getPropertyId("ServiceComponentInfo", "component_name"), "SECONDARY_NAMENODE")));
- setRequestProps.add(new NamedPropertySet("INVALID", Collections.<String, Object>singletonMap(
- PropertyHelper.getPropertyId("ServiceComponentInfo", "component_name"), "HDFS_CLIENT")));
+ Map<String, Object> mapProperties = new HashMap<String, Object>();
+ Set<Map<String, Object>> arraySet = new HashSet<Map<String, Object>>();
+
+ mapProperties.put("INVALID", arraySet);
+
+ Map<String, Object> map = new HashMap<String, Object>();
+ map.put(PropertyHelper.getPropertyId("ServiceComponentInfo", "component_name"), "SECONDARY_NAMENODE");
+ arraySet.add(map);
+
+ map = new HashMap<String, Object>();
+ map.put(PropertyHelper.getPropertyId("ServiceComponentInfo", "component_name"), "HDFS_CLIENT");
+ arraySet.add(map);
+
+ setRequestProps.add(new NamedPropertySet("", mapProperties));
Map<String, ResourceInstance> mapSubResources = new HashMap<String, ResourceInstance>();
mapSubResources.put("components", subResource);
@@ -495,10 +527,23 @@ public class QueryCreateHandlerTest {
Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
Set<NamedPropertySet> setRequestProps = new HashSet<NamedPropertySet>();
- setRequestProps.add(new NamedPropertySet("foo", Collections.<String, Object>singletonMap(
- PropertyHelper.getPropertyId("ServiceComponentInfo", "component_name"), "SECONDARY_NAMENODE")));
- setRequestProps.add(new NamedPropertySet("bar", Collections.<String, Object>singletonMap(
- PropertyHelper.getPropertyId("ServiceComponentInfo", "component_name"), "HDFS_CLIENT")));
+ Map<String, Object> mapProperties = new HashMap<String, Object>();
+
+ Set<Map<String, Object>> arraySet = new HashSet<Map<String, Object>>();
+ mapProperties.put("foo", arraySet);
+
+ Map<String, Object> map = new HashMap<String, Object>();
+ map.put("prop", "val");
+ arraySet.add(map);
+
+ arraySet = new HashSet<Map<String, Object>>();
+ mapProperties.put("bar", arraySet);
+
+ map = new HashMap<String, Object>();
+ map.put("prop", "val");
+ arraySet.add(map);
+
+ setRequestProps.add(new NamedPropertySet("", mapProperties));
Map<String, ResourceInstance> mapSubResources = new HashMap<String, ResourceInstance>();
mapSubResources.put("foo", subResource1);
Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/api/services/parsers/JsonRequestBodyParserTest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/api/services/parsers/JsonRequestBodyParserTest.java?rev=1459936&r1=1459935&r2=1459936&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/api/services/parsers/JsonRequestBodyParserTest.java (original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/api/services/parsers/JsonRequestBodyParserTest.java Fri Mar 22 19:18:57 2013
@@ -305,28 +305,32 @@ public class JsonRequestBodyParserTest {
Set<NamedPropertySet> setProperties = body.getNamedPropertySets();
- assertEquals(3, setProperties.size());
+ assertEquals(1, setProperties.size());
boolean contains1 = false;
boolean contains2 = false;
boolean contains3 = false;
for (NamedPropertySet ps : setProperties) {
- assertEquals("services", ps.getName());
Map<String, Object> mapProps = ps.getProperties();
- String serviceName = (String) mapProps.get("ServiceInfo/service_name");
- if (serviceName.equals("unitTestService1")) {
- assertEquals(1, mapProps.size());
- contains1 = true;
- } else if (serviceName.equals("unitTestService2")) {
- assertEquals("prop1Value", mapProps.get("ServiceInfo/property1"));
- assertEquals(2, mapProps.size());
- contains2 = true;
- } else if (serviceName.equals("unitTestService3")) {
- assertEquals("prop2Value", mapProps.get("ServiceInfo/Category/property2"));
- assertEquals(2, mapProps.size());
- contains3 = true;
- } else {
- fail("Unexpected service name");
+ assertEquals(1, mapProps.size());
+ Set<Map<String, Object>> set = (Set<Map<String, Object>>) mapProps.get("services");
+
+ for (Map<String, Object> map : set) {
+ String serviceName = (String) map.get("ServiceInfo/service_name");
+ if (serviceName.equals("unitTestService1")) {
+ assertEquals(1, map.size());
+ contains1 = true;
+ } else if (serviceName.equals("unitTestService2")) {
+ assertEquals("prop1Value", map.get("ServiceInfo/property1"));
+ assertEquals(2, map.size());
+ contains2 = true;
+ } else if (serviceName.equals("unitTestService3")) {
+ assertEquals("prop2Value", map.get("ServiceInfo/Category/property2"));
+ assertEquals(2, map.size());
+ contains3 = true;
+ } else {
+ fail("Unexpected service name");
+ }
}
}
assertTrue(contains1);
@@ -338,7 +342,7 @@ public class JsonRequestBodyParserTest {
body = parser.parse(b);
Set<NamedPropertySet> setProps2 = body.getNamedPropertySets();
- assertEquals(3, setProps2.size());
+ assertEquals(1, setProps2.size());
assertEquals(setProperties, setProps2);
}
@@ -350,24 +354,34 @@ public class JsonRequestBodyParserTest {
Set<NamedPropertySet> setProperties = body.getNamedPropertySets();
- assertEquals(2, setProperties.size());
+ assertEquals(1, setProperties.size());
boolean contains1 = false;
boolean contains2 = false;
for (NamedPropertySet ps : setProperties) {
+
Map<String, Object> mapProps = ps.getProperties();
- String serviceName = (String) mapProps.get("ServiceInfo/service_name");
- if (serviceName.equals("unitTestService1")) {
- assertEquals("foo", ps.getName());
- assertEquals(1, mapProps.size());
- contains1 = true;
- } else if (serviceName.equals("unitTestService2")) {
- assertEquals("bar", ps.getName());
- assertEquals("prop2Value", mapProps.get("ServiceInfo/Category/property2"));
- assertEquals(2, mapProps.size());
- contains2 = true;
- } else {
- fail("Unexpected service name");
+
+ for (Map.Entry<String, Object> entry : mapProps.entrySet()) {
+ Set<Map<String, Object>> set = (Set<Map<String, Object>>) entry.getValue();
+
+ for (Map<String, Object> map : set) {
+
+ String serviceName = (String) map.get("ServiceInfo/service_name");
+ if (serviceName.equals("unitTestService1")) {
+ assertEquals("foo", entry.getKey());
+ assertEquals(1, map.size());
+ contains1 = true;
+ } else if (serviceName.equals("unitTestService2")) {
+ assertEquals("bar", entry.getKey());
+ assertEquals("prop2Value", map.get("ServiceInfo/Category/property2"));
+ assertEquals(2, map.size());
+ contains2 = true;
+ } else {
+ fail("Unexpected service name");
+ }
+
+ }
}
}
assertTrue(contains1);
@@ -378,7 +392,7 @@ public class JsonRequestBodyParserTest {
body = parser.parse(b);
Set<NamedPropertySet> setProps2 = body.getNamedPropertySets();
- assertEquals(2, setProps2.size());
+ assertEquals(1, setProps2.size());
assertEquals(setProperties, setProps2);
}
@@ -392,28 +406,36 @@ public class JsonRequestBodyParserTest {
Set<NamedPropertySet> setProperties = body.getNamedPropertySets();
assertEquals("foo=bar", body.getQueryString());
- assertEquals(3, setProperties.size());
+ assertEquals(1, setProperties.size());
boolean contains1 = false;
boolean contains2 = false;
boolean contains3 = false;
for (NamedPropertySet ps : setProperties) {
- assertEquals("services", ps.getName());
+ assertEquals("", ps.getName());
Map<String, Object> mapProps = ps.getProperties();
- String serviceName = (String) mapProps.get("ServiceInfo/service_name");
- if (serviceName.equals("unitTestService1")) {
- assertEquals(1, mapProps.size());
- contains1 = true;
- } else if (serviceName.equals("unitTestService2")) {
- assertEquals("prop1Value", mapProps.get("ServiceInfo/property1"));
- assertEquals(2, mapProps.size());
- contains2 = true;
- } else if (serviceName.equals("unitTestService3")) {
- assertEquals("prop2Value", mapProps.get("ServiceInfo/Category/property2"));
- assertEquals(2, mapProps.size());
- contains3 = true;
- } else {
- fail("Unexpected service name");
+
+ for (Map.Entry<String, Object> entry : mapProps.entrySet()) {
+ Set<Map<String, Object>> set = (Set<Map<String, Object>>) entry.getValue();
+
+ for (Map<String, Object> map : set) {
+
+ String serviceName = (String) map.get("ServiceInfo/service_name");
+ if (serviceName.equals("unitTestService1")) {
+ assertEquals(1, map.size());
+ contains1 = true;
+ } else if (serviceName.equals("unitTestService2")) {
+ assertEquals("prop1Value", map.get("ServiceInfo/property1"));
+ assertEquals(2, map.size());
+ contains2 = true;
+ } else if (serviceName.equals("unitTestService3")) {
+ assertEquals("prop2Value", map.get("ServiceInfo/Category/property2"));
+ assertEquals(2, map.size());
+ contains3 = true;
+ } else {
+ fail("Unexpected service name");
+ }
+ }
}
}
assertTrue(contains1);
@@ -427,7 +449,7 @@ public class JsonRequestBodyParserTest {
body = parser.parse(b);
Set<NamedPropertySet> setProps2 = body.getNamedPropertySets();
- assertEquals(3, setProps2.size());
+ assertEquals(1, setProps2.size());
assertEquals(setProperties, setProps2);
}
Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/FeedResourceProviderTest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/FeedResourceProviderTest.java?rev=1459936&r1=1459935&r2=1459936&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/FeedResourceProviderTest.java (original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/FeedResourceProviderTest.java Fri Mar 22 19:18:57 2013
@@ -88,9 +88,11 @@ public class FeedResourceProviderTest {
feedNames.add("Feed2");
feedNames.add("Feed3");
- Feed feed1 = new Feed("Feed1", "d", "s", "sch", "source", "target");
- Feed feed2 = new Feed("Feed2", "d", "s", "sch", "source", "target");
- Feed feed3 = new Feed("Feed3", "d", "s", "sch", "source", "target");
+ Map<String,String> props = new HashMap<String, String>();
+
+ Feed feed1 = new Feed("Feed1", "d", "s", "sch", "source", "st", "end", "l", "a", "target", "st", "end", "l", "a", props);
+ Feed feed2 = new Feed("Feed2", "d", "s", "sch", "source", "st", "end", "l", "a", "target", "st", "end", "l", "a", props);
+ Feed feed3 = new Feed("Feed3", "d", "s", "sch", "source", "st", "end", "l", "a", "target", "st", "end", "l", "a", props);
// set expectations
expect(service.getFeedNames()).andReturn(feedNames);
@@ -129,14 +131,16 @@ public class FeedResourceProviderTest {
properties.put(FeedResourceProvider.FEED_NAME_PROPERTY_ID, "Feed1");
properties.put(FeedResourceProvider.FEED_DESCRIPTION_PROPERTY_ID, "desc");
properties.put(FeedResourceProvider.FEED_SCHEDULE_PROPERTY_ID, "sched");
- properties.put(FeedResourceProvider.FEED_STATUS_PROPERTY_ID, "SUBMITTED");
+ properties.put(FeedResourceProvider.FEED_STATUS_PROPERTY_ID, "WAITING");
properties.put(FeedResourceProvider.FEED_SOURCE_CLUSTER_NAME_PROPERTY_ID, "source");
properties.put(FeedResourceProvider.FEED_TARGET_CLUSTER_NAME_PROPERTY_ID, "target");
List<String> feedNames = new LinkedList<String>();
feedNames.add("Feed1");
- Feed feed1 = new Feed("Feed1", "desc", "SUBMITTED", "sched", "source", "target");
+ Map<String,String> props = new HashMap<String, String>();
+
+ Feed feed1 = new Feed("Feed1", "desc", "WAITING", "sched", "source", "st", "end", "l", "a", "target", "st", "end", "l", "a", props);
// set expectations
expect(service.getFeedNames()).andReturn(feedNames);
@@ -169,7 +173,9 @@ public class FeedResourceProviderTest {
List<String> feedNames = new LinkedList<String>();
feedNames.add("Feed1");
- Feed feed1 = new Feed("Feed1", "desc", "SUBMITTED", "sched", "source", "target");
+ Map<String,String> props = new HashMap<String, String>();
+
+ Feed feed1 = new Feed("Feed1", "d", "s", "sch", "source", "st", "end", "l", "a", "target", "st", "end", "l", "a", props);
// set expectations
expect(service.getFeedNames()).andReturn(feedNames);
Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TargetClusterResourceProviderTest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TargetClusterResourceProviderTest.java?rev=1459936&r1=1459935&r2=1459936&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TargetClusterResourceProviderTest.java (original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TargetClusterResourceProviderTest.java Fri Mar 22 19:18:57 2013
@@ -46,6 +46,25 @@ import static org.easymock.EasyMock.veri
* Tests for TargetClusterResourceProvider.
*/
public class TargetClusterResourceProviderTest {
+
+
+ private static Cluster.Interface interface1 = new Cluster.Interface("write", "hdfs://ec2.a.b.com:8020", "1.1.2.22");
+
+ private static Map<String, String> interfaces = new HashMap<String, String>();
+ static {
+ interfaces.put("type", interface1.getType());
+ interfaces.put("endpoint", interface1.getEndpoint());
+ interfaces.put("version", interface1.getVersion());
+ }
+
+ private static Cluster.Location location1 = new Cluster.Location("location1", "/mirrorthis");
+
+ private static Map<String, String> locations = new HashMap<String, String>();
+ static {
+ locations.put("name", location1.getName());
+ locations.put("path", location1.getPath());
+ }
+
@Test
public void testCreateResources() throws Exception {
IvoryService service = createMock(IvoryService.class);
@@ -56,8 +75,8 @@ public class TargetClusterResourceProvid
properties.put(TargetClusterResourceProvider.CLUSTER_NAME_PROPERTY_ID, "Cluster1");
properties.put(TargetClusterResourceProvider.CLUSTER_COLO_PROPERTY_ID, "Colo");
- properties.put(TargetClusterResourceProvider.CLUSTER_INTERFACES_PROPERTY_ID, Collections.singleton("Interface1"));
- properties.put(TargetClusterResourceProvider.CLUSTER_LOCATIONS_PROPERTY_ID, Collections.singleton("Location1"));
+ properties.put(TargetClusterResourceProvider.CLUSTER_INTERFACES_PROPERTY_ID, Collections.singleton(interfaces));
+ properties.put(TargetClusterResourceProvider.CLUSTER_LOCATIONS_PROPERTY_ID, Collections.singleton(locations));
properties.put(TargetClusterResourceProvider.CLUSTER_PROPERTIES_PROPERTY_ID, Collections.singletonMap("P1", "V1"));
// set expectations
@@ -93,12 +112,15 @@ public class TargetClusterResourceProvid
targetClusterNames.add("Cluster2");
targetClusterNames.add("Cluster3");
- Cluster targetCluster1 = new Cluster("Cluster1", "Colo", Collections.singleton("Interface1"),
- Collections.singleton("Location1"), Collections.singletonMap("P1", "V1"));
- Cluster targetCluster2 = new Cluster("Cluster2", "Colo", Collections.singleton("Interface1"),
- Collections.singleton("Location1"), Collections.singletonMap("P1", "V1"));
- Cluster targetCluster3 = new Cluster("Cluster3", "Colo", Collections.singleton("Interface1"),
- Collections.singleton("Location1"), Collections.singletonMap("P1", "V1"));
+ Cluster.Interface interface1 = new Cluster.Interface("type", "endpoint", "version");
+ Cluster.Location location1 = new Cluster.Location("name", "path");
+
+ Cluster targetCluster1 = new Cluster("Cluster1", "Colo", Collections.singleton(interface1),
+ Collections.singleton(location1), Collections.singletonMap("P1", "V1"));
+ Cluster targetCluster2 = new Cluster("Cluster2", "Colo", Collections.singleton(interface1),
+ Collections.singleton(location1), Collections.singletonMap("P1", "V1"));
+ Cluster targetCluster3 = new Cluster("Cluster3", "Colo", Collections.singleton(interface1),
+ Collections.singleton(location1), Collections.singletonMap("P1", "V1"));
// set expectations
expect(service.getClusterNames()).andReturn(targetClusterNames);
@@ -136,15 +158,18 @@ public class TargetClusterResourceProvid
properties.put(TargetClusterResourceProvider.CLUSTER_NAME_PROPERTY_ID, "Cluster1");
properties.put(TargetClusterResourceProvider.CLUSTER_COLO_PROPERTY_ID, "Colo");
- properties.put(TargetClusterResourceProvider.CLUSTER_INTERFACES_PROPERTY_ID, Collections.singleton("Interface1"));
- properties.put(TargetClusterResourceProvider.CLUSTER_LOCATIONS_PROPERTY_ID, Collections.singleton("Location1"));
- properties.put(TargetClusterResourceProvider.CLUSTER_PROPERTIES_PROPERTY_ID, Collections.singletonMap("P1", "V1"));
+ properties.put(TargetClusterResourceProvider.CLUSTER_INTERFACES_PROPERTY_ID, Collections.singleton(interfaces));
+ properties.put(TargetClusterResourceProvider.CLUSTER_LOCATIONS_PROPERTY_ID, Collections.singleton(locations));
+ properties.put(TargetClusterResourceProvider.CLUSTER_PROPERTIES_PROPERTY_ID + "/P1", "V1");
List<String> targetClusterNames = new LinkedList<String>();
targetClusterNames.add("Cluster1");
- Cluster targetCluster1 = new Cluster("Cluster1", "Colo", Collections.singleton("Interface1"),
- Collections.singleton("Location1"), Collections.singletonMap("P1", "V1"));
+ Set<Cluster.Interface> interfaceSet = Collections.singleton(interface1);
+ Set<Cluster.Location> locationSet = Collections.singleton(location1);
+
+ Cluster targetCluster1 = new Cluster("Cluster1", "Colo", interfaceSet,
+ locationSet, Collections.singletonMap("P1", "V1"));
// set expectations
expect(service.getClusterNames()).andReturn(targetClusterNames);
@@ -177,8 +202,11 @@ public class TargetClusterResourceProvid
List<String> targetClusterNames = new LinkedList<String>();
targetClusterNames.add("Cluster1");
- Cluster targetCluster1 = new Cluster("Cluster1", "Colo", Collections.singleton("Interface1"),
- Collections.singleton("Location1"), Collections.singletonMap("P1", "V1"));
+ Cluster.Interface interface1 = new Cluster.Interface("type", "endpoint", "version");
+ Cluster.Location location1 = new Cluster.Location("name", "path");
+
+ Cluster targetCluster1 = new Cluster("Cluster1", "Colo", Collections.singleton(interface1),
+ Collections.singleton(location1), Collections.singletonMap("P1", "V1"));
// set expectations
expect(service.getClusterNames()).andReturn(targetClusterNames);
Added: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TestIvoryProviderModule.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TestIvoryProviderModule.java?rev=1459936&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TestIvoryProviderModule.java (added)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TestIvoryProviderModule.java Fri Mar 22 19:18:57 2013
@@ -0,0 +1,51 @@
+/**
+ * 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.server.controller.internal;
+
+import org.apache.ambari.server.controller.ivory.IvoryService;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.spi.ResourceProvider;
+import org.apache.ambari.server.controller.utilities.PropertyHelper;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Extension of the default provider module that registers the mirroring resources with a test Ivory service.
+ */
+public class TestIvoryProviderModule extends DefaultProviderModule{
+
+ IvoryService service = new TestIvoryService(null, null, null);
+
+ @Override
+ protected ResourceProvider createResourceProvider(Resource.Type type) {
+ Set<String> propertyIds = PropertyHelper.getPropertyIds(type);
+ Map<Resource.Type,String> keyPropertyIds = PropertyHelper.getKeyPropertyIds(type);
+
+ switch (type) {
+ case DRFeed:
+ return new FeedResourceProvider(service, propertyIds, keyPropertyIds);
+ case DRTargetCluster:
+ return new TargetClusterResourceProvider(service, propertyIds, keyPropertyIds);
+ case DRInstance:
+ return new InstanceResourceProvider(service, propertyIds, keyPropertyIds);
+ }
+ return super.createResourceProvider(type);
+ }
+}
Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TestIvoryService.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TestIvoryService.java?rev=1459936&r1=1459935&r2=1459936&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TestIvoryService.java (original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TestIvoryService.java Fri Mar 22 19:18:57 2013
@@ -5,6 +5,7 @@ import org.apache.ambari.server.controll
import org.apache.ambari.server.controller.ivory.Instance;
import org.apache.ambari.server.controller.ivory.IvoryService;
+import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
@@ -15,6 +16,8 @@ import java.util.Map;
*/
public class TestIvoryService implements IvoryService{
+ private int instanceCounter = 0;
+
private final Map<String, Feed> feeds = new HashMap<String, Feed>();
private final Map<String, Cluster> clusters = new HashMap<String, Cluster>();
private final Map<String, Map<String, Instance>> instanceMap = new HashMap<String, Map<String, Instance>>();
@@ -74,6 +77,7 @@ public class TestIvoryService implements
@Override
public void scheduleFeed(String feedName) {
setFeedStatus(feedName, "SCHEDULED");
+ addDummyInstance(feedName);
}
@Override
@@ -108,14 +112,18 @@ public class TestIvoryService implements
@Override
public List<Instance> getInstances(String feedName) {
- return new LinkedList<Instance>(instanceMap.get(feedName).values());
+ Map<String, Instance> instances = instanceMap.get(feedName);
+ if (instances != null) {
+ return new LinkedList<Instance>(instances.values());
+ }
+ return Collections.emptyList();
}
@Override
public void suspendInstance(String feedName, String instanceId) {
String instanceKey = feedName + "/" + instanceId;
- suspendedFeedStatusMap.put(instanceKey, setInstanceStatus(feedName, instanceId, "SUSPENDED"));
+ suspendedInstanceStatusMap.put(instanceKey, setInstanceStatus(feedName, instanceId, "SUSPENDED"));
}
@Override
@@ -152,7 +160,17 @@ public class TestIvoryService implements
status,
feed.getSchedule(),
feed.getSourceClusterName(),
- feed.getTargetClusterName());
+ feed.getSourceClusterStart(),
+ feed.getSourceClusterEnd(),
+ feed.getSourceClusterLimit(),
+ feed.getSourceClusterAction(),
+ feed.getTargetClusterName(),
+ feed.getTargetClusterStart(),
+ feed.getTargetClusterEnd(),
+ feed.getTargetClusterLimit(),
+ feed.getTargetClusterAction(),
+ feed.getProperties());
+
feeds.put(feed.getName(), feed);
}
}
@@ -181,4 +199,19 @@ public class TestIvoryService implements
}
return currentStatus;
}
+
+ private void addDummyInstance(String feedName) {
+ Map<String, Instance> instances = instanceMap.get(feedName);
+ if (instances == null) {
+ instances = new HashMap<String, Instance>();
+ instanceMap.put(feedName, instances);
+ }
+
+ String id = "Instance" + instanceCounter++;
+ Instance instance = new Instance(feedName, id, "RUNNING",
+ "2011-01-01T00:00Z", "2011-01-01T00:10Z", "details", "stdout" );
+ instances.put(id, instance);
+ }
+
+
}
Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/ivory/ClusterTest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/ivory/ClusterTest.java?rev=1459936&r1=1459935&r2=1459936&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/ivory/ClusterTest.java (original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/ivory/ClusterTest.java Fri Mar 22 19:18:57 2013
@@ -29,36 +29,38 @@ import java.util.Collections;
public class ClusterTest {
@Test
public void testGetName() throws Exception {
- Cluster cluster = new Cluster("Cluster1", "Colo", Collections.singleton("Interface1"),
- Collections.singleton("Location1"), Collections.singletonMap("P1", "V1"));
+ Cluster cluster = new Cluster("Cluster1", "Colo", Collections.singleton(new Cluster.Interface("type", "endpoint", "version")),
+ Collections.singleton(new Cluster.Location("name", "path")), Collections.singletonMap("P1", "V1"));
Assert.assertEquals("Cluster1", cluster.getName());
}
@Test
public void testGetColo() throws Exception {
- Cluster cluster = new Cluster("Cluster1", "Colo", Collections.singleton("Interface1"),
- Collections.singleton("Location1"), Collections.singletonMap("P1", "V1"));
+ Cluster cluster = new Cluster("Cluster1", "Colo", Collections.singleton(new Cluster.Interface("type", "endpoint", "version")),
+ Collections.singleton(new Cluster.Location("name", "path")), Collections.singletonMap("P1", "V1"));
Assert.assertEquals("Colo", cluster.getColo());
}
@Test
public void testGetInterfaces() throws Exception {
- Cluster cluster = new Cluster("Cluster1", "Colo", Collections.singleton("Interface1"),
- Collections.singleton("Location1"), Collections.singletonMap("P1", "V1"));
- Assert.assertEquals(Collections.singleton("Interface1"), cluster.getInterfaces());
+ Cluster.Interface interface1 = new Cluster.Interface("type", "endpoint", "version");
+ Cluster cluster = new Cluster("Cluster1", "Colo", Collections.singleton(interface1),
+ Collections.singleton(new Cluster.Location("name", "path")), Collections.singletonMap("P1", "V1"));
+ Assert.assertEquals(Collections.singleton(interface1), cluster.getInterfaces());
}
@Test
public void testGetLocations() throws Exception {
- Cluster cluster = new Cluster("Cluster1", "Colo", Collections.singleton("Interface1"),
- Collections.singleton("Location1"), Collections.singletonMap("P1", "V1"));
- Assert.assertEquals(Collections.singleton("Location1"), cluster.getLocations());
+ Cluster.Location location = new Cluster.Location("name", "path");
+ Cluster cluster = new Cluster("Cluster1", "Colo", Collections.singleton(new Cluster.Interface("type", "endpoint", "version")),
+ Collections.singleton(location), Collections.singletonMap("P1", "V1"));
+ Assert.assertEquals(Collections.singleton(location), cluster.getLocations());
}
@Test
public void testGetProperties() throws Exception {
- Cluster cluster = new Cluster("Cluster1", "Colo", Collections.singleton("Interface1"),
- Collections.singleton("Location1"), Collections.singletonMap("P1", "V1"));
+ Cluster cluster = new Cluster("Cluster1", "Colo", Collections.singleton(new Cluster.Interface("type", "endpoint", "version")),
+ Collections.singleton(new Cluster.Location("name", "path")), Collections.singletonMap("P1", "V1"));
Assert.assertEquals(Collections.singletonMap("P1", "V1"), cluster.getProperties());
}
}
Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/ivory/FeedTest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/ivory/FeedTest.java?rev=1459936&r1=1459935&r2=1459936&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/ivory/FeedTest.java (original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/ivory/FeedTest.java Fri Mar 22 19:18:57 2013
@@ -21,43 +21,131 @@ package org.apache.ambari.server.control
import org.junit.Assert;
import org.junit.Test;
+import java.util.HashMap;
+import java.util.Map;
+
/**
* Feed tests.
*/
public class FeedTest {
@Test
public void testGetName() throws Exception {
- Feed feed = new Feed("Feed1", "desc", "SUBMITTED", "sched", "source", "target");
+ Map<String,String> props = new HashMap<String, String>();
+
+ Feed feed = new Feed("Feed1", "d", "s", "sch", "source", "st", "end", "l", "a", "target", "st", "end", "l", "a", props);
Assert.assertEquals("Feed1", feed.getName());
}
@Test
public void testGetDescription() throws Exception {
- Feed feed = new Feed("Feed1", "desc", "SUBMITTED", "sched", "source", "target");
+ Map<String,String> props = new HashMap<String, String>();
+
+ Feed feed = new Feed("Feed1", "desc", "s", "sch", "source", "st", "end", "l", "a", "target", "st", "end", "l", "a", props);
Assert.assertEquals("desc", feed.getDescription());
}
@Test
public void testGetStatus() throws Exception {
- Feed feed = new Feed("Feed1", "desc", "SUBMITTED", "sched", "source", "target");
- Assert.assertEquals("SUBMITTED", feed.getStatus());
+ Map<String,String> props = new HashMap<String, String>();
+
+ Feed feed = new Feed("Feed1", "d", "WAITING", "sch", "source", "st", "end", "l", "a", "target", "st", "end", "l", "a", props);
+ Assert.assertEquals("WAITING", feed.getStatus());
}
@Test
public void testGetSchedule() throws Exception {
- Feed feed = new Feed("Feed1", "desc", "SUBMITTED", "sched", "source", "target");
- Assert.assertEquals("sched", feed.getSchedule());
+ Map<String,String> props = new HashMap<String, String>();
+
+ Feed feed = new Feed("Feed1", "d", "WAITING", "frequency", "source", "st", "end", "l", "a", "target", "st", "end", "l", "a", props);
+ Assert.assertEquals("frequency", feed.getSchedule());
}
@Test
public void testGetSourceClusterName() throws Exception {
- Feed feed = new Feed("Feed1", "desc", "SUBMITTED", "sched", "source", "target");
+ Map<String,String> props = new HashMap<String, String>();
+
+ Feed feed = new Feed("Feed1", "d", "s", "sch", "source", "st", "end", "l", "a", "target", "st", "end", "l", "a", props);
Assert.assertEquals("source", feed.getSourceClusterName());
}
@Test
+ public void testGetSourceClusterStart() throws Exception {
+ Map<String,String> props = new HashMap<String, String>();
+
+ Feed feed = new Feed("Feed1", "d", "s", "sch", "source", "sst", "end", "l", "a", "target", "st", "end", "l", "a", props);
+ Assert.assertEquals("sst", feed.getSourceClusterStart());
+ }
+
+ @Test
+ public void testGetSourceClusterEnd() throws Exception {
+ Map<String,String> props = new HashMap<String, String>();
+
+ Feed feed = new Feed("Feed1", "d", "s", "sch", "source", "st", "send", "l", "a", "target", "st", "end", "l", "a", props);
+ Assert.assertEquals("send", feed.getSourceClusterEnd());
+ }
+
+ @Test
+ public void testGetSourceClusterLimit() throws Exception {
+ Map<String,String> props = new HashMap<String, String>();
+
+ Feed feed = new Feed("Feed1", "d", "s", "sch", "source", "st", "end", "sl", "a", "target", "st", "end", "l", "a", props);
+ Assert.assertEquals("sl", feed.getSourceClusterLimit());
+ }
+
+ @Test
+ public void testGetSourceClusterAction() throws Exception {
+ Map<String,String> props = new HashMap<String, String>();
+
+ Feed feed = new Feed("Feed1", "d", "s", "sch", "source", "st", "end", "l", "sa", "target", "st", "end", "l", "a", props);
+ Assert.assertEquals("sa", feed.getSourceClusterAction());
+ }
+
+ @Test
public void testGetTargetClusterName() throws Exception {
- Feed feed = new Feed("Feed1", "desc", "SUBMITTED", "sched", "source", "target");
+ Map<String,String> props = new HashMap<String, String>();
+
+ Feed feed = new Feed("Feed1", "d", "s", "sch", "source", "st", "end", "l", "a", "target", "st", "end", "l", "a", props);
Assert.assertEquals("target", feed.getTargetClusterName());
}
+
+ @Test
+ public void testGetTargetClusterStart() throws Exception {
+ Map<String,String> props = new HashMap<String, String>();
+
+ Feed feed = new Feed("Feed1", "d", "s", "sch", "source", "sst", "end", "l", "a", "target", "tst", "end", "l", "a", props);
+ Assert.assertEquals("tst", feed.getTargetClusterStart());
+ }
+
+ @Test
+ public void testGetTargetClusterEnd() throws Exception {
+ Map<String,String> props = new HashMap<String, String>();
+
+ Feed feed = new Feed("Feed1", "d", "s", "sch", "source", "st", "send", "l", "a", "target", "st", "tend", "l", "a", props);
+ Assert.assertEquals("tend", feed.getTargetClusterEnd());
+ }
+
+ @Test
+ public void testGetTargetClusterLimit() throws Exception {
+ Map<String,String> props = new HashMap<String, String>();
+
+ Feed feed = new Feed("Feed1", "d", "s", "sch", "source", "st", "end", "sl", "a", "target", "st", "end", "tl", "a", props);
+ Assert.assertEquals("tl", feed.getTargetClusterLimit());
+ }
+
+ @Test
+ public void testGetTargetClusterAction() throws Exception {
+ Map<String,String> props = new HashMap<String, String>();
+
+ Feed feed = new Feed("Feed1", "d", "s", "sch", "source", "st", "end", "l", "sa", "target", "st", "end", "l", "ta", props);
+ Assert.assertEquals("ta", feed.getTargetClusterAction());
+ }
+
+ @Test
+ public void testGetProperties() throws Exception {
+ Map<String,String> props = new HashMap<String, String>();
+ props.put("p1", "v1");
+
+ Feed feed = new Feed("Feed1", "d", "s", "sch", "source", "st", "end", "l", "sa", "target", "st", "end", "l", "ta", props);
+ Assert.assertEquals(props, feed.getProperties());
+ }
}