本文整理汇总了Java中org.springframework.boot.actuate.info.Info类的典型用法代码示例。如果您正苦于以下问题:Java Info类的具体用法?Java Info怎么用?Java Info使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Info类属于org.springframework.boot.actuate.info包,在下文中一共展示了Info类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: shouldAddBuildInfoToBuilder
import org.springframework.boot.actuate.info.Info; //导入依赖的package包/类
@Test
public void shouldAddBuildInfoToBuilder() throws Exception {
DmBuildInfo dmBuildInfo = new DmBuildInfo("name","env","project");
Info.Builder builder = new Info.Builder();
dmBuildInfo.contribute(builder);
Map<String,Object> buildInfo = new HashMap<>();
buildInfo.put("environment", "env");
buildInfo.put("project", "project");
buildInfo.put("name", "name");
buildInfo.put("version", "unknown");
buildInfo.put("date", "unknown");
buildInfo.put("commit", "unknown");
buildInfo.put("extra", Collections.EMPTY_MAP);
Map<String,Object> map = new HashMap<>();
map.put("buildInfo",buildInfo);
Info info = builder.build();
assertThat(info.getDetails(), CoreMatchers.equalTo(map));
}
开发者ID:hmcts,项目名称:document-management-store-app,代码行数:25,代码来源:DmBuildInfoTest.java
示例2: shouldAddBuildInfoToBuilderNullBuildInfo
import org.springframework.boot.actuate.info.Info; //导入依赖的package包/类
@Test
public void shouldAddBuildInfoToBuilderNullBuildInfo() throws Exception {
DmBuildInfo dmBuildInfo = new DmBuildInfo("name","env","project",null);
Info.Builder builder = new Info.Builder();
dmBuildInfo.contribute(builder);
Map<String,Object> buildInfo = new HashMap<>();
buildInfo.put("environment", "env");
buildInfo.put("project", "project");
buildInfo.put("name", "name");
buildInfo.put("version", "unknown");
buildInfo.put("date", "unknown");
buildInfo.put("commit", "unknown");
buildInfo.put("extra", Collections.EMPTY_MAP);
Map<String,Object> map = new HashMap<>();
map.put("buildInfo",buildInfo);
Info info = builder.build();
assertThat(info.getDetails(), CoreMatchers.equalTo(map));
}
开发者ID:hmcts,项目名称:document-management-store-app,代码行数:24,代码来源:DmBuildInfoTest.java
示例3: shouldAddBuildInfoToBuilderIncludesBuildNumber
import org.springframework.boot.actuate.info.Info; //导入依赖的package包/类
@Test
public void shouldAddBuildInfoToBuilderIncludesBuildNumber() throws Exception {
DmBuildInfo dmBuildInfo = new DmBuildInfo("name","env","project",BUILD_INFO_WITH_BUILD_NO);
Info.Builder builder = new Info.Builder();
dmBuildInfo.contribute(builder);
Map<String,Object> buildInfo = new HashMap<>();
buildInfo.put("environment", "env");
buildInfo.put("project", "project");
buildInfo.put("name", "name");
buildInfo.put("version", "1.0-42");
buildInfo.put("date", "today");
buildInfo.put("commit", "aaaaaaa");
buildInfo.put("extra", Collections.EMPTY_MAP);
Map<String,Object> map = new HashMap<>();
map.put("buildInfo",buildInfo);
Info info = builder.build();
assertThat(info.getDetails(), CoreMatchers.equalTo(map));
}
开发者ID:hmcts,项目名称:document-management-store-app,代码行数:24,代码来源:DmBuildInfoTest.java
示例4: contribute
import org.springframework.boot.actuate.info.Info; //导入依赖的package包/类
@Override
public void contribute(Info.Builder builder) {
Map<String, String> asgNames = new HashMap<String, String>();
asgNames.put("author-dispatcher", envValues.getAutoScaleGroupNameForAuthorDispatcher());
asgNames.put("publish", envValues.getAutoScaleGroupNameForPublish());
asgNames.put("publish-dispatcher", envValues.getAutoScaleGroupNameForPublishDispatcher());
builder.withDetail("auto-scaling-group-names", asgNames);
Map<String, String> authorInfo = new HashMap<String, String>();
authorInfo.put("elastic-load-balancer-name", envValues.getElasticLoadBalancerNameForAuthor());
authorInfo.put("elastic-load-balancer-dns", envValues.getElasticLoadBalancerAuthorDns());
builder.withDetail("author", authorInfo);
builder.withDetail("alarm-notification-topic-arn", envValues.getTopicArn());
}
开发者ID:shinesolutions,项目名称:aem-orchestrator,代码行数:18,代码来源:InfoActuator.java
示例5: contribute
import org.springframework.boot.actuate.info.Info; //导入依赖的package包/类
@Override
public void contribute(Info.Builder builder) {
InetAddress ip = null;
Map<String, String> hostMap = new HashMap<>();
try {
ip = InetAddress.getLocalHost();
} catch (UnknownHostException e) {
e.printStackTrace();
}
hostMap.put("ipAddress", ip.getHostAddress());
hostMap.put("hostname", ip.getHostName());
builder.withDetail("appHostInfo", hostMap);
hostMap = new HashMap<>();
CommandResult commandResult = this.mongoTemplate.executeCommand("{ serverStatus: 1 }");
hostMap.put("hostname", commandResult.getString("host"));
builder.withDetail("mongoDbHostInfo", hostMap);
}
开发者ID:ThoughtWorksInc,项目名称:voter-service,代码行数:20,代码来源:HostInfoContributor.java
示例6: contribute
import org.springframework.boot.actuate.info.Info; //导入依赖的package包/类
@Override
public void contribute(Info.Builder builder) {
Map<String, Object> details = new LinkedHashMap<>();
metadataProvider.get().getConfiguration().getEnv().getBoms().forEach((k, v) -> {
if (v.getMappings() != null && !v.getMappings().isEmpty()) {
Map<String, Object> bom = new LinkedHashMap<>();
v.getMappings().forEach(it -> {
String requirement = "Spring Boot " + it.determineVersionRangeRequirement();
bom.put(it.getVersion(), requirement);
});
details.put(k, bom);
}
});
if (!details.isEmpty()) {
builder.withDetail("bom-ranges", details);
}
}
开发者ID:spring-io,项目名称:initializr,代码行数:18,代码来源:BomRangesInfoContributor.java
示例7: dependencyNoMappingSimpleRange
import org.springframework.boot.actuate.info.Info; //导入依赖的package包/类
@Test
public void dependencyNoMappingSimpleRange() {
Dependency dependency = Dependency.withId("foo", "com.example", "foo",
"1.2.3.RELEASE");
dependency.setVersionRange("[1.1.0.RELEASE, 1.5.0.RELEASE)");
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
.addDependencyGroup("foo", dependency).build();
Info info = getInfo(metadata);
assertThat(info.getDetails()).containsKeys("dependency-ranges");
@SuppressWarnings("unchecked")
Map<String, Object> ranges = (Map<String, Object>) info.getDetails()
.get("dependency-ranges");
assertThat(ranges).containsOnlyKeys("foo");
@SuppressWarnings("unchecked")
Map<String, Object> foo = (Map<String, Object>) ranges.get("foo");
assertThat(foo).containsExactly(
entry("1.2.3.RELEASE", "Spring Boot >=1.1.0.RELEASE and <1.5.0.RELEASE"));
}
开发者ID:spring-io,项目名称:initializr,代码行数:19,代码来源:DependencyRangesInfoContributorTests.java
示例8: dependencyWithMappingAndOpenRange
import org.springframework.boot.actuate.info.Info; //导入依赖的package包/类
@Test
public void dependencyWithMappingAndOpenRange() {
Dependency dependency = Dependency.withId("foo", null, null, "0.3.0.RELEASE");
dependency.getMappings().add(Dependency.Mapping
.create("[1.1.0.RELEASE, 1.2.0.RELEASE)", null, null, "0.1.0.RELEASE"));
dependency.getMappings().add(Dependency.Mapping
.create("1.2.0.RELEASE", null, null, "0.2.0.RELEASE"));
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
.addDependencyGroup("test", dependency).build();
Info info = getInfo(metadata);
assertDependencyId(info, "foo");
Map<String, Object> foo = getDependencyRangeInfo(info, "foo");
assertThat(foo).containsExactly(
entry("0.1.0.RELEASE", "Spring Boot >=1.1.0.RELEASE and <1.2.0.RELEASE"),
entry("0.2.0.RELEASE", "Spring Boot >=1.2.0.RELEASE"));
}
开发者ID:spring-io,项目名称:initializr,代码行数:17,代码来源:DependencyRangesInfoContributorTests.java
示例9: dependencyWithMappingAndNoOpenRange
import org.springframework.boot.actuate.info.Info; //导入依赖的package包/类
@Test
public void dependencyWithMappingAndNoOpenRange() {
Dependency dependency = Dependency.withId("foo", null, null, "0.3.0.RELEASE");
dependency.getMappings().add(Dependency.Mapping
.create("[1.1.0.RELEASE, 1.2.0.RELEASE)", null, null, "0.1.0.RELEASE"));
dependency.getMappings().add(Dependency.Mapping
.create("[1.2.0.RELEASE, 1.3.0.RELEASE)", null, null, "0.2.0.RELEASE"));
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
.addDependencyGroup("test", dependency).build();
Info info = getInfo(metadata);
assertDependencyId(info, "foo");
Map<String, Object> foo = getDependencyRangeInfo(info, "foo");
assertThat(foo).containsExactly(
entry("0.1.0.RELEASE", "Spring Boot >=1.1.0.RELEASE and <1.2.0.RELEASE"),
entry("0.2.0.RELEASE", "Spring Boot >=1.2.0.RELEASE and <1.3.0.RELEASE"),
entry("managed", "Spring Boot >=1.3.0.RELEASE"));
}
开发者ID:spring-io,项目名称:initializr,代码行数:18,代码来源:DependencyRangesInfoContributorTests.java
示例10: withMappings
import org.springframework.boot.actuate.info.Info; //导入依赖的package包/类
@Test
public void withMappings() {
BillOfMaterials bom = BillOfMaterials.create("com.example", "bom", "1.0.0");
bom.getMappings().add(
BillOfMaterials.Mapping.create("[1.3.0.RELEASE,1.3.8.RELEASE]", "1.1.0"));
bom.getMappings().add(
BillOfMaterials.Mapping.create("1.3.8.BUILD-SNAPSHOT", "1.1.1-SNAPSHOT"));
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
.addBom("foo", bom).build();
Info info = getInfo(metadata);
assertThat(info.getDetails()).containsKeys("bom-ranges");
@SuppressWarnings("unchecked")
Map<String, Object> ranges = (Map<String, Object>) info.getDetails()
.get("bom-ranges");
assertThat(ranges).containsOnlyKeys("foo");
@SuppressWarnings("unchecked")
Map<String, Object> foo = (Map<String, Object>) ranges.get("foo");
assertThat(foo).containsExactly(
entry("1.1.0", "Spring Boot >=1.3.0.RELEASE and <=1.3.8.RELEASE"),
entry("1.1.1-SNAPSHOT", "Spring Boot >=1.3.8.BUILD-SNAPSHOT"));
}
开发者ID:spring-io,项目名称:initializr,代码行数:22,代码来源:BomRangesInfoContributorTests.java
示例11: contribute
import org.springframework.boot.actuate.info.Info; //导入依赖的package包/类
@Override
public void contribute(Info.Builder builder) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("environment",environment);
map.put("project", project);
map.put("name", name);
map.put("version", version + (EMPTY.equals(build) ? "" : "-" + build));
map.put("commit", commit);
map.put("date", date);
map.put("extra",new HashMap<>());
builder.withDetail("buildInfo",map);
}
开发者ID:hmcts,项目名称:document-management-store-app,代码行数:13,代码来源:DmBuildInfo.java
示例12: testContribute
import org.springframework.boot.actuate.info.Info; //导入依赖的package包/类
@Test
public void testContribute() {
// Setup for "auto-scaling-group-names".
String autoScaleGroupNameForAuthorDispatcher = "autoScaleGroupNameForAuthorDispatcher";
String autoScaleGroupNameForPublish = "autoScaleGroupNameForPublish";
String autoScaleGroupNameForPublishDispatcher = "autoScaleGroupNameForPublishDispatcher";
when(envValues.getAutoScaleGroupNameForAuthorDispatcher()).thenReturn(autoScaleGroupNameForAuthorDispatcher);
when(envValues.getAutoScaleGroupNameForPublish()).thenReturn(autoScaleGroupNameForPublish);
when(envValues.getAutoScaleGroupNameForPublishDispatcher()).thenReturn(autoScaleGroupNameForPublishDispatcher);
// Setup for "author".
String elasticLoadBalancerNameForAuthor = "elasticLoadBalancerNameForAuthor";
String elasticLoadBalancerAuthorDns = "elasticLoadBalancerAuthorDns";
when(envValues.getElasticLoadBalancerNameForAuthor()).thenReturn(elasticLoadBalancerNameForAuthor);
when(envValues.getElasticLoadBalancerAuthorDns()).thenReturn(elasticLoadBalancerAuthorDns);
// Setup for "alarm-notification-topic-arn"
String topicArn = "topicArn";
when(envValues.getTopicArn()).thenReturn(topicArn);
Info.Builder builder = new Info.Builder();
infoActuator.contribute(builder);
// Validate "auto-scaling-group-names".
Map<String, Object> info = builder.build().getDetails();
Map<String, String> asgNames = (Map<String, String>) info.get("auto-scaling-group-names");
assertThat(asgNames.get("author-dispatcher"), equalTo(autoScaleGroupNameForAuthorDispatcher));
assertThat(asgNames.get("publish"), equalTo(autoScaleGroupNameForPublish));
assertThat(asgNames.get("publish-dispatcher"), equalTo(autoScaleGroupNameForPublishDispatcher));
// Validate "author"
Map<String, String> authorInfo = (Map<String, String>) info.get("author");
assertThat(authorInfo.get("elastic-load-balancer-name"), equalTo(elasticLoadBalancerNameForAuthor));
assertThat(authorInfo.get("elastic-load-balancer-dns"), equalTo(elasticLoadBalancerAuthorDns));
// Validate "alarm-notification-topic-arn"
assertThat(info.get("alarm-notification-topic-arn"), equalTo(topicArn));
}
开发者ID:shinesolutions,项目名称:aem-orchestrator,代码行数:39,代码来源:InfoActuatorTest.java
示例13: contributeUsedSkillCount
import org.springframework.boot.actuate.info.Info; //导入依赖的package包/类
private void contributeUsedSkillCount(List<User> users, Info.Builder builder) {
int usedSkillCount = (int) users.stream()
.flatMap(p -> p.getSkillsExcludeHidden().stream())
.map(UserSkill::getName)
.distinct()
.count();
builder.withDetail("skills_used", usedSkillCount);
}
开发者ID:sinnerschrader,项目名称:SkillWill,代码行数:9,代码来源:StatisticsInfoContributor.java
示例14: contributeUserSkills
import org.springframework.boot.actuate.info.Info; //导入依赖的package包/类
private void contributeUserSkills(List<User> users, Info.Builder builder) {
IntSummaryStatistics stats = users.stream().mapToInt(u -> u.getSkillsExcludeHidden().size()).summaryStatistics();
Map<String, Double> details = new HashMap<>();
details.put("total", (double) stats.getSum());
details.put("min", (double) stats.getMin());
details.put("max", (double) stats.getMax());
details.put("average", stats.getAverage());
builder.withDetail("personal_skills", details);
}
开发者ID:sinnerschrader,项目名称:SkillWill,代码行数:12,代码来源:StatisticsInfoContributor.java
示例15: contribute
import org.springframework.boot.actuate.info.Info; //导入依赖的package包/类
@Override
public void contribute(Info.Builder builder) {
List<User> users = UserRepository.findAll();
contributeUserCount(builder);
contributeSkillCount(builder);
contributeUsedSkillCount(users, builder);
contributeHiddenSkillCount(builder);
contributeUserSkills(users, builder);
}
开发者ID:sinnerschrader,项目名称:SkillWill,代码行数:11,代码来源:StatisticsInfoContributor.java
示例16: mergeDetailsFrom
import org.springframework.boot.actuate.info.Info; //导入依赖的package包/类
synchronized void mergeDetailsFrom(ActorInfoContributorReference actorInfoContributorReference)
{
Info.Builder builder = new Info.Builder();
actorInfoContributorReference.getInfoContributor().contribute(builder);
Map<String, Object> whereToPutDetails = details;
for (Function<ActorInfoContributorReference, String> handler: detailLevelHandlers)
{
String key = handler.apply(actorInfoContributorReference);
whereToPutDetails.putIfAbsent(key, new HashMap<String, Object>());
//noinspection unchecked
whereToPutDetails = (Map<String, Object>) whereToPutDetails.get(key);
}
whereToPutDetails.putAll(builder.build().getDetails());
}
开发者ID:orbit,项目名称:orbit-spring,代码行数:15,代码来源:ActorInfoDetailsContainer.java
示例17: contribute
import org.springframework.boot.actuate.info.Info; //导入依赖的package包/类
@Override
public void contribute(final Info.Builder builder)
{
populateActorInfoContainerWhileRemovingExpiredReferences();
Map<String, Object> details = actorInfoDetailsContainer.getDetailsSnapshot();
if (!details.isEmpty())
{
builder.withDetail("actors", details);
}
}
开发者ID:orbit,项目名称:orbit-spring,代码行数:11,代码来源:ActorInfoContributorLifetimeExtension.java
示例18: contribute
import org.springframework.boot.actuate.info.Info; //导入依赖的package包/类
@Override
public void contribute(final Info.Builder builder)
{
builder.withDetail("constructorInjectedValue", constructorInjectedValue)
.withDetail("fieldInjectedValue", fieldInjectedValue);
super.contribute(builder);
}
开发者ID:orbit,项目名称:orbit-spring,代码行数:8,代码来源:ActorInfoContributorIntegrationTest.java
示例19: contribute
import org.springframework.boot.actuate.info.Info; //导入依赖的package包/类
@Override
public void contribute(Info.Builder builder) {
final Map<String, OAuth2LoginDetails> oauth2Details =
settingsRepository.findOne("default").getoAuth2LoginDetails();
final Map<String, AuthProviderInfo> providers = providersMap.values()
.stream()
.filter(p -> !p.isConfigDynamic() || (null != oauth2Details && oauth2Details.containsKey(p.getName())))
.collect(Collectors
.toMap(OAuthProvider::getName,
p -> new AuthProviderInfo(p.getButton(), p.buildPath(getAuthBasePath()))));
builder.withDetail("auth_extensions", providers);
//@formatter:on
}
开发者ID:reportportal,项目名称:service-authorization,代码行数:16,代码来源:AuthProvidersInfoContributor.java
示例20: contribute
import org.springframework.boot.actuate.info.Info; //导入依赖的package包/类
@Override
public void contribute(Info.Builder builder) {
builder
.withDetail("metadata", ImmutableMap
.builder()
.put("project_roles",
stream(ProjectRole.values()).map(Enum::name).collect(Collectors.toList()))
.build());
//@formatter:on
}
开发者ID:reportportal,项目名称:service-authorization,代码行数:11,代码来源:MetadataContributor.java
注:本文中的org.springframework.boot.actuate.info.Info类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论