當前位置: 首頁>>代碼示例>>Java>>正文


Java Cluster類代碼示例

本文整理匯總了Java中com.amazonaws.services.elasticmapreduce.model.Cluster的典型用法代碼示例。如果您正苦於以下問題:Java Cluster類的具體用法?Java Cluster怎麽用?Java Cluster使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Cluster類屬於com.amazonaws.services.elasticmapreduce.model包,在下文中一共展示了Cluster類的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getEmrClusterById

import com.amazonaws.services.elasticmapreduce.model.Cluster; //導入依賴的package包/類
@Override
public Cluster getEmrClusterById(String clusterId, AwsParamsDto awsParams)
{
    Cluster cluster = null;
    if (StringUtils.isNotBlank(clusterId))
    {
        DescribeClusterResult describeClusterResult =
            emrOperations.describeClusterRequest(getEmrClient(awsParams), new DescribeClusterRequest().withClusterId(clusterId));
        if (describeClusterResult != null && describeClusterResult.getCluster() != null)
        {
            cluster = describeClusterResult.getCluster();
        }
    }

    return cluster;
}
 
開發者ID:FINRAOS,項目名稱:herd,代碼行數:17,代碼來源:EmrDaoImpl.java

示例2: mock

import com.amazonaws.services.elasticmapreduce.model.Cluster; //導入依賴的package包/類
@Test
public void testGetActiveEmrClusterIdAssertReturnActualClusterIdWhenClusterIdSpecifiedAndClusterStateActiveAndNameMatch()
{
    EmrDao originalEmrDao = emrHelper.getEmrDao();
    EmrDao mockEmrDao = mock(EmrDao.class);
    emrHelper.setEmrDao(mockEmrDao);

    try
    {
        String emrClusterId = "emrClusterId";
        String emrClusterName = "emrClusterName";
        String expectedEmrClusterId = "expectedEmrClusterId";

        when(mockEmrDao.getEmrClusterById(any(), any())).thenReturn(
            new Cluster().withId(expectedEmrClusterId).withName(emrClusterName).withStatus(new ClusterStatus().withState(ClusterState.RUNNING)));

        assertEquals(expectedEmrClusterId, emrHelper.getActiveEmrClusterId(emrClusterId, emrClusterName, null));

        verify(mockEmrDao).getEmrClusterById(eq(emrClusterId.trim()), any());
        verifyNoMoreInteractions(mockEmrDao);
    }
    finally
    {
        emrHelper.setEmrDao(originalEmrDao);
    }
}
 
開發者ID:FINRAOS,項目名稱:herd,代碼行數:27,代碼來源:EmrHelperTest.java

示例3: clusterExists

import com.amazonaws.services.elasticmapreduce.model.Cluster; //導入依賴的package包/類
/**
 * Helper method to determine if an Amazon EMR cluster exists
 * 
 * @param client
 *        The {@link AmazonElasticMapReduceClient} with read permissions
 * @param clusterIdentifier
 *        The Amazon EMR cluster to check
 * @return true if the Amazon EMR cluster exists, otherwise false
 */
public static boolean clusterExists(AmazonElasticMapReduce client, String clusterIdentifier) {
	if (clusterIdentifier != null && !clusterIdentifier.isEmpty()) {
		ListClustersResult clustersList = client.listClusters();
		ListIterator<ClusterSummary> iterator = clustersList.getClusters().listIterator();
		ClusterSummary summary;
		for (summary = iterator.next() ; iterator.hasNext();summary = iterator.next()) {
			if (summary.getId().equals(clusterIdentifier)) {
				DescribeClusterRequest describeClusterRequest = new DescribeClusterRequest().withClusterId(clusterIdentifier);	
				DescribeClusterResult result = client.describeCluster(describeClusterRequest);	
				if (result != null) {
					Cluster cluster = result.getCluster();
					//check if HBase is installed on this cluster
					if (isHBaseInstalled(client, cluster.getId())) return false;
					String state = cluster.getStatus().getState();
					LOG.info(clusterIdentifier + " is " + state + ". ");
					if (state.equalsIgnoreCase("RUNNING") ||state.equalsIgnoreCase("WAITING"))	{
						LOG.info("The cluster with id " + clusterIdentifier + " exists and is " + state);   
						return true;
					}
				}
			}		
		}					
	}
	LOG.info("The cluster with id " + clusterIdentifier + " does not exist");
	return false;  
}
 
開發者ID:awslabs,項目名稱:aws-big-data-blog,代碼行數:36,代碼來源:EMRUtils.java

示例4: testGetEmrClusterByIdNull

import com.amazonaws.services.elasticmapreduce.model.Cluster; //導入依賴的package包/類
@Test
public void testGetEmrClusterByIdNull() throws Exception
{
    Cluster cluster = emrDao.getEmrClusterById(null, null);

    assertNull(cluster);
}
 
