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

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


    Properties properties = new Properties();
    properties.put("p1", "v1");

    Configuration ambariConfig = new Configuration(properties);

    ViewConfig config = ViewConfigTest.getConfig(xml);
    ViewEntity viewEntity = ViewRegistryTest.getViewEntity(config, ambariConfig, getClass().getClassLoader(), "");
    ViewRegistryTest.getViewInstanceEntity(viewEntity, config.getInstances().get(0));

    Map<Resource.Type, ViewSubResourceDefinition> resourceDefinitions = viewEntity.getResourceDefinitions();

    Assert.assertEquals(1, resourceDefinitions.size());
View Full Code Here


  private DataStoreImpl getDataStore(EntityManagerFactory entityManagerFactory,
                                     JPADynamicHelper jpaDynamicHelper,
                                     DynamicClassLoader classLoader,
                                     SchemaManager schemaManager)
      throws Exception {
    ViewConfig viewConfig = ViewConfigTest.getConfig(xml);
    ViewEntity viewDefinition = ViewEntityTest.getViewEntity(viewConfig);

    InstanceConfig instanceConfig = InstanceConfigTest.getInstanceConfigs().get(0);
    ViewInstanceEntity viewInstanceEntity = new ViewInstanceEntity(viewDefinition, instanceConfig);
View Full Code Here

  // TODO : move to ViewEntityEntity test.
  private static void setPersistenceEntities(ViewInstanceEntity viewInstanceDefinition) {
    ViewEntity viewDefinition = viewInstanceDefinition.getViewEntity();
    Collection<ViewEntityEntity> entities = new HashSet<ViewEntityEntity>();

    ViewConfig viewConfig = viewDefinition.getConfiguration();
    for (EntityConfig entityConfiguration : viewConfig.getPersistence().getEntities()) {
      ViewEntityEntity viewEntityEntity = new ViewEntityEntity();

      viewEntityEntity.setId(1L);
      viewEntityEntity.setViewName(viewDefinition.getName());
      viewEntityEntity.setViewInstanceName(viewInstanceDefinition.getName());
View Full Code Here

    event = getEvent("MyEvent", Collections.<String, String>emptyMap(), viewInstanceEntity);
    Assert.assertEquals(viewInstanceEntity, event.getViewInstanceSubject());
  }

  public static EventImpl getEvent(String id, Map<String, String> properties, String xml) throws Exception{
    ViewConfig viewConfig = ViewConfigTest.getConfig(xml);
    ViewEntity viewEntity = ViewEntityTest.getViewEntity(viewConfig);
    return new EventImpl(id, properties, viewEntity);
  }
View Full Code Here

    Properties properties = new Properties();
    properties.put("p1", "v1");

    Configuration ambariConfig = new Configuration(properties);

    ViewConfig config = ViewConfigTest.getConfig(xml_valid_instance);
    ViewEntity viewEntity = getViewEntity(config, ambariConfig, getClass().getClassLoader(), "");
    ViewInstanceEntity viewInstanceEntity = getViewInstanceEntity(viewEntity, config.getInstances().get(0));

    expect(viewInstanceDAO.merge(viewInstanceEntity)).andReturn(null);
    expect(viewInstanceDAO.findByName("MY_VIEW{1.0.0}", viewInstanceEntity.getInstanceName())).andReturn(viewInstanceEntity);

    replay(viewDAO, viewInstanceDAO);
View Full Code Here

    Properties properties = new Properties();
    properties.put("p1", "v1");

    Configuration ambariConfig = new Configuration(properties);

    ViewConfig config = ViewConfigTest.getConfig(xml_invalid_instance);
    ViewEntity viewEntity = getViewEntity(config, ambariConfig, getClass().getClassLoader(), "");
    ViewInstanceEntity viewInstanceEntity = getViewInstanceEntity(viewEntity, config.getInstances().get(0));

    replay(viewDAO, viewInstanceDAO);

    registry.addDefinition(viewEntity);
    try {
View Full Code Here

    Properties properties = new Properties();
    properties.put("p1", "v1");

    Configuration ambariConfig = new Configuration(properties);

    ViewConfig config = ViewConfigTest.getConfig(xml_valid_instance);
    ViewEntity viewEntity = getViewEntity(config, ambariConfig, getClass().getClassLoader(), "");
    ViewInstanceEntity viewInstanceEntity = getViewInstanceEntity(viewEntity, config.getInstances().get(0));
    viewInstanceEntity.setViewName("BOGUS_VIEW");

    replay(viewDAO, viewInstanceDAO);

    registry.addDefinition(viewEntity);
View Full Code Here

    Properties properties = new Properties();
    properties.put("p1", "v1");

    Configuration ambariConfig = new Configuration(properties);

    ViewConfig config = ViewConfigTest.getConfig(xml_valid_instance);
    ViewEntity viewEntity = getViewEntity(config, ambariConfig, getClass().getClassLoader(), "");
    ViewInstanceEntity viewInstanceEntity = getViewInstanceEntity(viewEntity, config.getInstances().get(0));
    ViewInstanceEntity updateInstance = getViewInstanceEntity(viewEntity, config.getInstances().get(0));

    expect(viewInstanceDAO.merge(viewInstanceEntity)).andReturn(null);
    expect(viewInstanceDAO.merge(viewInstanceEntity)).andReturn(viewInstanceEntity);
    expect(viewInstanceDAO.findByName("MY_VIEW{1.0.0}", viewInstanceEntity.getInstanceName())).andReturn(viewInstanceEntity);
View Full Code Here

    Properties properties = new Properties();
    properties.put("p1", "v1");

    Configuration ambariConfig = new Configuration(properties);

    ViewConfig config = ViewConfigTest.getConfig(xml_valid_instance);
    ViewConfig invalidConfig = ViewConfigTest.getConfig(xml_invalid_instance);
    ViewEntity viewEntity = getViewEntity(config, ambariConfig, getClass().getClassLoader(), "");
    ViewInstanceEntity viewInstanceEntity = getViewInstanceEntity(viewEntity, config.getInstances().get(0));
    ViewInstanceEntity updateInstance = getViewInstanceEntity(viewEntity, invalidConfig.getInstances().get(0));

    expect(viewInstanceDAO.merge(viewInstanceEntity)).andReturn(null);
    expect(viewInstanceDAO.findByName("MY_VIEW{1.0.0}", viewInstanceEntity.getInstanceName())).andReturn(viewInstanceEntity);

    replay(viewDAO, viewInstanceDAO);
View Full Code Here

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

  @Test
  public void testGetConfiguration() throws Exception {
    ViewConfig viewConfig = ViewConfigTest.getConfig();
    ViewEntity viewDefinition = getViewEntity(viewConfig);
    Assert.assertEquals(viewConfig, viewDefinition.getConfiguration());
  }
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.