OrchestratorUtil { public static ApplicationId toApplicationId(ApplicationInstanceReference appRef) { String appNameStr = appRef.asString(); String[] appNameParts = appNameStr.split(":"); if (appNameParts.length == 2) { return ApplicationId.from(TenantName.from(appNameParts[0]), ApplicationName.from(appNameParts[1]), InstanceName.defaultName()); } if (appNameParts.length != 5) { throw new IllegalArgumentException("Application reference not valid (not 5 parts): " + appRef); } return ApplicationId.from(TenantName.from(appNameParts[0]), ApplicationName.from(appNameParts[1]), InstanceName.from(appNameParts[4])); } private  OrchestratorUtil(); static Set<HostName> getHostsUsedByApplicationInstance(ApplicationInstance applicationInstance); static Set<HostName> getHostsUsedByServiceCluster(ServiceCluster serviceCluster); static Set<ServiceCluster> getServiceClustersUsingHost(Collection<ServiceCluster> serviceClusters,
                                                                         HostName hostName); static Stream<ServiceInstance> serviceInstancesOnHost(ServiceCluster serviceCluster,
                                                                        HostName hostName); static ApplicationInstanceReference parseApplicationInstanceReference(String restFormat); static String toRestApiFormat(ApplicationInstanceReference applicationInstanceReference); static ApplicationInstanceReference toApplicationInstanceReference(
            ApplicationId applicationid,
            ServiceMonitor serviceMonitor); static ApplicationId toApplicationId(ApplicationInstanceReference appRef);  }
@Test public void applicationid_from_zone_confg_server_appref_is_working() throws Exception { ApplicationId appId = OrchestratorUtil.toApplicationId(APPREF_2); Assert.assertEquals(ApplicationId.from( TenantName.from("hosted-vespa"), ApplicationName.from("zone-config-servers"), InstanceName.defaultName()),appId); }