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

Java Group类代码示例

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

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



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

示例1: deleteAppsForGroupDeployment

import mesosphere.marathon.client.model.v2.Group; //导入依赖的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: getPolulatedGroup

import mesosphere.marathon.client.model.v2.Group; //导入依赖的package包/类
@Deprecated
// TODO remove it and use just getGroup with embed params (requires marathon client version >
// 6.0.0)
private Group getPolulatedGroup(Deployment deployment, String groupId) throws MarathonException {
  final Marathon client = getMarathonClient(deployment);
  Group group = client.getGroup(groupId);

  Collection<App> apps = Optional.ofNullable(group.getApps()).orElseGet(Collections::emptyList);

  List<App> completeInfoApps = new ArrayList<>();
  for (App app : apps) {
    completeInfoApps.add(client.getApp(app.getId()).getApp());
  }
  apps = completeInfoApps;

  group.setApps(apps);
  return group;
}
 
开发者ID:indigo-dc,项目名称:orchestrator,代码行数:19,代码来源:MarathonServiceImpl.java


示例3: getAdditionalErrorInfoInternal

import mesosphere.marathon.client.model.v2.Group; //导入依赖的package包/类
@Override
public Optional<String> getAdditionalErrorInfoInternal(DeploymentMessage deploymentMessage) {
  Deployment deployment = getDeployment(deploymentMessage);
  String groupId = deployment.getId();

  Group group = getPolulatedGroup(deployment, groupId);

  Stream<App> failedApps = Optional
      .ofNullable(group.getApps())
      .orElseGet(Collections::emptyList)
      .stream()
      .filter(app -> !this.isAppDeployed(app));

  String failedAppsMessage = failedApps
      .map(App::getLastTaskFailure)
      .filter(Objects::nonNull)
      .map(Objects::toString)
      .collect(Collectors.joining("\n"));

  if (failedAppsMessage.isEmpty()) {
    return Optional.empty();
  } else {
    return Optional.of("Some Application failed:\n" + failedAppsMessage);
  }
}
 
开发者ID:indigo-dc,项目名称:orchestrator,代码行数:26,代码来源:MarathonServiceImpl.java


示例4: deleteTopLevelGroupForDeployment

import mesosphere.marathon.client.model.v2.Group; //导入依赖的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


示例5: testCreate

import mesosphere.marathon.client.model.v2.Group; //导入依赖的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


示例6: testUpdate

import mesosphere.marathon.client.model.v2.Group; //导入依赖的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


示例7: testSingleDeployment

import mesosphere.marathon.client.model.v2.Group; //导入依赖的package包/类
public void testSingleDeployment() throws ResourceException, MarathonException {
    int originalSize = marathonClient.getApps().getApps().size();
    int appsV1 = 5;

    // Deploy v1
    replaceStrategy.deploy(resourcesSingle);

    // Check that everything was deployed correctly
    MarathonResource eurekaAppResource = resourcesSingle.get(0);
    MarathonResource configAppResource = resourcesSingle.get(1);
    MarathonResource groupResource = resourcesSingle.get(2);

    // Check apps
    assertEquals(originalSize + appsV1, marathonClient.getApps().getApps().size());
    App eurekaApp = marathonClient.getApp(eurekaAppResource.getId()).getApp();
    assertEquals(eurekaAppResource.getId(), eurekaApp.getId());
    assertEquals(new Integer(1), eurekaApp.getInstances());
    assertEquals(0.2, eurekaApp.getCpus());
    assertEquals(512.0, eurekaApp.getMem());

    App configApp = marathonClient.getApp(configAppResource.getId()).getApp();
    assertEquals(configAppResource.getId(), configApp.getId());
    assertEquals(new Integer(1), configApp.getInstances());
    assertEquals(0.2, configApp.getCpus());
    assertEquals(512.0, configApp.getMem());

    // Check group
    Group group = marathonClient.getGroup(groupResource.getId());
    assertEquals(groupResource.getId(), group.getId());
    assertEquals(1, group.getApps().size());
    assertEquals(1, group.getGroups().size());
}
 
开发者ID:qaware,项目名称:gradle-cloud-deployer,代码行数:33,代码来源:MarathonReplaceStrategyIntegrationTest.java


示例8: testSingleDeployment

