• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MarathonException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中mesosphere.marathon.client.utils.MarathonException的典型用法代码示例。如果您正苦于以下问题:Java MarathonException类的具体用法?Java MarathonException怎么用?Java MarathonException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MarathonException类属于mesosphere.marathon.client.utils包,在下文中一共展示了MarathonException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: deleteAppsForGroupDeployment

import mesosphere.marathon.client.utils.MarathonException; //导入依赖的package包/类
private void deleteAppsForGroupDeployment(String groupId) throws MarathonException {
	Group group = marathon.getGroup(groupId);
	for (App app : group.getApps()) {
		logger.debug(String.format("Deleting application %s in group %s", app.getId(), groupId));
		marathon.deleteApp(app.getId());
	}
	group = marathon.getGroup(groupId);
	if (logger.isDebugEnabled()) {
		logger.debug(String.format("Group %s has %d applications and %d groups", group.getId(),
				group.getApps().size(), group.getGroups().size()));
	}
	if (group.getApps().size() == 0 && group.getGroups().size() == 0) {
		logger.info(String.format("Deleting group: %s", groupId));
		marathon.deleteGroup(groupId);
	}
	deleteTopLevelGroupForDeployment(groupId);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-deployer-mesos,代码行数:18,代码来源:MarathonAppDeployer.java


示例2: environmentInfo

import mesosphere.marathon.client.utils.MarathonException; //导入依赖的package包/类
@Override
public RuntimeEnvironmentInfo environmentInfo() {
	String apiVersion = "v1";
	String hostVersion = "unknown";
	String frameworkId = "unknown";
	String leader = "unknown";
	try {
		GetServerInfoResponse serverInfo = marathon.getServerInfo();
		hostVersion = serverInfo.getVersion();
		frameworkId = serverInfo.getFrameworkId();
		leader = serverInfo.getLeader();
	} catch (MarathonException ignore) {}
	return new RuntimeEnvironmentInfo.Builder()
			.spiClass(AppDeployer.class)
			.implementationName(this.getClass().getSimpleName())
			.implementationVersion(RuntimeVersionUtils.getVersion(this.getClass()))
			.platformType("Mesos")
			.platformApiVersion(apiVersion)
			.platformClientVersion(RuntimeVersionUtils.getVersion(marathon.getClass()))
			.platformHostVersion(hostVersion)
			.addPlatformSpecificInfo("leader", leader)
			.addPlatformSpecificInfo("frameworkId", frameworkId)
			.build();
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-deployer-mesos,代码行数:25,代码来源:MarathonAppDeployer.java


示例3: buildInstanceStatus

import mesosphere.marathon.client.utils.MarathonException; //导入依赖的package包/类
private AppInstanceStatus buildInstanceStatus(String id) throws MarathonException {
	App appInstance = marathon.getApp(id).getApp();
	logger.debug("Deployment " + id + " has " + appInstance.getTasksRunning() + "/" + appInstance.getInstances() + " tasks running");
	if (appInstance.getTasks() != null) {
		// there should only be one task for this type of deployment
		MarathonAppInstanceStatus status = null;
		for (Task task : appInstance.getTasks()) {
			if (status == null) {
				status = MarathonAppInstanceStatus.up(appInstance, task);
			}
		}
		if (status == null) {
			status = MarathonAppInstanceStatus.down(appInstance);
		}
		return status;
	}
	else {
		return MarathonAppInstanceStatus.down(appInstance);
	}
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-deployer-mesos,代码行数:21,代码来源:MarathonAppDeployer.java


示例4: testExists

import mesosphere.marathon.client.utils.MarathonException; //导入依赖的package包/类
public void testExists() throws ResourceException, MarathonException {

        // Check that the group doesn't exist already
        assertNotFound();

        // Test exists method
        assertFalse(groupResourceV1.exists());

        // Create group
        groupResourceV1.create();

        // Check that the group exists
        assertExists();

        // Test exists method
        assertTrue(groupResourceV1.exists());
    }
 
开发者ID:qaware,项目名称:gradle-cloud-deployer,代码行数:18,代码来源:GroupResourceIntegrationTest.java


示例5: testExists

import mesosphere.marathon.client.utils.MarathonException; //导入依赖的package包/类
public void testExists() throws ResourceException, MarathonException {

        // Check that the app doesn't exist already
        assertNotFound();

        // Test exists method
        assertFalse(appResourceV1.exists());

        // Create app
        appResourceV1.create();

        // Check that the app exists
        assertExists();

        // Test exists method
        assertTrue(appResourceV1.exists());
    }
 
开发者ID:qaware,项目名称:gradle-cloud-deployer,代码行数:18,代码来源:AppResourceIntegrationTest.java


示例6: execute

import mesosphere.marathon.client.utils.MarathonException; //导入依赖的package包/类
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    final Marathon marathon = MarathonClient.getInstance(marathonHost);
    App app = readApp(finalMarathonConfigFile);
    getLog().info("deploying Marathon config for " + app.getId()
            + " from " + finalMarathonConfigFile + " to " + marathonHost);
    if (appExists(marathon, app.getId())) {
        getLog().info(app.getId() + " already exists - will be updated");
        updateApp(marathon, app);
    } else {
        getLog().info(app.getId() + " does not exist yet - will be created");
        app = createApp(marathon, app);
    }

    if (waitForDeploymentFinished) {
        try {
            waitForApp(marathon, app);
        } catch (MarathonException e) {
            throw new MojoExecutionException("error waiting for app", e);
        }
    }
}
 
开发者ID:holidaycheck,项目名称:marathon-maven-plugin,代码行数:23,代码来源:DeployMojo.java


示例7: testDeployFailedDueToFailedAppStatusCheck

import mesosphere.marathon.client.utils.MarathonException; //导入依赖的package包/类
@Test
public void testDeployFailedDueToFailedAppStatusCheck() throws Exception {
    server.enqueue(new MockResponse().setResponseCode(500));
    thrown.expect(MojoExecutionException.class);
    thrown.expectCause(isA(MarathonException.class));

    final DeployMojo mojo = lookupDeployMojo();
    assertNotNull(mojo);

    mojo.execute();

    assertEquals(1, server.getRequestCount());

    RecordedRequest getAppRequest = server.takeRequest();
    assertEquals(MARATHON_PATH + APP_ID, getAppRequest.getPath());
    assertEquals("GET", getAppRequest.getMethod());
}
 
开发者ID:holidaycheck,项目名称:marathon-maven-plugin,代码行数:18,代码来源:DeployMojoTest.java


示例8: testDeployFailedDueToFailedAppCreation

import mesosphere.marathon.client.utils.MarathonException; //导入依赖的package包/类
@Test
public void testDeployFailedDueToFailedAppCreation() throws Exception {
    server.enqueue(new MockResponse().setResponseCode(200));
    server.enqueue(new MockResponse().setResponseCode(500));
    thrown.expect(MojoExecutionException.class);
    thrown.expectCause(isA(MarathonException.class));

    final DeployMojo mojo = lookupDeployMojo();
    assertNotNull(mojo);

    mojo.execute();

    assertEquals(2, server.getRequestCount());

    RecordedRequest getAppRequest = server.takeRequest();
    assertEquals(MARATHON_PATH + APP_ID, getAppRequest.getPath());
    assertEquals("GET", getAppRequest.getMethod());

    RecordedRequest createAppRequest = server.takeRequest();
    assertEquals(MARATHON_PATH, createAppRequest.getPath());
    assertEquals("POST", createAppRequest.getMethod());
}
 
开发者ID:holidaycheck,项目名称:marathon-maven-plugin,代码行数:23,代码来源:DeployMojoTest.java


示例9: testDeployFailedDueToFailedAppUpdate

import mesosphere.marathon.client.utils.MarathonException; //导入依赖的package包/类
@Test
public void testDeployFailedDueToFailedAppUpdate() throws Exception {
    server.enqueue(new MockResponse().setResponseCode(404));
    server.enqueue(new MockResponse().setResponseCode(500));
    thrown.expect(MojoExecutionException.class);
    thrown.expectCause(isA(MarathonException.class));

    final DeployMojo mojo = lookupDeployMojo();
    assertNotNull(mojo);

    mojo.execute();

    assertEquals(2, server.getRequestCount());

    RecordedRequest getAppRequest = server.takeRequest();
    assertEquals(MARATHON_PATH + APP_ID, getAppRequest.getPath());
    assertEquals("GET", getAppRequest.getMethod());

    RecordedRequest updateAppRequest = server.takeRequest();
    assertEquals(MARATHON_PATH + APP_ID + "?force=true", updateAppRequest.getPath());
    assertEquals("PUT", updateAppRequest.getMethod());
}
 
开发者ID:holidaycheck,项目名称:marathon-maven-plugin,代码行数:23,代码来源:DeployMojoTest.java


示例10: getApps

import mesosphere.marathon.client.utils.MarathonException; //导入依赖的package包/类
public List<App> getApps() {
  try {
    GetAppsResponse appsResponse = marathon.getApps();
    return appsResponse.getApps();
  } catch (MarathonException e) {
    logger.error("Error trying to get Apps from Marathon.", e);
    return Collections.emptyList();
  }
}
 
开发者ID:ecg-mechaniker,项目名称:mechaniker,代码行数:10,代码来源:MarathonService.java


示例11: putApp

import mesosphere.marathon.client.utils.MarathonException; //导入依赖的package包/类
/**
 * Update an existing app.
 *
 * @return A deploymentId with information about the started deployment
 */
public Optional<String> putApp(App app) {
  String id = app.getId();
  try {
    Result result = marathon.updateApp(id, app, false);
    return Optional.of(result.getDeploymentId());
  } catch (MarathonException e) {
    logger.error("Error updating app {}", id, e.getMessage());
  }

  return Optional.empty();
}
 
开发者ID:ecg-mechaniker,项目名称:mechaniker,代码行数:17,代码来源:MarathonService.java


示例12: deleteTopLevelGroupForDeployment

import mesosphere.marathon.client.utils.MarathonException; //导入依赖的package包/类
private void deleteTopLevelGroupForDeployment(String id) throws MarathonException {
	String topLevelGroupId = extractGroupId(id);
	if (topLevelGroupId != null) {
		Group topGroup = marathon.getGroup(topLevelGroupId);
		if (logger.isDebugEnabled()) {
			logger.debug(String.format("Top level group %s has %d applications and %d groups", topGroup.getId(),
					topGroup.getApps().size(), topGroup.getGroups().size()));
		}
		if (topGroup.getApps().size() == 0 && topGroup.getGroups().size() == 0) {
			logger.info(String.format("Deleting group: %s", topLevelGroupId));
			marathon.deleteGroup(topLevelGroupId);
		}
	}
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-deployer-mesos,代码行数:15,代码来源:MarathonAppDeployer.java


示例13: testDeployAll

import mesosphere.marathon.client.utils.MarathonException; //导入依赖的package包/类
@Test
public void testDeployAll() throws MarathonException {
    String task = "deployAll";
    BuildResult result = executeTask(TEST_CONFIG_DIR, task);

    assertEquals(result.task(":" + task).getOutcome(), SUCCESS);
    checkEnvironment(APP_ONE);
    checkEnvironment(APP_TWO);
}
 
开发者ID:qaware,项目名称:gradle-cloud-deployer,代码行数:10,代码来源:MarathonDeployerIntegrationTest.java


示例14: testDeploy

import mesosphere.marathon.client.utils.MarathonException; //导入依赖的package包/类
@Test
public void testDeploy() throws MarathonException {
    String task = "deploy";
    String params = "--environmentId=" + ENVIRONMENT_ONE;
    BuildResult result = executeTask(TEST_CONFIG_DIR, task, params);

    assertEquals(result.task(":" + task).getOutcome(), SUCCESS);
    checkEnvironment(APP_ONE);
    checkEmptyEnvironment(APP_TWO);
}
 
开发者ID:qaware,项目名称:gradle-cloud-deployer,代码行数:11,代码来源:MarathonDeployerIntegrationTest.java


示例15: testDelete

import mesosphere.marathon.client.utils.MarathonException; //导入依赖的package包/类
@Test
public void testDelete() throws MarathonException {
    String deployTask = "deployAll";
    executeTask(TEST_CONFIG_DIR, deployTask);

    String deleteTask = "delete";
    String params = "--environmentId=" + ENVIRONMENT_ONE;
    BuildResult result = executeTask(TEST_CONFIG_DIR, deleteTask, params);
    assertEquals(result.task(":" + deleteTask).getOutcome(), SUCCESS);
    checkEmptyEnvironment(APP_ONE);
    checkEnvironment(APP_TWO);
}
 
开发者ID:qaware,项目名称:gradle-cloud-deployer,代码行数:13,代码来源:MarathonDeployerIntegrationTest.java


示例16: checkEmptyEnvironment

import mesosphere.marathon.client.utils.MarathonException; //导入依赖的package包/类
private void checkEmptyEnvironment(String appName) {
    boolean exceptionThrown = false;
    try {
        marathonClient.getApp(appName).getApp();
    } catch (MarathonException e) {
        assertEquals("Not Found (http status: 404)", e.getMessage());
        exceptionThrown = true;
    }
    assertTrue(exceptionThrown);
}
 
开发者ID:qaware,项目名称:gradle-cloud-deployer,代码行数:11,代码来源:MarathonDeployerIntegrationTest.java


示例17: testCreate

import mesosphere.marathon.client.utils.MarathonException; //导入依赖的package包/类
public void testCreate() throws ResourceException, InterruptedException, MarathonException {

        // Check that the group doesn't exist already
        assertNotFound();

        // Create group
        groupResourceV1.create();

        // Check that the group exists
        Group group = assertExists();

        // Compare group ids
        assertEquals(group.getId(), groupResourceV1.getId());
    }
 
开发者ID:qaware,项目名称:gradle-cloud-deployer,代码行数:15,代码来源:GroupResourceIntegrationTest.java


示例18: testDelete

import mesosphere.marathon.client.utils.MarathonException; //导入依赖的package包/类
public void testDelete() throws ResourceException, MarathonException, InterruptedException {

        // Create group
        groupResourceV1.create();

        // Check that the group exists
        assertExists();

        // Delete group
        groupResourceV1.delete();

        // Check that group doesn't exist anymore
        assertNotFound();
    }
 
开发者ID:qaware,项目名称:gradle-cloud-deployer,代码行数:15,代码来源:GroupResourceIntegrationTest.java


示例19: testUpdate

import mesosphere.marathon.client.utils.MarathonException; //导入依赖的package包/类
public void testUpdate() throws MarathonException, ResourceException {

        // Create group
        groupResourceV1.create();

        // Check that the group exists
        assertExists();

        // Update the group
        groupResourceV2.update();

        // Check that the group was updated correctly
        Group group = marathonClient.getGroup(groupResourceV1.getId());

        // Check app
        assertEquals(1, group.getApps().size());
        App app = group.getApps().toArray(new App[1])[0];
        assertEquals(new Integer(1), app.getInstances());
        assertEquals(1, group.getGroups().size());

        // Check subgroup
        Group subGroup = group.getGroups().toArray(new Group[1])[0];
        assertEquals(2, subGroup.getApps().size());
        App[] subGroupApps = subGroup.getApps().toArray(new App[2]);
        App subGroupApp1 = subGroupApps[0];
        assertEquals(new Integer(1), subGroupApp1.getInstances());
        App subGroupApp2 = subGroupApps[0];
        assertEquals(new Integer(1), subGroupApp2.getInstances());
    }
 
开发者ID:qaware,项目名称:gradle-cloud-deployer,代码行数:30,代码来源:GroupResourceIntegrationTest.java


示例20: assertNotFound

import mesosphere.marathon.client.utils.MarathonException; //导入依赖的package包/类
private void assertNotFound() {
    boolean exceptionThrown = false;
    try {
        marathonClient.getGroup(groupResourceV1.getId());
    } catch (MarathonException e) {
        exceptionThrown = true;
        assertTrue(e.getMessage().contains("404"));
    }
    assertTrue(exceptionThrown);
}
 
开发者ID:qaware,项目名称:gradle-cloud-deployer,代码行数:11,代码来源:GroupResourceIntegrationTest.java



注:本文中的mesosphere.marathon.client.utils.MarathonException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ShadowLocationManager类代码示例发布时间:2022-05-23
下一篇:
Java BaseOperator类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap