Verify the container status on remote process server.

@param serverUrl     remote process server URL
@param container     container id
@return KieContainerResource with status or null if the container in not instantiated
777232
@SuppressWarnings("unchecked")
    public KieContainerResource getContainer(String serverUrl, String container) {

        // in case of container is not instantiated the response doesn't parse ServiceResponse
        String response = client.target(serverUrl)
            .path("containers")
            .path(container)
            .request(MediaType.APPLICATION_JSON)
            .get(String.class);
        
        ServiceResponse<KieContainerResource> result = jsonMarshaller.unmarshall(response, ServiceResponse.class);
        return result.getResult();

    }
525503
public HttpServerActionBuilder server(String httpServer) {
		Assert.notNull(applicationContext, "Citrus application context is not initialized!");
		HttpServerActionBuilder serverAction = new HttpServerActionBuilder(action, applicationContext.getBean(httpServer, Endpoint.class))
				.withApplicationContext(applicationContext);
		return serverAction;
	}
403207
public CmsInheritedContainerState getInheritedContainerState(CmsObject cms, CmsResource resource, String name) {

        String rootPath = resource.getRootPath();
        if (!resource.isFolder()) {
            rootPath = CmsResource.getParentFolder(rootPath);
        }
        CmsInheritedContainerState result = new CmsInheritedContainerState();
        boolean online = isOnline(cms);
        CmsContainerConfigurationCache cache = online
        ? m_onlineContainerConfigurationCache
        : m_offlineContainerConfigurationCache;
        result.addConfigurations(cache, rootPath, name);
        return result;

    }
293465
private static void launchServer(final String url,
                                     final CloseableHttpClient client) {
        try {
            final JDialog dialog = new JDialog();
            dialog.setSize(new java.awt.Dimension(400, 75));
            dialog.setModalityType(ModalityType.MODELESS);
            dialog.setTitle("DuraCloud Sync");
            dialog.setLocationRelativeTo(null);

            JPanel panel = new JPanel();
            final JLabel label = new JLabel("Loading...");
            final JProgressBar progress = new JProgressBar();
            progress.setStringPainted(true);

            panel.add(label);
            panel.add(progress);
            dialog.add(panel);
            dialog.setVisible(true);

            port = SyncUIConfig.getPort();
            contextPath = SyncUIConfig.getContextPath();
            Server srv = new Server(port);

            // Setup JMX
            MBeanContainer mbContainer = new MBeanContainer(
                    ManagementFactory.getPlatformMBeanServer() );
            srv.addBean( mbContainer );

            ProtectionDomain protectionDomain =
                org.duracloud.syncui.SyncUIDriver.class.getProtectionDomain();
            String warFile =
                protectionDomain.getCodeSource().getLocation().toExternalForm();

            log.debug("warfile: {}", warFile);
            WebAppContext context = new WebAppContext();
            context.setContextPath(contextPath);
            context.setWar(warFile);
            context.setExtractWAR(Boolean.TRUE);

            Configuration.ClassList classlist = Configuration.ClassList
                    .setServerDefault( srv );
            classlist.addBefore(
                    "org.eclipse.jetty.webapp.JettyWebXmlConfiguration",
                    "org.eclipse.jetty.annotations.AnnotationConfiguration" );

            context.setAttribute(
                    "org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",
                    ".*/[^/]*servlet-api-[^/]*\\.jar$|.*/javax.servlet.jsp.jstl-.*\\.jar$|.*/[^/]*taglibs.*\\.jar$" );

            srv.setHandler(context);

            new Thread(new Runnable() {
                @Override
                public void run() {
                    createSysTray(url, srv);

                    while (true) {
                        if (progress.getValue() < 100) {
                            progress.setValue(progress.getValue() + 3);
                        }

                        sleep(2000);
                        if (isAppRunning(url, client)) {
                            break;
                        }
                    }

                    progress.setValue(100);

                    label.setText("Launching browser...");
                    launchBrowser(url);
                    dialog.setVisible(false);
                }
            }).start();

            srv.start();

            srv.join();
        } catch (Exception e) {
            log.error("Error launching server: " + e.getMessage(), e);
        }
    }
1048478
@SuppressWarnings("unchecked")
    public <T extends WebLocatorAbstractBuilder> T setContainer(WebLocator container) {
        pathBuilder.setContainer(container);
        return (T) this;
    }
1175207
protected function getServer(TaskContainer $container)
    {
        if ($this->argument('name')) {
            return $container->getServer($this->argument('name'));
        } elseif ($container->hasOneServer()) {
            return $container->getFirstServer();
        } else {
            throw new \InvalidArgumentException('Please provide a server name.');
        }
    }
477186
private void verifyOrAddStore(String clusterURL,
                                  String keySchema,
                                  String valueSchema) {
        String newStoreDefXml = VoldemortUtils.getStoreDefXml(
                storeName,
                props.getInt(BUILD_REPLICATION_FACTOR, 2),
                props.getInt(BUILD_REQUIRED_READS, 1),
                props.getInt(BUILD_REQUIRED_WRITES, 1),
                props.getNullableInt(BUILD_PREFERRED_READS),
                props.getNullableInt(BUILD_PREFERRED_WRITES),
                props.getString(PUSH_FORCE_SCHEMA_KEY, keySchema),
                props.getString(PUSH_FORCE_SCHEMA_VALUE, valueSchema),
                description,
                owners);

        log.info("Verifying store against cluster URL: " + clusterURL + "\n" + newStoreDefXml.toString());
        StoreDefinition newStoreDef = VoldemortUtils.getStoreDef(newStoreDefXml);

        try {
            adminClientPerCluster.get(clusterURL).storeMgmtOps.verifyOrAddStore(newStoreDef, "BnP config/data",
                enableStoreCreation, this.storeVerificationExecutorService);
        } catch (UnreachableStoreException e) {
            log.info("verifyOrAddStore() failed on some nodes for clusterURL: " + clusterURL + " (this is harmless).", e);
            // When we can't reach some node, we just skip it and won't create the store on it.
            // Next time BnP is run while the node is up, it will get the store created.
        } // Other exceptions need to bubble up!

        storeDef = newStoreDef;
    }
824542
function(parameters,callback){
         if (parameters.requestUrl && parameters.isCluster) {
            var clusterUrl = ortcTreatUrl(parameters.requestUrl);

            getServerFromCluster({
                clusterUri : clusterUrl, 
                appKey : parameters.appKey
            }, 
            function (error, body) {
                if (error != null) {
                    callback('Error getting server from Cluster',null);
                }
                else {
                    var resultUrl = body.substring(body.indexOf('=') + 3, body.length - 2);
                    callback(null,resultUrl);
                }
            });
        }
        else {
            var resultUrl = ortcTreatUrl(parameters.requestUrl);
            callback(null,resultUrl);
        }
    }
800779
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.admanager.axis.v201902.CmsMetadataServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.admanager.axis.v201902.CmsMetadataServiceSoapBindingStub _stub = new com.google.api.ads.admanager.axis.v201902.CmsMetadataServiceSoapBindingStub(new java.net.URL(CmsMetadataServiceInterfacePort_address), this);
                _stub.setPortName(getCmsMetadataServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
813953
public static boolean isClientContainer()
    {
        String processType = AccessController.doPrivileged(new PrivilegedAction<String>() {
            @Override
            public String run() {
                return bundleContext.getProperty(WsLocationConstants.LOC_PROCESS_TYPE);
            }
        });
        return Boolean.valueOf(WsLocationConstants.LOC_PROCESS_TYPE_CLIENT.equals(processType));
    }
999260
private void assertRemotePropertiesServerIsAvailable(final URL configUrl) {
		new HttpClient().send(
				"HEAD",
				configUrl.toExternalForm(),
				new HashMap<String, String>(),
				null,
				new HttpClient.ResponseHandler<Void>() {
					@Override
					public Void handleResponse(HttpRequest<?> httpRequest, InputStream is, Integer statusCode, IOException e) throws IOException {
						if (e != null || statusCode != 200) {
							throw new IllegalStateException("Remote properties are not available at " +
									configUrl + ", http status code: " + statusCode, e);
						}
						return null;
					}
				}
		);
	}
1234916
static PortComponent getPortComponentByServletLink(String servletLink, Adaptable containerToAdapt) throws UnableToAdaptException {
        return getHighLevelElementByServiceImplBean(servletLink, containerToAdapt, PortComponent.class, LinkType.SERVLET);
    }
1179907
public ServerHandle detect(MBeanServerExecutor pMBeanServerExecutor) {
        String version = getBundleVersion("org.eclipse.virgo.kernel.userregion");
        if (version != null) {
            String type = "kernel";
            if (getBundleVersion("org.eclipse.gemini.web.core") != null) {
                type = "tomcat";
            } else if (getBundleVersion("org.eclipse.jetty.osgi.boot") != null) {
                type = "jetty";
            }
            Map<String,String> extraInfo = new HashMap<String,String>();
            extraInfo.put("type",type);
            return new ServerHandle("Eclipse","Virgo",version, extraInfo);
        } else {
            return null;
        }
    }
188721
public TokenRequest setTokenServerUrl(GenericUrl tokenServerUrl) {
    this.tokenServerUrl = tokenServerUrl;
    Preconditions.checkArgument(tokenServerUrl.getFragment() == null);
    return this;
  }
1156175
public Server getServerByUri(final String uri) {
        for (Server server : SERVERS) {
            if (server.getManagementUri().equals(uri)) {
                return server;
            }
        }

        return null;
    }
205036
protected String getParameter(String parameterName, TestContext context) {
        if (getParameters().containsKey(parameterName)) {
            return context.replaceDynamicContentInString(getParameters().get(parameterName).toString());
        } else {
            throw new CitrusRuntimeException(String.format("Missing docker command parameter '%s'", parameterName));
        }
    }
26519
@Then("^service '(.+?)' status in cluster '(.+?)' is '(suspended|running|deploying)'( in less than '(\\d+?)' seconds checking every '(\\d+?)' seconds)?")
    public void serviceStatusCheck(String service, String cluster, String status, String foo, Integer totalWait, Integer interval) throws Exception {
        String response;
        Integer i = 0;
        boolean matched;

        response = commonspec.retrieveServiceStatus(service, cluster);

        if (foo != null) {
            matched = status.matches(response);
            while (!matched && i < totalWait) {
                this.commonspec.getLogger().info("Service status not found yet after " + i + " seconds");
                i = i + interval;
                response = commonspec.retrieveServiceStatus(service, cluster);
                matched = status.matches(response);
            }
        }

        assertThat(status).as("Expected status: " + status + " doesn't match obtained one: " + response).matches(response);

    }