AMBARI-22220 - Should be able to switch the extension version to which a stack 
version is linked


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5f86f159
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5f86f159
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5f86f159

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 5f86f159fae5f65b25ef77b5c9eb9cb7d1179834
Parents: 0317cf7
Author: Tim Thorpe <ttho...@apache.org>
Authored: Mon Oct 16 06:16:35 2017 -0700
Committer: Tim Thorpe <ttho...@apache.org>
Committed: Mon Oct 16 06:16:35 2017 -0700

----------------------------------------------------------------------
 .../controller/AmbariManagementController.java  |   6 +-
 .../AmbariManagementControllerImpl.java         |  50 ++++----
 .../controller/AmbariManagementHelper.java      |  26 ++++
 .../internal/ExtensionLinkResourceProvider.java |  15 +++
 .../ambari/server/stack/ExtensionHelper.java    |  31 ++++-
 .../server/stack/StackManagerExtensionTest.java |  22 +++-
 .../resources/extensions/EXT/0.2/metainfo.xml   |   4 +-
 .../resources/extensions/EXT/0.4/metainfo.xml   |  32 +++++
 .../EXT/0.4/services/OOZIE2/metainfo.xml        | 118 +++++++++++++++++++
 .../services/OOZIE2/themes/broken_theme.json    |   3 +
 10 files changed, 273 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/5f86f159/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
index f0f13e1..45f9b3a 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
@@ -369,18 +369,18 @@ public interface AmbariManagementController {
   void createExtensionLink(ExtensionLinkRequest request) throws 
AmbariException;
 
   /**
-   * Update a link between an extension and a stack
+   * Update a link - switch the link's extension version while keeping the 
same stack version and extension name
    *
    * @throws AmbariException if we fail to link the extension to the stack
    */
   void updateExtensionLink(ExtensionLinkRequest request) throws 
AmbariException;
 
   /**
-   * Update a link between an extension and a stack
+   * Update a link - switch the link's extension version while keeping the 
same stack version and extension name
    *
    * @throws AmbariException if we fail to link the extension to the stack
    */
-  void updateExtensionLink(ExtensionLinkEntity linkEntity) throws 
AmbariException;
+  void updateExtensionLink(ExtensionLinkEntity oldLinkEntity, 
ExtensionLinkRequest newLinkRequest) throws AmbariException;
 
   /**
    * Delete a link between an extension and a stack

http://git-wip-us.apache.org/repos/asf/ambari/blob/5f86f159/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index b0eb8ac..1b1f524 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -1126,7 +1126,7 @@ public class AmbariManagementControllerImpl implements 
AmbariManagementControlle
     try {
       cluster = clusters.getCluster(request.getClusterName());
     } catch (ClusterNotFoundException e) {
-      LOG.info(e.getMessage());
+      LOG.error("Cluster not found ", e);
       throw new ParentObjectNotFoundException("Parent Cluster resource doesn't 
exist", e);
     }
 
@@ -4795,9 +4795,7 @@ public class AmbariManagementControllerImpl implements 
AmbariManagementControlle
       properties = ambariMetaInfo.getServiceProperties(stackName, 
stackVersion, serviceName);
     }
     for (PropertyInfo property: properties) {
-      if (property.shouldBeConfigured()) {
-        response.add(property.convertToResponse());
-      }
+      response.add(property.convertToResponse());
     }
 
     return response;
@@ -5622,12 +5620,9 @@ public class AmbariManagementControllerImpl implements 
AmbariManagementControlle
   }
 
   /**
-   * This method will update a link between an extension version and a stack 
version (Extension Link).
-   * Updating will only force ambari server to reread the stack and extension 
directories.
+   * Update a link - switch the link's extension version while keeping the 
same stack version and extension name
    *
-   * An extension version is like a stack version but it contains custom 
services.  Linking an extension
-   * version to the current stack version allows the cluster to install the 
custom services contained in
-   * the extension version.
+   * @throws AmbariException if we fail to link the extension to the stack
    */
   @Override
   public void updateExtensionLink(ExtensionLinkRequest request) throws 
AmbariException {
@@ -5641,32 +5636,43 @@ public class AmbariManagementControllerImpl implements 
AmbariManagementControlle
       throw new AmbariException("Unable to find extension link"
             + ", linkId=" + request.getLinkId(), e);
     }
-    updateExtensionLink(linkEntity);
+    updateExtensionLink(linkEntity, request);
   }
 
   /**
-   * This method will update a link between an extension version and a stack 
version (Extension Link).
-   * Updating will only force ambari server to reread the stack and extension 
directories.
+   * Update a link - switch the link's extension version while keeping the 
same stack version and extension name
    *
-   * An extension version is like a stack version but it contains custom 
services.  Linking an extension
-   * version to the current stack version allows the cluster to install the 
custom services contained in
-   * the extension version.
+   * @throws AmbariException if we fail to link the extension to the stack
    */
   @Override
