ApplicationStatusHandler extends AbstractRequestHandler { static JSONObject renderApplicationConfigs(ApplicationMetadataConfig metaConfig, ApplicationUserdataConfig userConfig) { JSONObject vespa = new JSONObject(); putJson(vespa, "version", Vtag.currentVersion); JSONObject meta = new JSONObject(); putJson(meta, "name", metaConfig.name()); putJson(meta, "user", metaConfig.user()); putJson(meta, "path", metaConfig.path()); putJson(meta, "generation", metaConfig.generation()); putJson(meta, "timestamp", metaConfig.timestamp()); putJson(meta, "date", new Date(metaConfig.timestamp()).toString()); putJson(meta, "checksum", metaConfig.checksum()); JSONObject user = new JSONObject(); putJson(user, "version", userConfig.version()); JSONObject application = new JSONObject(); putJson(application, "vespa", vespa); putJson(application, "meta", meta); putJson(application, "user", user); return application; } @Inject  ApplicationStatusHandler(ApplicationMetadataConfig metaConfig,
                                    ApplicationUserdataConfig userConfig,
                                    JdiscBindingsConfig bindingsConfig,
                                    ComponentRegistry<ClientProvider> clientProviderRegistry,
                                    ComponentRegistry<ServerProvider> serverProviderRegistry,
                                    ComponentRegistry<RequestFilterBase> requestFilterRegistry,
                                    ComponentRegistry<ResponseFilterBase> responseFilterRegistry); @Override ContentChannel handleRequest(com.yahoo.jdisc.Request request, ResponseHandler handler);  }
@Test public void application_configs_are_rendered() throws Exception { ApplicationMetadataConfig metaConfig = new ApplicationMetadataConfig( new ApplicationMetadataConfig.Builder() .checksum("abc") .name("app") .path("/a/b/c") .timestamp(3000) .user("donald")); ApplicationUserdataConfig userConfig = new ApplicationUserdataConfig( new ApplicationUserdataConfig.Builder() .version("v1")); String json = ApplicationStatusHandler.renderApplicationConfigs(metaConfig, userConfig).toString(); assertThat(json, containsString("version")); assertThat(json, containsString("meta")); assertThat(json, containsString("abc")); assertThat(json, containsString("app")); assertThat(json, containsString("/a/b/c")); assertThat(json, containsString("3000")); assertThat(json, containsString("donald")); assertThat(json, containsString("v1")); }