Java Code Examples for org.wso2.carbon.utils.FileUtil

The following examples show how to use org.wso2.carbon.utils.FileUtil. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: istio-apim   Source File:    License: Apache License 2.0 6 votes vote down vote up
 * Build the config for the client
private Config buildConfig() throws APIManagementException {

    System.setProperty(TRY_KUBE_CONFIG, "false");
    System.setProperty(TRY_SERVICE_ACCOUNT, "true");
    ConfigBuilder configBuilder;

    configBuilder = new ConfigBuilder().withMasterUrl(kubernetesAPIServerUrl);

    if (!StringUtils.isEmpty(saTokenFileName)) {
        String token;
        String tokenFile = saTokenFilePath + "/" + saTokenFileName;
        try {
            token = FileUtil.readFileToString(tokenFile);
        } catch (IOException e) {
            throw new APIManagementException("Error while reading the SA Token FIle " + tokenFile);

Example 2
public void setup() throws IOException {
    serviceReferenceHolder = Mockito.mock(ServiceReferenceHolder.class);
    componentContext = Mockito.mock(ComponentContext.class);
    registryService = Mockito.mock(RegistryService.class);
    userRegistry = Mockito.mock(UserRegistry.class);
    resource = Mockito.mock(Resource.class);

Example 3
Source Project: carbon-apimgt   Source File:    License: Apache License 2.0 4 votes vote down vote up
private void updateRegistryResourceContent(Resource resource, UserRegistry systemRegistry, String rxtDir, String rxtPath, String resourcePath) throws RegistryException, IOException {
    String rxt = FileUtil.readFileToString(rxtDir + File.separator + rxtPath);
    systemRegistry.put(resourcePath, resource);