All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ecfeed.core.webservice.util.GenServiceVersionGetter Maven / Gradle / Ivy

Go to download

An open library used to connect to the ecFeed service. It can be also used as a standalone testing tool. It is integrated with Junit5 and generates a stream of test cases using a selected algorithm (e.g. Cartesian, N-Wise). There are no limitations associated with the off-line version but the user cannot access the on-line computation servers and the model database.

The newest version!
package com.ecfeed.core.webservice.util;

import java.io.BufferedReader;
import java.util.Optional;

import com.ecfeed.core.webservice.client.GenWebServiceClient;
import com.ecfeed.core.webservice.client.GenWebServiceClientType;
import com.ecfeed.core.webservice.client.WebServiceResponse;

public class GenServiceVersionGetter {
	
	public static String getVersion(String genServiceIp, GenWebServiceClientType genWebServiceClientType) {

		if (!GenServiceHelper.isHostIsAlive(genServiceIp)) {
			return "NOT AVAILABLE"; 
		}

		Optional emptyKeyStorePath = Optional.empty();

		GenWebServiceClient genWebServiceClient = new GenWebServiceClient(
				genServiceIp,
				GenWebServiceClient.getGenServiceVersionEndPoint(),
				genWebServiceClientType.toString(),
				emptyKeyStorePath); 
		
		WebServiceResponse webServiceResponse = genWebServiceClient.sendGetRequest();
		
        if (!webServiceResponse.isResponseStatusOk()) {
            return "ERROR";
        }

        BufferedReader bufferedReader = webServiceResponse.getResponseBufferedReader();

        String version;
        
        try {
            version = bufferedReader.readLine();
        } catch (Exception e) {
        	return "ERROR";
        }
		
		return version;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy