Package org.apache.ambari.server.view.configuration

Examples of org.apache.ambari.server.view.configuration.ViewConfig


    Assert.assertEquals(viewConfig, viewDefinition.getConfiguration());
  }

  @Test
  public void testGetAmbariProperty() throws Exception {
    ViewConfig viewConfig = ViewConfigTest.getConfig();
    ViewEntity viewDefinition = getViewEntity(viewConfig);
    Assert.assertEquals("v1", viewDefinition.getAmbariProperty("p1"));
    Assert.assertEquals("v2", viewDefinition.getAmbariProperty("p2"));
    Assert.assertEquals("v3", viewDefinition.getAmbariProperty("p3"));
  }
View Full Code Here


        if (files != null) {
          for (File archiveFile : files) {
            if (!archiveFile.isDirectory()) {
              try {
                ViewConfig viewConfig = helper.getViewConfigFromArchive(archiveFile);

                String viewName    = ViewEntity.getViewName(viewConfig.getName(), viewConfig.getVersion());
                String archivePath = extractedArchivesPath + File.separator + viewName;

                // extract the archive and get the class loader
                ClassLoader cl = extractViewArchive(archiveFile, helper.getFile(archivePath));

                ViewEntity viewDefinition = installView(viewConfig, configuration, cl, archivePath);

                for (InstanceConfig instanceConfig : viewConfig.getInstances()) {
                  ViewInstanceEntity viewInstanceDefinition =
                      new ViewInstanceEntity(viewDefinition, instanceConfig);

                  for (PropertyConfig propertyConfig : instanceConfig.getProperties()) {
                    viewInstanceDefinition.putProperty(propertyConfig.getKey(), propertyConfig.getValue());
View Full Code Here

  }

  // Set the entities defined in the view persistence element for the given view instance
  private static void setPersistenceEntities(ViewInstanceEntity viewInstanceDefinition) {
    ViewEntity        viewDefinition    = viewInstanceDefinition.getViewEntity();
    ViewConfig        viewConfig        = viewDefinition.getConfiguration();

    Collection<ViewEntityEntity> entities = new HashSet<ViewEntityEntity>();

    if (viewConfig != null) {
      PersistenceConfig persistenceConfig = viewConfig.getPersistence();

      if (persistenceConfig != null) {
        for (EntityConfig entityConfiguration : persistenceConfig.getEntities()) {
          ViewEntityEntity viewEntityEntity = new ViewEntityEntity();
View Full Code Here

    Assert.assertEquals("1.0.0", viewDefinition.getVersion());
  }

  @Test
  public void testGetConfiguration() throws Exception {
    ViewConfig viewConfig = ViewConfigTest.getConfig();
    ViewDefinition viewDefinition = getViewDefinition(viewConfig);
    Assert.assertEquals(viewConfig, viewDefinition.getConfiguration());
  }
View Full Code Here

    Assert.assertEquals(viewConfig, viewDefinition.getConfiguration());
  }

  @Test
  public void testGetAmbariProperty() throws Exception {
    ViewConfig viewConfig = ViewConfigTest.getConfig();
    ViewDefinition viewDefinition = getViewDefinition(viewConfig);
    Assert.assertEquals("v1", viewDefinition.getAmbariProperty("p1"));
    Assert.assertEquals("v2", viewDefinition.getAmbariProperty("p2"));
    Assert.assertEquals("v3", viewDefinition.getAmbariProperty("p3"));
  }
View Full Code Here

            ClassLoader cl = URLClassLoader.newInstance(new URL[]{fileEntry.toURI().toURL()});

            InputStream    configStream     = cl.getResourceAsStream(VIEW_XML);
            JAXBContext    jaxbContext      = JAXBContext.newInstance(ViewConfig.class);
            Unmarshaller   jaxbUnmarshaller = jaxbContext.createUnmarshaller();
            ViewConfig     viewConfig       = (ViewConfig) jaxbUnmarshaller.unmarshal(configStream);
            ViewDefinition viewDefinition   = installView(viewConfig, configuration, cl, fileEntry.getAbsolutePath());

            List<InstanceConfig> instances = viewConfig.getInstances();

            for (InstanceConfig instanceConfig : instances) {
              instanceDefinitions.add(installViewInstance(viewDefinition, instanceConfig));
            }
          } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.apache.ambari.server.view.configuration.ViewConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.