開發者ID:FINRAOS,項目名稱:herd,代碼行數:8,代碼來源:EmrHelperTest.java

示例5: getEmrClusterStatusById

import com.amazonaws.services.elasticmapreduce.model.Cluster; //導入依賴的package包/類
@Override
public String getEmrClusterStatusById(String clusterId, AwsParamsDto awsParams)
{
    Cluster cluster = getEmrClusterById(clusterId, awsParams);

    return ((cluster == null) ? null : cluster.getStatus().getState());
}
 
開發者ID:FINRAOS,項目名稱:herd,代碼行數:8,代碼來源:EmrDaoImpl.java

示例6: testGetActiveEmrClusterIdAssertErrorWhenClusterIdSpecifiedAndNameMismatch

import com.amazonaws.services.elasticmapreduce.model.Cluster; //導入依賴的package包/類
@Test
public void testGetActiveEmrClusterIdAssertErrorWhenClusterIdSpecifiedAndNameMismatch()
{
    EmrDao originalEmrDao = emrHelper.getEmrDao();
    EmrDao mockEmrDao = mock(EmrDao.class);
    emrHelper.setEmrDao(mockEmrDao);

    try
    {
        String emrClusterId = "emrClusterId";
        String emrClusterName = "emrClusterName";
        String expectedEmrClusterId = "expectedEmrClusterId";
        String actualEmrClusterName = "actualEmrClusterName";

        when(mockEmrDao.getEmrClusterById(any(), any())).thenReturn(
            new Cluster().withId(expectedEmrClusterId).withName(actualEmrClusterName).withStatus(new ClusterStatus().withState(ClusterState.RUNNING)));

        try
        {
            emrHelper.getActiveEmrClusterId(emrClusterId, emrClusterName, null);
            fail();
        }
        catch (IllegalArgumentException e)
        {
            assertEquals(String
                .format("The cluster with ID \"%s\" does not match the expected name \"%s\". The actual name is \"%s\".", expectedEmrClusterId,
                    emrClusterName, actualEmrClusterName), e.getMessage());
        }

        verify(mockEmrDao).getEmrClusterById(eq(emrClusterId.trim()), any());
        verifyNoMoreInteractions(mockEmrDao);
    }
    finally
    {
        emrHelper.setEmrDao(originalEmrDao);
    }
}
 
開發者ID:FINRAOS,項目名稱:herd,代碼行數:38,代碼來源:EmrHelperTest.java

示例7: testGetActiveEmrClusterIdAssertReturnActualClusterIdWhenClusterStateActiveAndNameNotSpecified

import com.amazonaws.services.elasticmapreduce.model.Cluster; //導入依賴的package包/類
@Test
public void testGetActiveEmrClusterIdAssertReturnActualClusterIdWhenClusterStateActiveAndNameNotSpecified()
{
    EmrDao originalEmrDao = emrHelper.getEmrDao();
    EmrDao mockEmrDao = mock(EmrDao.class);
    emrHelper.setEmrDao(mockEmrDao);

    try
    {
        String emrClusterId = "emrClusterId";
        String emrClusterName = null;
        String expectedEmrClusterId = "expectedEmrClusterId";
        String actualEmrClusterName = "actualEmrClusterName";

        when(mockEmrDao.getEmrClusterById(any(), any())).thenReturn(
            new Cluster().withId(expectedEmrClusterId).withName(actualEmrClusterName).withStatus(new ClusterStatus().withState(ClusterState.RUNNING)));

        assertEquals(expectedEmrClusterId, emrHelper.getActiveEmrClusterId(emrClusterId, emrClusterName, null));

        verify(mockEmrDao).getEmrClusterById(eq(emrClusterId), any());
        verifyNoMoreInteractions(mockEmrDao);
    }
    finally
    {
        emrHelper.setEmrDao(originalEmrDao);
    }
}
 
開發者ID:FINRAOS,項目名稱:herd,代碼行數:28,代碼來源:EmrHelperTest.java

示例8: testGetActiveEmrClusterIdAssertErrorWhenClusterIdSpecifiedAndClusterStateNotActive