import mesosphere.marathon.client.model.v2.Group; //导入依赖的package包/类
@Test
public void testSingleDeployment() throws ResourceException, MarathonException {
    int originalSize = marathonClient.getApps().getApps().size();
    int appsV1 = 5;

    // Deploy v1
    updateStrategy.deploy(resourcesSingle);

    // Check that everything was deployed correctly
    MarathonResource eurekaAppResource = resourcesSingle.get(0);
    MarathonResource configAppResource = resourcesSingle.get(1);
    MarathonResource groupResource = resourcesSingle.get(2);

    // Check apps
    assertEquals(originalSize + appsV1, marathonClient.getApps().getApps().size());
    App eurekaApp = marathonClient.getApp(eurekaAppResource.getId()).getApp();
    assertEquals(eurekaAppResource.getId(), eurekaApp.getId());
    assertEquals(new Integer(1), eurekaApp.getInstances());
    assertEquals(0.2, eurekaApp.getCpus());
    assertEquals(512.0, eurekaApp.getMem());

    App configApp = marathonClient.getApp(configAppResource.getId()).getApp();
    assertEquals(configAppResource.getId(), configApp.getId());
    assertEquals(new Integer(1), configApp.getInstances());
    assertEquals(0.2, configApp.getCpus());
    assertEquals(512.0, configApp.getMem());

    // Check group
    Group group = marathonClient.getGroup(groupResource.getId());
    assertEquals(groupResource.getId(), group.getId());
    assertEquals(1, group.getApps().size());
    assertEquals(1, group.getGroups().size());
}
 
开发者ID:qaware,项目名称:gradle-cloud-deployer,代码行数:34,代码来源:MarathonUpdateStrategyIntegrationTest.java


示例9: deployGroup

import mesosphere.marathon.client.model.v2.Group; //导入依赖的package包/类
@Override
public void deployGroup(String groupJson) {
    mesosphere.marathon.client.Marathon marathon = MarathonClient.getInstance(getMarathonEndpoint());
    try {
        Group group = constructGroup(groupJson);
        marathon.createGroup(group);
    } catch (Exception e) {
        throw new MinimesosException("Marathon did not accept the app, error: " + e.toString(), e);
    }
    LOGGER.debug(format("Installing group at %s", getMarathonEndpoint()));
}
 
开发者ID:ContainerSolutions,项目名称:minimesos,代码行数:12,代码来源:MarathonContainer.java


示例10: create

import mesosphere.marathon.client.model.v2.Group; //导入依赖的package包/类
/**
 * create a concrete marathon group from the template
 * @param customer Customer which this template is intended for
 * @param oldGroup current group data from marathon
 * @return
 */
public Group create(Customer customer, Group oldGroup)
{
    String json2 = templateJson.replace("{customer_id}", Integer.toString(customer.getId()));
    Group group = gson.fromJson(json2, Group.class);
    group.setId("/customer/" + customer.getId());
    merge(customer, group, oldGroup);

    return group;
}
 
开发者ID:Marmelatze,项目名称:docker-controller,代码行数:16,代码来源:GroupTemplate.java


示例11: createGroup

import mesosphere.marathon.client.model.v2.Group; //导入依赖的package包/类
protected Group createGroup(Deployment deployment) {
  ArchiveRoot ar = toscaService
      .prepareTemplate(deployment.getTemplate(), deployment.getParameters());

  Map<String, NodeTemplate> nodes = Optional
      .ofNullable(ar.getTopology())
      .map(Topology::getNodeTemplates)
      .orElseGet(HashMap::new);

  // don't check for cycles, already validated at web-service time
  DirectedMultigraph<NodeTemplate, RelationshipTemplate> graph =
      toscaService.buildNodeGraph(nodes, false);

  TopologicalOrderIterator<NodeTemplate, RelationshipTemplate> orderIterator =
      new TopologicalOrderIterator<>(graph);

  List<NodeTemplate> orderedMarathonApps = CommonUtils
      .iteratorToStream(orderIterator)
      .filter(node -> toscaService.isOfToscaType(node, ToscaConstants.Nodes.MARATHON))
      .collect(Collectors.toList());

  Group group = new Group();
  List<App> apps = new ArrayList<>();
  for (NodeTemplate marathonNode : orderedMarathonApps) {

    MarathonApp marathonTask = buildTask(graph, marathonNode, marathonNode.getName());
    List<Resource> resources = resourceRepository
        .findByToscaNodeNameAndDeployment_id(marathonNode.getName(), deployment.getId());

    resources.forEach(resource -> resource.setIaasId(marathonTask.getId()));
    marathonTask.setInstances(resources.size());

    App marathonApp = generateExternalTaskRepresentation(marathonTask);
    apps.add(marathonApp);
  }
  group.setApps(apps);
  return group;
}
 