-  public void updateExtensionLink(ExtensionLinkEntity linkEntity) throws 
AmbariException {
-    StackInfo stackInfo = 
ambariMetaInfo.getStack(linkEntity.getStack().getStackName(), 
linkEntity.getStack().getStackVersion());
+  public void updateExtensionLink(ExtensionLinkEntity oldLinkEntity, 
ExtensionLinkRequest newLinkRequest) throws AmbariException {
+    StackInfo stackInfo = 
ambariMetaInfo.getStack(oldLinkEntity.getStack().getStackName(), 
oldLinkEntity.getStack().getStackVersion());
 
     if (stackInfo == null) {
-      throw new StackAccessException("stackName=" + 
linkEntity.getStack().getStackName() + ", stackVersion=" + 
linkEntity.getStack().getStackVersion());
+      throw new StackAccessException(String.format("stackName=%s, 
stackVersion=%s", oldLinkEntity.getStack().getStackName(), 
oldLinkEntity.getStack().getStackVersion()));
     }
 
-    ExtensionInfo extensionInfo = 
ambariMetaInfo.getExtension(linkEntity.getExtension().getExtensionName(), 
linkEntity.getExtension().getExtensionVersion());
+    if (newLinkRequest.getExtensionName() == null || 
newLinkRequest.getExtensionVersion() == null) {
+      throw new AmbariException(String.format("Invalid extension name or 
version: %s/%s",
+                 newLinkRequest.getExtensionName(), 
newLinkRequest.getExtensionVersion()));
+    }
 
-    if (extensionInfo == null) {
-      throw new StackAccessException("extensionName=" + 
linkEntity.getExtension().getExtensionName() + ", extensionVersion=" + 
linkEntity.getExtension().getExtensionVersion());
+    if 
(!newLinkRequest.getExtensionName().equals(oldLinkEntity.getExtension().getExtensionName()))
 {
+      throw new AmbariException(String.format("Update is not allowed to switch 
the extension name, only the version.  Old name/new name: %s/%s",
+                 oldLinkEntity.getExtension().getExtensionName(), 
newLinkRequest.getExtensionName()));
+    }
+
+    ExtensionInfo oldExtensionInfo = 
ambariMetaInfo.getExtension(oldLinkEntity.getExtension().getExtensionName(), 
oldLinkEntity.getExtension().getExtensionVersion());
+    ExtensionInfo newExtensionInfo = 
ambariMetaInfo.getExtension(newLinkRequest.getExtensionName(), 
newLinkRequest.getExtensionVersion());
+
+    if (oldExtensionInfo == null) {
+      throw new StackAccessException(String.format("Old extensionName=%s, 
extensionVersion=%s", oldLinkEntity.getExtension().getExtensionName(), 
oldLinkEntity.getExtension().getExtensionVersion()));
+    }
+    if (newExtensionInfo == null) {
+      throw new StackAccessException(String.format("New extensionName=%s, 
extensionVersion=%s", newLinkRequest.getExtensionName(), 
newLinkRequest.getExtensionVersion()));
     }
 
-    ambariMetaInfo.getStackManager().linkStackToExtension(stackInfo, 
extensionInfo);
+    helper.updateExtensionLink(ambariMetaInfo.getStackManager(), 
oldLinkEntity, stackInfo, oldExtensionInfo, newExtensionInfo);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/5f86f159/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementHelper.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementHelper.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementHelper.java
index 0c8edfe..e98c2e9 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementHelper.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementHelper.java
@@ -162,6 +162,32 @@ public class AmbariManagementHelper {
     }
   }
 
+  /**
+   * Updates the extension version of the currently linked extension to the 
stack version
+   */
+  public void updateExtensionLink(StackManager stackManager, 
ExtensionLinkEntity linkEntity, StackInfo stackInfo,
+                                  ExtensionInfo oldExtensionInfo, 
ExtensionInfo newExtensionInfo) throws AmbariException {
+    //validateUpdateExtensionLinkRequest(stackInfo, extensionInfo);
+    ExtensionHelper.validateUpdateLink(stackManager, stackInfo, 
oldExtensionInfo, newExtensionInfo);
+
+    ExtensionEntity extension = extensionDAO.find(newExtensionInfo.getName(), 
newExtensionInfo.getVersion());
+    linkEntity.setExtension(extension);
+
+    try {
+      linkEntity = linkDAO.merge(linkEntity);
+    } catch (RollbackException e) {
+      String message = "Unable to update extension link";
+      LOG.debug(message, e);
+      String errorMessage = message
+              + ", stackName=" + stackInfo.getName()
+              + ", stackVersion=" + stackInfo.getVersion()
+              + ", extensionName=" + newExtensionInfo.getName()
+              + ", extensionVersion=" + newExtensionInfo.getVersion();
+      LOG.warn(errorMessage);
+      throw new AmbariException(errorMessage, e);
+    }
+  }
+
   private ExtensionLinkEntity createExtensionLinkEntity(StackInfo stackInfo, 
ExtensionInfo extensionInfo) throws AmbariException {
     StackEntity stack = stackDAO.find(stackInfo.getName(), 
stackInfo.getVersion());
     ExtensionEntity extension = extensionDAO.find(extensionInfo.getName(), 
extensionInfo.getVersion());

http://git-wip-us.apache.org/repos/asf/ambari/blob/5f86f159/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ExtensionLinkResourceProvider.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ExtensionLinkResourceProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ExtensionLinkResourceProvider.java
index 9b894ff..db904bf 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ExtensionLinkResourceProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ExtensionLinkResourceProvider.java
@@ -196,6 +196,21 @@ public class ExtensionLinkResourceProvider extends 
AbstractControllerResourcePro
         throws SystemException, UnsupportedPropertyException,
         NoSuchResourceException, NoSuchParentResourceException {
 
+    final Set<ExtensionLinkRequest> requests = new HashSet<>();
+    for (Map<String, Object> propertyMap : request.getProperties()) {
+      requests.add(getRequest(propertyMap));
+    }
+
+    RequestStatusResponse response = modifyResources(new 
Command<RequestStatusResponse>() {
+      @Override
+      public RequestStatusResponse invoke() throws AmbariException {
+        for (ExtensionLinkRequest extensionLinkRequest : requests) {
+          getManagementController().updateExtensionLink(extensionLinkRequest);
+        }
+        return null;
+      }
+    });
+
     //Need to reread the stacks/extensions directories so the latest 
information is available
     try {
       getManagementController().updateStacks();

http://git-wip-us.apache.org/repos/asf/ambari/blob/5f86f159/ambari-server/src/main/java/org/apache/ambari/server/stack/ExtensionHelper.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/stack/ExtensionHelper.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/stack/ExtensionHelper.java
index 91dc870..3a143f4 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/stack/ExtensionHelper.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/stack/ExtensionHelper.java
@@ -18,6 +18,9 @@
 
 package org.apache.ambari.server.stack;
 
+import java.util.ArrayList;
+import java.util.Collection;
+
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.ServiceNotFoundException;
 import org.apache.ambari.server.state.Cluster;
@@ -72,6 +75,12 @@ public class ExtensionHelper {
     validateRequiredExtensions(stack, extension);
   }
 
+  public static void validateUpdateLink(StackManager stackManager, StackInfo 
stack, ExtensionInfo oldExtension, ExtensionInfo newExtension) throws 
AmbariException {
+    validateSupportedStackVersion(stack, newExtension);
+    validateServiceDuplication(stackManager, stack, oldExtension, 
newExtension);
+    validateRequiredExtensions(stack, newExtension);
+  }
+
   private static void validateSupportedStackVersion(StackInfo stack, 
ExtensionInfo extension) throws AmbariException {
     for (ExtensionMetainfoXml.Stack validStack : extension.getStacks()) {
       if (validStack.getName().equals(stack.getName())) {
@@ -93,8 +102,28 @@ public class ExtensionHelper {
   }
 
   private static void validateServiceDuplication(StackManager stackManager, 
StackInfo stack, ExtensionInfo extension) throws AmbariException {
+    validateServiceDuplication(stackManager, stack, extension, 
extension.getServices());
+  }
+
+  private static void validateServiceDuplication(StackManager stackManager, 
StackInfo stack, ExtensionInfo oldExtension, ExtensionInfo newExtension) throws 
AmbariException {
+    ArrayList<ServiceInfo> services = new 
ArrayList<>(newExtension.getServices().size());
+    for (ServiceInfo service : newExtension.getServices()) {
+      boolean found = false;
+      for (ServiceInfo current : oldExtension.getServices()) {
+        if (service.getName().equals(current.getName())) {
+          found = true;
+        }
+      }
+      if (!found) {
+        services.add(service);
+      }
+    }
+    validateServiceDuplication(stackManager, stack, newExtension, services);
+  }
+
+  private static void validateServiceDuplication(StackManager stackManager, 
StackInfo stack, ExtensionInfo extension, Collection<ServiceInfo> services) 
throws AmbariException {
     LOG.debug("Looking for duplicate services");
-    for (ServiceInfo service : extension.getServices()) {
+    for (ServiceInfo service : services) {
       LOG.debug("Looking for duplicate service " + service.getName());
       if (service != null) {
         ServiceInfo stackService = null;

http://git-wip-us.apache.org/repos/asf/ambari/blob/5f86f159/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerExtensionTest.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerExtensionTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerExtensionTest.java
index cef30b5..6617b33 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerExtensionTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerExtensionTest.java
@@ -81,6 +81,9 @@ public class StackManagerExtensionTest  {
     ExtensionEntity extension3 = new ExtensionEntity();
     extension3.setExtensionName("EXT");
     extension3.setExtensionVersion("0.3");
+    ExtensionEntity extension4 = new ExtensionEntity();
+    extension4.setExtensionName("EXT");
+    extension4.setExtensionVersion("0.4");
     ExtensionLinkEntity link1 = new ExtensionLinkEntity();
     link1.setLinkId(new Long(-1));
     link1.setStack(stack1);
@@ -96,6 +99,7 @@ public class StackManagerExtensionTest  {
     expect(extensionDao.find("EXT", 
"0.1")).andReturn(extension1).atLeastOnce();
     expect(extensionDao.find("EXT", 
"0.2")).andReturn(extension2).atLeastOnce();
     expect(extensionDao.find("EXT", 
"0.3")).andReturn(extension3).atLeastOnce();
+    expect(extensionDao.find("EXT", 
"0.4")).andReturn(extension4).atLeastOnce();
 
     expect(linkDao.findByStack("HDP", 
"0.1")).andReturn(linkList).atLeastOnce();
     expect(linkDao.findByStack(EasyMock.anyObject(String.class),
@@ -104,6 +108,8 @@ public class StackManagerExtensionTest  {
     expect(linkDao.findByStackAndExtension("HDP", "0.2", "EXT", 
"0.2")).andReturn(null).atLeastOnce();
     expect(linkDao.findByStackAndExtension("HDP", "0.1", "EXT", 
"0.1")).andReturn(link1).atLeastOnce();
 
+    expect(linkDao.merge(link1)).andReturn(link1).atLeastOnce();
+
     replay(actionMetadata, stackDao, metaInfoDao, osFamily, extensionDao, 
linkDao); //linkEntity
 
     String stacks = 
ClassLoader.getSystemClassLoader().getResource("stacks_with_extensions").getPath();
@@ -144,7 +150,7 @@ public class StackManagerExtensionTest  {
     assertNotNull("EXT 0.2's parent: " + 
extension.getParentExtensionVersion(), extension.getParentExtensionVersion());
     assertEquals("EXT 0.2's parent: " + extension.getParentExtensionVersion(), 
"0.1", extension.getParentExtensionVersion());
     assertNotNull(extension.getService("OOZIE2"));
-    assertTrue("Extension is not set to auto link", extension.isAutoLink());
+    assertTrue("Extension is set to auto link", !extension.isAutoLink());
     oozie = extension.getService("OOZIE2");
     assertNotNull("Package dir is " + oozie.getServicePackageFolder(), 
oozie.getServicePackageFolder());
     assertTrue("Package dir is " + oozie.getServicePackageFolder(), 
oozie.getServicePackageFolder().contains("extensions/EXT/0.1/services/OOZIE2/package"));
@@ -156,18 +162,24 @@ public class StackManagerExtensionTest  {
     assertNotNull(themes);
     assertTrue("Number of themes is " + themes.size(), themes.size() == 0);
 
+    extension = stackManager.getExtension("EXT", "0.3");
+    assertTrue("Extension is not set to auto link", extension.isAutoLink());
+
     StackInfo stack = stackManager.getStack("HDP", "0.1");
     assertNotNull(stack.getService("OOZIE2"));
     oozie = stack.getService("OOZIE2");
     assertNotNull("Package dir is " + oozie.getServicePackageFolder(), 
oozie.getServicePackageFolder());
     assertTrue("Package dir is " + oozie.getServicePackageFolder(), 
oozie.getServicePackageFolder().contains("extensions/EXT/0.1/services/OOZIE2/package"));
     assertEquals(oozie.getVersion(), "3.2.0");
-
     assertTrue("Extensions found: " + stack.getExtensions().size(), 
stack.getExtensions().size() == 1);
     extension = stack.getExtensions().iterator().next();
     assertEquals("Extension name: " + extension.getName(), 
extension.getName(), "EXT");
     assertEquals("Extension version: " + extension.getVersion(), 
extension.getVersion(), "0.1");
 
+    ExtensionInfo extensionInfo2 = stackManager.getExtension("EXT", "0.2");
+    helper.updateExtensionLink(stackManager, link1, stack, extension, 
extensionInfo2);
+    assertEquals(link1.getExtension().getExtensionVersion(), 
link1.getExtension().getExtensionVersion(), "0.2");
+
     stack = stackManager.getStack("HDP", "0.2");
     assertTrue("Extensions found: " + stack.getExtensions().size(), 
stack.getExtensions().size() == 0);
 
@@ -177,15 +189,13 @@ public class StackManagerExtensionTest  {
     assertNotNull(extension.getService("OOZIE2"));
     oozie = extension.getService("OOZIE2");
     assertEquals(oozie.getVersion(), "4.0.0");
-
     assertEquals("Extension name: " + extension.getName(), 
extension.getName(), "EXT");
-    assertEquals("Extension version: " + extension.getVersion(), 
extension.getVersion(), "0.3");
+    assertEquals("Extension version: " + extension.getVersion(), 
extension.getVersion(), "0.4");
 
     stack = stackManager.getStack("HDP", "0.4");
     assertTrue("Extensions found: " + stack.getExtensions().size(), 
stack.getExtensions().size() == 1);
     extension = stack.getExtensions().iterator().next();
     assertEquals("Extension name: " + extension.getName(), 
extension.getName(), "EXT");
-    assertEquals("Extension version: " + extension.getVersion(), 
extension.getVersion(), "0.3");
+    assertEquals("Extension version: " + extension.getVersion(), 
extension.getVersion(), "0.4");
   }
-
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/5f86f159/ambari-server/src/test/resources/extensions/EXT/0.2/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/extensions/EXT/0.2/metainfo.xml 
b/ambari-server/src/test/resources/extensions/EXT/0.2/metainfo.xml
index c95a20f..fa84c53 100644
--- a/ambari-server/src/test/resources/extensions/EXT/0.2/metainfo.xml
+++ b/ambari-server/src/test/resources/extensions/EXT/0.2/metainfo.xml
@@ -20,12 +20,12 @@
     <active>true</active>
   </versions>
   <extends>0.1</extends>
-  <auto-link>true</auto-link>
+  <auto-link>false</auto-link>
   <prerequisites>
     <min-stack-versions>
       <stack>
         <name>HDP</name>
-        <version>0.3</version>
+        <version>0.1</version>
       </stack>
     </min-stack-versions>
   </prerequisites>

http://git-wip-us.apache.org/repos/asf/ambari/blob/5f86f159/ambari-server/src/test/resources/extensions/EXT/0.4/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/extensions/EXT/0.4/metainfo.xml 
b/ambari-server/src/test/resources/extensions/EXT/0.4/metainfo.xml
new file mode 100644
index 0000000..0e74813
--- /dev/null
+++ b/ambari-server/src/test/resources/extensions/EXT/0.4/metainfo.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<!--
+   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.
+-->
+<metainfo>
+  <versions>
+    <active>true</active>
+  </versions>
+  <extends>0.3</extends>
+  <auto-link>true</auto-link>
+  <prerequisites>
+    <min-stack-versions>
+      <stack>
+        <name>HDP</name>
+        <version>0.3</version>
+      </stack>
+    </min-stack-versions>
+  </prerequisites>
+</metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/5f86f159/ambari-server/src/test/resources/extensions/EXT/0.4/services/OOZIE2/metainfo.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/resources/extensions/EXT/0.4/services/OOZIE2/metainfo.xml
 
b/ambari-server/src/test/resources/extensions/EXT/0.4/services/OOZIE2/metainfo.xml
new file mode 100644
index 0000000..9176551
--- /dev/null
+++ 
b/ambari-server/src/test/resources/extensions/EXT/0.4/services/OOZIE2/metainfo.xml
@@ -0,0 +1,118 @@
+<?xml version="1.0"?>
+<!--
+   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.
+-->
+<metainfo>
+  <schemaVersion>2.0</schemaVersion>
+  <services>
+    <service>
+      <name>OOZIE2</name>
+      <comment>System for workflow coordination and execution of Apache Hadoop 
jobs</comment>
+      <version>4.0.0</version>
+
+      <components>
+        <component>
+          <name>OOZIE2_SERVER</name>
+          <category>MASTER</category>
+          <cardinality>1</cardinality>
+          <dependencies>
+            <dependency>
+              <name>HDFS/HDFS_CLIENT</name>
+              <scope>host</scope>
+              <auto-deploy>
+                <enabled>true</enabled>
+              </auto-deploy>
+            </dependency>
+            <dependency>
+              <name>MAPREDUCE/MAPREDUCE_CLIENT</name>
+              <scope>host</scope>
+              <auto-deploy>
+                <enabled>true</enabled>
+              </auto-deploy>
+            </dependency>
+          </dependencies>
+          <commandScript>
+            <script>scripts/oozie2_server.py</script>
+            <scriptType>PYTHON</scriptType>
+            <timeout>600</timeout>
+          </commandScript>
+        </component>
+
+        <component>
+          <name>OOZIE2_CLIENT</name>
+          <category>CLIENT</category>
+          <cardinality>0+</cardinality>
+          <dependencies>
+            <dependency>
+              <name>HDFS/HDFS_CLIENT</name>
+              <scope>host</scope>
+              <auto-deploy>
+                <enabled>true</enabled>
+              </auto-deploy>
+            </dependency>
+            <dependency>
+              <name>MAPREDUCE/MAPREDUCE_CLIENT</name>
+              <scope>host</scope>
+              <auto-deploy>
+                <enabled>true</enabled>
+              </auto-deploy>
+            </dependency>
+          </dependencies>
+          <commandScript>
+            <script>scripts/oozie2_client.py</script>
+            <scriptType>PYTHON</scriptType>
+          </commandScript>
+        </component>
+      </components>
+
+      <osSpecifics>
+        <osSpecific>
+          <osFamily>any</osFamily>
+          <packages>
+            <package>
+              <name>oozie2.noarch</name>
+            </package>
+            <package>
+              <name>oozie2-client.noarch</name>
+            </package>
+            <package>
+              <name>extjs-2.2-1</name>
+            </package>
+          </packages>
+        </osSpecific>
+      </osSpecifics>
+
+      <commandScript>
+        <script>scripts/service_check.py</script>
+        <scriptType>PYTHON</scriptType>
+        <timeout>300</timeout>
+      </commandScript>
+
+      <configuration-dependencies>
+        <config-type>global</config-type>
+        <config-type>oozie2-site</config-type>
+      </configuration-dependencies>
+
+      <themes>
+        <theme>
+          <fileName>broken_theme.json</fileName>
+          <default>true</default>
+        </theme>
+      </themes>
+
+    </service>
+  </services>
+</metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/5f86f159/ambari-server/src/test/resources/extensions/EXT/0.4/services/OOZIE2/themes/broken_theme.json
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/resources/extensions/EXT/0.4/services/OOZIE2/themes/broken_theme.json
 
b/ambari-server/src/test/resources/extensions/EXT/0.4/services/OOZIE2/themes/broken_theme.json
new file mode 100644
index 0000000..6e8b5bf
--- /dev/null
+++ 
b/ambari-server/src/test/resources/extensions/EXT/0.4/services/OOZIE2/themes/broken_theme.json
@@ -0,0 +1,3 @@
+{
+  "configuration": {
+}

Reply via email to