Package org.apache.ambari.server.controller.spi

Examples of org.apache.ambari.server.controller.spi.Request


    resource.setProperty(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID, "HBASE_MASTER");
    resource.setProperty(HOST_COMPONENT_STATE_PROPERTY_ID, "STARTED");

   
    // request with an empty set should get all supported properties
    Request request = PropertyHelper.getReadRequest(Collections.<String>emptySet());

    Set<Resource> res = propertyProvider.populateResources(Collections.singleton(resource), request, null);
    Assert.assertEquals(1, res.size());
   
    Map<String, Map<String, Object>> map = res.iterator().next().getPropertiesMap();
View Full Code Here


   
    // only ask for one property
    Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>();
    temporalInfoMap.put(RM_CATEGORY_1, new TemporalInfoImpl(10L, 20L, 1L));
   
    Request  request = PropertyHelper.getReadRequest(Collections.singleton(RM_CATEGORY_1), temporalInfoMap);

    Assert.assertEquals(1, propertyProvider.populateResources(Collections.singleton(resource), request, null).size());
   
    List<String> metricsRegexes = new ArrayList<String>();
   
View Full Code Here

    for (Object[] row : testData) {
      properties.add(PropertyHelper.getPropertyId(row[0].toString(), row[1].toString()));
    }

    Request request = PropertyHelper.getReadRequest(properties, temporalInfoMap);

    Assert.assertEquals(1, propertyProvider.populateResources(Collections.singleton(resource), request, null).size());

    Map<String, Object> p = PropertyHelper.getProperties(resource);
View Full Code Here

      resource.setProperty(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID, "RESOURCEMANAGER");
     
      // only ask for one property
      Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>();
      temporalInfoMap.put(metric, new TemporalInfoImpl(10L, 20L, 1L));
      Request  request = PropertyHelper.getReadRequest(Collections.singleton(metric), temporalInfoMap);

      Assert.assertEquals(1, propertyProvider.populateResources(Collections.singleton(resource), request, null).size());
     
      Assert.assertEquals(4, PropertyHelper.getProperties(resource).size());
      Assert.assertNotNull(resource.getPropertyValue(metric));
View Full Code Here

  @Test
  public void testCreateResources() throws ResourceAlreadyExistsException, SystemException,
                                           UnsupportedPropertyException, NoSuchParentResourceException {

    Set<Map<String, Object>> setProperties = getTestProperties();
    Request request = createMock(Request.class);
    Capture<BlueprintEntity> entityCapture = new Capture<BlueprintEntity>();

    // set expectations
    expect(request.getProperties()).andReturn(setProperties);
    expect(dao.findByName(BLUEPRINT_NAME)).andReturn(null);
    dao.create(capture(entityCapture));

    replay(dao, request);
    // end expectations
View Full Code Here

  public void testCreateResources_withConfiguration() throws ResourceAlreadyExistsException, SystemException,
      UnsupportedPropertyException, NoSuchParentResourceException {

    Set<Map<String, Object>> setProperties = getTestProperties();
    setConfigurationProperties(setProperties);
    Request request = createMock(Request.class);
    Capture<BlueprintEntity> entityCapture = new Capture<BlueprintEntity>();

    // set expectations
    expect(request.getProperties()).andReturn(setProperties);
    expect(dao.findByName(BLUEPRINT_NAME)).andReturn(null);
    dao.create(capture(entityCapture));

    replay(dao, request);
    // end expectations
View Full Code Here

  }

  @Test
  public void testGetResourcesNoPredicate() throws SystemException, UnsupportedPropertyException,
                                                   NoSuchParentResourceException, NoSuchResourceException {
    Request request = createNiceMock(Request.class);

    ResourceProvider provider = createProvider();
    BlueprintEntity entity = ((BlueprintResourceProvider) provider).toEntity(
        getTestProperties().iterator().next());
View Full Code Here

  }

  @Test
  public void testGetResourcesNoPredicate_withConfiguration() throws SystemException, UnsupportedPropertyException,
      NoSuchParentResourceException, NoSuchResourceException {
    Request request = createNiceMock(Request.class);

    ResourceProvider provider = createProvider();
    Set<Map<String, Object>> testProperties = getTestProperties();
    setConfigurationProperties(testProperties);
    BlueprintEntity entity = ((BlueprintResourceProvider) provider).toEntity(
View Full Code Here

    properties.put(RequestResourceProvider.REQUEST_ID_PROPERTY_ID, "Request100");

    propertySet.add(properties);

    // create the request
    Request request = PropertyHelper.getCreateRequest(propertySet, null);

    try {
      provider.createResources(request);
      Assert.fail("Expected an UnsupportedOperationException");
    } catch (UnsupportedOperationException e) {
View Full Code Here

    propertyIds.add(RequestResourceProvider.REQUEST_ID_PROPERTY_ID);
    propertyIds.add(RequestResourceProvider.REQUEST_STATUS_PROPERTY_ID);

    Predicate predicate = new PredicateBuilder().property(RequestResourceProvider.REQUEST_ID_PROPERTY_ID).equals("100").
        toPredicate();
    Request request = PropertyHelper.getReadRequest(propertyIds);
    Set<Resource> resources = provider.getResources(request, predicate);

    Assert.assertEquals(1, resources.size());
    for (Resource resource : resources) {
      Assert.assertEquals(100L, (long) (Long) resource.getPropertyValue(RequestResourceProvider.REQUEST_ID_PROPERTY_ID));
View Full Code Here

TOP

Related Classes of org.apache.ambari.server.controller.spi.Request

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.