开发者ID:indigo-dc,项目名称:orchestrator,代码行数:39,代码来源:MarathonServiceImpl.java


示例12: testCreateGroup

import mesosphere.marathon.client.model.v2.Group; //导入依赖的package包/类
@Test
public void testCreateGroup() throws IOException {
  Deployment deployment = generateDeployment();

  Assertions
      .assertThat(marathonServiceImpl.createGroup(deployment))
      .isEqualToComparingFieldByFieldRecursively(
          ModelUtils.GSON.fromJson(TestUtil.getFileContentAsString(
              ToscaServiceTest.TEMPLATES_BASE_DIR + "marathon_app.json"), Group.class));
}
 
开发者ID:indigo-dc,项目名称:orchestrator,代码行数:11,代码来源:MarathonServiceTest.java


示例13: createGroup

import mesosphere.marathon.client.model.v2.Group; //导入依赖的package包/类
@RequestLine("POST /v2/groups")
@Headers(HeaderUtils.MARATHON_API_SOURCE_HEADER)
Result createGroup(Group group) throws MarathonException;
 
开发者ID:mesosphere,项目名称:marathon-client,代码行数:4,代码来源:Marathon.java


示例14: getGroup

import mesosphere.marathon.client.model.v2.Group; //导入依赖的package包/类
@RequestLine("GET /v2/groups/{id}")
@Headers(HeaderUtils.MARATHON_API_SOURCE_HEADER)
Group getGroup(@Param("id") String id) throws MarathonException;
 
开发者ID:mesosphere,项目名称:marathon-client,代码行数:4,代码来源:Marathon.java


示例15: updateGroup

import mesosphere.marathon.client.model.v2.Group; //导入依赖的package包/类
@RequestLine("PUT /v2/groups/{id}?force={force}")
@Headers(HeaderUtils.MARATHON_API_SOURCE_HEADER)
Result updateGroup(@Param("id") String id, @Param("force") boolean force, Group group) throws MarathonException;
 
开发者ID:mesosphere,项目名称:marathon-client,代码行数:4,代码来源:Marathon.java


示例16: getGroups

import mesosphere.marathon.client.model.v2.Group; //导入依赖的package包/类
@RequestLine("GET /v2/groups")
@Headers(HeaderUtils.MARATHON_API_SOURCE_HEADER)
Group getGroups() throws DCOSException;
 
开发者ID:mesosphere,项目名称:marathon-client,代码行数:4,代码来源:DCOS.java


示例17: modifyGroup

import mesosphere.marathon.client.model.v2.Group; //导入依赖的package包/类
@RequestLine("PUT /v2/groups?force={force}")
@Headers(HeaderUtils.MARATHON_API_SOURCE_HEADER)
Result modifyGroup(@Param("force") boolean force, Group group) throws DCOSException;
 
开发者ID:mesosphere,项目名称:marathon-client,代码行数:4,代码来源:DCOS.java


示例18: createGroup

import mesosphere.marathon.client.model.v2.Group; //导入依赖的package包/类
@RequestLine("POST /v2/groups?force={force}")
@Headers(HeaderUtils.MARATHON_API_SOURCE_HEADER)
Result createGroup(@Param("force") boolean force, Group group) throws DCOSException;
 
开发者ID:mesosphere,项目名称:marathon-client,代码行数:4,代码来源:DCOS.java


示例19: modifyGroups

import mesosphere.marathon.client.model.v2.Group; //导入依赖的package包/类
@RequestLine("PUT /v2/groups/{id}?force={force}")
@Headers(HeaderUtils.MARATHON_API_SOURCE_HEADER)
Group modifyGroups(@Param("id") String id,
                   @Param("force") boolean force)
        throws DCOSException;
 
开发者ID:mesosphere,项目名称:marathon-client,代码行数:6,代码来源:DCOS.java


示例20: createGroups

import mesosphere.marathon.client.model.v2.Group; //导入依赖的package包/类
@RequestLine("POST /v2/groups/{id}?force={force}")
@Headers(HeaderUtils.MARATHON_API_SOURCE_HEADER)
Group createGroups(@Param("id") String id,
                   @Param("force") boolean force)
        throws DCOSException;
 
开发者ID:mesosphere,项目名称:marathon-client,代码行数:6,代码来源:DCOS.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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