import com.amazonaws.services.elasticmapreduce.model.Cluster; //導入依賴的package包/類
@Test
public void testGetActiveEmrClusterIdAssertErrorWhenClusterIdSpecifiedAndClusterStateNotActive()
{
    EmrDao originalEmrDao = emrHelper.getEmrDao();
    EmrDao mockEmrDao = mock(EmrDao.class);
    emrHelper.setEmrDao(mockEmrDao);

    try
    {
        String emrClusterId = "emrClusterId";
        String emrClusterName = "emrClusterName";
        String expectedEmrClusterId = "expectedEmrClusterId";

        ClusterState actualClusterState = ClusterState.TERMINATED;
        when(mockEmrDao.getEmrClusterById(any(), any()))
            .thenReturn(new Cluster().withId(expectedEmrClusterId).withName(emrClusterName).withStatus(new ClusterStatus().withState(actualClusterState)));

        try
        {
            emrHelper.getActiveEmrClusterId(emrClusterId, emrClusterName, null);
            fail();
        }
        catch (IllegalArgumentException e)
        {
            assertEquals(String.format("The cluster with ID \"%s\" is not active. The cluster state must be in one of [STARTING, BOOTSTRAPPING, RUNNING, " +
                "WAITING]. Current state is \"%s\"", emrClusterId, actualClusterState), e.getMessage());
        }

        verify(mockEmrDao).getEmrClusterById(eq(emrClusterId), any());
        verifyNoMoreInteractions(mockEmrDao);
    }
    finally
    {
        emrHelper.setEmrDao(originalEmrDao);
    }
}
 
開發者ID:FINRAOS,項目名稱:herd,代碼行數:37,代碼來源:EmrHelperTest.java

示例9: testGetActiveEmrClusterIdAssertParametersTrimmed

import com.amazonaws.services.elasticmapreduce.model.Cluster; //導入依賴的package包/類
@Test
public void testGetActiveEmrClusterIdAssertParametersTrimmed()
{
    EmrDao originalEmrDao = emrHelper.getEmrDao();
    EmrDao mockEmrDao = mock(EmrDao.class);
    emrHelper.setEmrDao(mockEmrDao);

    try
    {
        String emrClusterId = "emrClusterId";
        String emrClusterName = "emrClusterName";
        String expectedEmrClusterId = "expectedEmrClusterId";

        when(mockEmrDao.getEmrClusterById(any(), any())).thenReturn(
            new Cluster().withId(expectedEmrClusterId).withName(emrClusterName).withStatus(new ClusterStatus().withState(ClusterState.RUNNING)));

        assertEquals(expectedEmrClusterId,
            emrHelper.getActiveEmrClusterId(StringUtils.wrap(emrClusterId, BLANK_TEXT), StringUtils.wrap(emrClusterName, BLANK_TEXT), null));

        verify(mockEmrDao).getEmrClusterById(eq(emrClusterId.trim()), any());
        verifyNoMoreInteractions(mockEmrDao);
    }
    finally
    {
        emrHelper.setEmrDao(originalEmrDao);
    }
}
 
開發者ID:FINRAOS,項目名稱:herd,代碼行數:28,代碼來源:EmrHelperTest.java

示例10: testGetActiveEmrClusterIdAssertParametersCaseIgnored

import com.amazonaws.services.elasticmapreduce.model.Cluster; //導入依賴的package包/類
@Test
public void testGetActiveEmrClusterIdAssertParametersCaseIgnored()
{
    EmrDao originalEmrDao = emrHelper.getEmrDao();
    EmrDao mockEmrDao = mock(EmrDao.class);
    emrHelper.setEmrDao(mockEmrDao);

    try
    {
        String emrClusterId = "emrClusterId";
        String emrClusterName = "emrClusterName";
        String expectedEmrClusterId = "expectedEmrClusterId";

        when(mockEmrDao.getEmrClusterById(any(), any())).thenReturn(
            new Cluster().withId(expectedEmrClusterId).withName(emrClusterName).withStatus(new ClusterStatus().withState(ClusterState.RUNNING)));

        assertEquals(expectedEmrClusterId,
            emrHelper.getActiveEmrClusterId(StringUtils.upperCase(emrClusterId), StringUtils.upperCase(emrClusterName), null));

        verify(mockEmrDao).getEmrClusterById(eq(StringUtils.upperCase(emrClusterId)), any());
        verifyNoMoreInteractions(mockEmrDao);
    }
    finally
    {
        emrHelper.setEmrDao(originalEmrDao);
    }
}
 
開發者ID:FINRAOS,項目名稱:herd,代碼行數:28,代碼來源:EmrHelperTest.java

示例11: getEmrClusterById

import com.amazonaws.services.elasticmapreduce.model.Cluster; //導入依賴的package包/類
/**
 * Get EMR cluster by cluster Id.
 *
 * @param clusterId the job Id returned by EMR for the cluster.
 * @param awsParams AWS related parameters for access/secret keys and proxy details.
 *
 * @return the cluster status.
 */
public Cluster getEmrClusterById(String clusterId, AwsParamsDto awsParams);
 
開發者ID:FINRAOS,項目名稱:herd,代碼行數:10,代碼來源:EmrDao.java


注:本文中的com.amazonaws.services.elasticmapreduce.model.Cluster類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。