当前位置: 首页>>代码示例>>Java>>正文


Java FileFsFile类代码示例

本文整理汇总了Java中org.robolectric.res.FileFsFile的典型用法代码示例。如果您正苦于以下问题:Java FileFsFile类的具体用法?Java FileFsFile怎么用?Java FileFsFile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FileFsFile类属于org.robolectric.res包,在下文中一共展示了FileFsFile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAppManifest

import org.robolectric.res.FileFsFile; //导入依赖的package包/类
@Override
protected AndroidManifest getAppManifest(Config config) {
	if (config.constants() == Void.class) {
		Logger.error("Field 'constants' not specified in @Config annotation");
		Logger.error("This is required when using RobolectricGradleTestRunner!");
		throw new RuntimeException("No 'constants' field in @Config annotation!");
	}

	final String type = getType(config);
	final String flavor = getFlavor(config);
	final String applicationId = getApplicationId(config);

	final FileFsFile res;
	if (FileFsFile.from(BUILD_OUTPUT, "res", flavor, type).exists()) {
		res = FileFsFile.from(BUILD_OUTPUT, "res", flavor, type);
	} else {
		// Use res/merged if the output directory doesn't exist for Data Binding compatibility
		res = FileFsFile.from(BUILD_OUTPUT, "res/merged", flavor, type);
	}
	final FileFsFile assets = FileFsFile.from(BUILD_OUTPUT, "assets", flavor, type);

	final FileFsFile manifest;
	if (FileFsFile.from(BUILD_OUTPUT, "manifests").exists()) {
		manifest = FileFsFile.from(BUILD_OUTPUT, "manifests", "full", flavor, type, "AndroidManifest.xml");
	} else {
		// Fallback to the location for library manifests
		manifest = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "AndroidManifest.xml");
	}

	Logger.debug("Robolectric assets directory: " + assets.getPath());
	Logger.debug("   Robolectric res directory: " + res.getPath());
	Logger.debug("   Robolectric manifest path: " + manifest.getPath());
	Logger.debug("    Robolectric package name: " + applicationId);
	return new AndroidManifest(manifest, res, assets, applicationId);
}
 
开发者ID:bpatrik,项目名称:mobsoft-lab,代码行数:36,代码来源:RobolectricDaggerTestRunner.java

示例2: getAppManifest

import org.robolectric.res.FileFsFile; //导入依赖的package包/类
@Override
protected AndroidManifest getAppManifest(Config config) {
  AndroidManifest appManifest = super.getAppManifest(config);
  FsFile androidManifestFile = appManifest.getAndroidManifestFile();

  if (androidManifestFile.exists()) {
    return appManifest;
  } else {
    androidManifestFile = FileFsFile.from(appManifest.getAndroidManifestFile().getPath()
        .replace("manifests/full", "manifests/aapt"));
    return new AndroidManifest(androidManifestFile, appManifest.getResDirectory(), appManifest.getAssetsDirectory());
  }
}
 
开发者ID:andrewlord1990,项目名称:materialandroid,代码行数:14,代码来源:LibraryRobolectricTestRunner.java

示例3: getAppManifest

import org.robolectric.res.FileFsFile; //导入依赖的package包/类
protected AndroidManifest getAppManifest(Config config) {
	AndroidManifest appManifest = super.getAppManifest(config);
	FsFile androidManifestFile = appManifest.getAndroidManifestFile();

	if (androidManifestFile.exists()) {
		return appManifest;
	} else {
		String moduleRoot = getModuleRootPath(config);
		androidManifestFile = FileFsFile.from(moduleRoot, appManifest.getAndroidManifestFile().getPath().replace("bundles", "manifests/full"));
		FsFile resDirectory = FileFsFile.from(moduleRoot, appManifest.getResDirectory().getPath());
		FsFile assetsDirectory = FileFsFile.from(moduleRoot, appManifest.getAssetsDirectory().getPath());
		return new AndroidManifest(androidManifestFile, resDirectory, assetsDirectory);
	}
}
 
开发者ID:Stocard,项目名称:markdown-to-spanned,代码行数:15,代码来源:ManifestedRobolectricGradeTestRunner.java

示例4: getAppManifest

import org.robolectric.res.FileFsFile; //导入依赖的package包/类
protected AndroidManifest getAppManifest(Config config) {
    AndroidManifest appManifest = super.getAppManifest(config);
    FsFile androidManifestFile = appManifest.getAndroidManifestFile();

    if (androidManifestFile.exists()) {
        return appManifest;
    } else {
        String moduleRoot = getModuleRootPath(config);
        androidManifestFile = FileFsFile.from(moduleRoot, appManifest.getAndroidManifestFile().getPath().replace("bundles", "manifests/full"));
        FsFile resDirectory = FileFsFile.from(moduleRoot, appManifest.getResDirectory().getPath());
        FsFile assetsDirectory = FileFsFile.from(moduleRoot, appManifest.getAssetsDirectory().getPath());
        return new AndroidManifest(androidManifestFile, resDirectory, assetsDirectory);
    }
}
 
开发者ID:richardradics,项目名称:MVPAndroidBootstrap,代码行数:15,代码来源:AppRobolectricRunner.java

示例5: getAppManifest

import org.robolectric.res.FileFsFile; //导入依赖的package包/类
@Override
protected AndroidManifest getAppManifest(Config config) {
    if (config.constants() == Void.class) {
        Logger.error("Field 'constants' not specified in @Config annotation");
        Logger.error("This is required when using RobolectricGradleTestRunner!");
        throw new RuntimeException("No 'constants' field in @Config annotation!");
    }

    final String type = getType(config);
    final String flavor = getFlavor(config);
    final String packageName = getPackageName(config);

    final FileFsFile res;
    final FileFsFile assets;
    final FileFsFile manifest;

    if (FileFsFile.from(BUILD_OUTPUT, "res").exists()) {
        res = FileFsFile.from(BUILD_OUTPUT, "res", flavor, type);
    } else {
        res = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "res");
    }

    if (FileFsFile.from(BUILD_OUTPUT, "assets").exists()) {
        assets = FileFsFile.from(BUILD_OUTPUT, "assets", flavor, type);
    } else {
        assets = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "assets");
    }

    if (FileFsFile.from(BUILD_OUTPUT, "manifests").exists()) {
        manifest = FileFsFile.from(BUILD_OUTPUT, "manifests", "androidTest", flavor, type, "AndroidManifest.xml");
    } else {
        manifest = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "AndroidManifest.xml");
    }

    Logger.debug("Robolectric assets directory: " + assets.getPath());
    Logger.debug("   Robolectric res directory: " + res.getPath());
    Logger.debug("   Robolectric manifest path: " + manifest.getPath());
    Logger.debug("    Robolectric package name: " + packageName);
    return new AndroidManifest(manifest, res, assets, packageName);
}
 
开发者ID:hoko,项目名称:hoko-android,代码行数:41,代码来源:HokoGradleTestRunner.java

示例6: getAppManifest

import org.robolectric.res.FileFsFile; //导入依赖的package包/类
protected AndroidManifest getAppManifest(Config config) {
    AndroidManifest appManifest = super.getAppManifest(config);
    FsFile androidManifestFile = appManifest.getAndroidManifestFile();

    if (androidManifestFile.exists()) {
        return appManifest;
    } else {
        String moduleRoot = getModuleRootPath(config);
        androidManifestFile = FileFsFile.from(moduleRoot, appManifest.getAndroidManifestFile().getPath().replace("bundles", "manifests/full"));
        FsFile resDirectory = FileFsFile.from(moduleRoot, appManifest.getResDirectory().getPath().replace("/res", "").replace("bundles", "res"));
        FsFile assetsDirectory = FileFsFile.from(moduleRoot, appManifest.getAssetsDirectory().getPath().replace("/assets", "").replace("bundles", "assets"));
        return new AndroidManifest(androidManifestFile, resDirectory, assetsDirectory);
    }
}
 
开发者ID:nightscout,项目名称:lasso,代码行数:15,代码来源:CustomRobolectricRunner.java

示例7: createFile

import org.robolectric.res.FileFsFile; //导入依赖的package包/类
public File createFile(AndroidManifest manifest, String fileName, String contents) throws Exception {
  File assetBase = ((FileFsFile) manifest.getAssetsDirectory()).getFile();
  File file = new File(assetBase, fileName);
  file.getParentFile().mkdirs();

  FileWriter fileWriter = new FileWriter(file);
  try {
     fileWriter.write(contents);
  } finally {
    fileWriter.close();
  }

  assetsToDelete.add(file);
  return file;
}
 
开发者ID:qx,项目名称:FullRobolectricTestSample,代码行数:16,代码来源:TemporaryAsset.java

示例8: getAppManifest

import org.robolectric.res.FileFsFile; //导入依赖的package包/类
protected AndroidManifest getAppManifest(Config config) {
    AndroidManifest appManifest = super.getAppManifest(config);
    FsFile androidManifestFile = appManifest.getAndroidManifestFile();

    if (androidManifestFile.exists()) {
        return appManifest;
    } else {
        androidManifestFile = FileFsFile.from(MODULE_ROOT, "src/main/AndroidManifest.xml");
        FsFile resDirectory = FileFsFile.from(MODULE_ROOT, "src/main/res");
        FsFile assetsDirectory = FileFsFile.from(MODULE_ROOT, "src/main/assets");

        return new AndroidManifest(androidManifestFile, resDirectory, assetsDirectory);
    }
}
 
开发者ID:lordi,项目名称:tickmate,代码行数:15,代码来源:TickmateTestRunner.java

示例9: getAppManifest

import org.robolectric.res.FileFsFile; //导入依赖的package包/类
protected AndroidManifest getAppManifest(Config config) {
    AndroidManifest appManifest = super.getAppManifest(config);
    FsFile androidManifestFile = appManifest.getAndroidManifestFile();

    if (androidManifestFile.exists()) {
        return appManifest;
    } else {
        String moduleRoot = getModuleRootPath(config);
        androidManifestFile = FileFsFile.from(moduleRoot, appManifest.getAndroidManifestFile().getPath());
        FsFile resDirectory = FileFsFile.from(moduleRoot, appManifest.getAndroidManifestFile().getPath().replace("AndroidManifest.xml", "res"));
        FsFile assetsDirectory = FileFsFile.from(moduleRoot, appManifest.getAndroidManifestFile().getPath().replace("AndroidManifest.xml", "assets"));
        return new AndroidManifest(androidManifestFile, resDirectory, assetsDirectory);
    }
}
 
开发者ID:rysiekblah,项目名称:crom,代码行数:15,代码来源:CustomRobolectricRunner.java

示例10: getAppManifest

import org.robolectric.res.FileFsFile; //导入依赖的package包/类
protected AndroidManifest getAppManifest(Config config) {
    AndroidManifest appManifest = super.getAppManifest(config);
    FsFile androidManifestFile = appManifest.getAndroidManifestFile();
    FsFile resDirectory;
    FsFile assetsDirectory;


    String moduleRoot = getModuleRootPath(config);
    androidManifestFile = FileFsFile.from(moduleRoot, appManifest.getAndroidManifestFile().getPath().replace("bundles", "manifests/aapt"));

    if(appManifest.getResDirectory().getPath().contains("release")) {
        resDirectory = FileFsFile.from(moduleRoot, appManifest.getResDirectory().getPath().replace("release", "default"));
        assetsDirectory = FileFsFile.from(moduleRoot, appManifest.getAssetsDirectory().getPath().replace("release", "default"));
    }else{
        resDirectory = FileFsFile.from(moduleRoot, appManifest.getResDirectory().getPath().replace("bundles/debug/res", "res/merged/debug"));
        assetsDirectory = FileFsFile.from(moduleRoot, appManifest.getAssetsDirectory().getPath());
    }


    System.out.print(androidManifestFile.getPath() + '\n');
    System.out.print(resDirectory.getPath() + '\n');
    System.out.print(assetsDirectory.getPath() + '\n');


    return new AndroidManifest(androidManifestFile, resDirectory, assetsDirectory);

}
 
开发者ID:appnexus,项目名称:mobile-sdk-android,代码行数:28,代码来源:RoboelectricTestRunnerWithResources.java

示例11: getAppManifest

import org.robolectric.res.FileFsFile; //导入依赖的package包/类
protected AndroidManifest getAppManifest(Config config) {
    AndroidManifest appManifest = super.getAppManifest(config);
    FsFile androidManifestFile = appManifest.getAndroidManifestFile();
    FsFile resDirectory;
    FsFile assetsDirectory;


        String moduleRoot = getModuleRootPath(config);
        androidManifestFile = FileFsFile.from(moduleRoot, appManifest.getAndroidManifestFile().getPath().replace("bundles", "manifests/aapt"));

        if(appManifest.getResDirectory().getPath().contains("release")) {
            resDirectory = FileFsFile.from(moduleRoot, appManifest.getResDirectory().getPath().replace("release", "default"));
            assetsDirectory = FileFsFile.from(moduleRoot, appManifest.getAssetsDirectory().getPath().replace("release", "default"));
        }else{
            resDirectory = FileFsFile.from(moduleRoot, appManifest.getResDirectory().getPath());
            assetsDirectory = FileFsFile.from(moduleRoot, appManifest.getAssetsDirectory().getPath());
        }


        System.out.print(androidManifestFile.getPath() + '\n');
        System.out.print(resDirectory.getPath() + '\n');
        System.out.print(assetsDirectory.getPath() + '\n');


        return new AndroidManifest(androidManifestFile, resDirectory, assetsDirectory);

}
 
开发者ID:appnexus,项目名称:mobile-sdk-android,代码行数:28,代码来源:RoboelectricTestRunnerWithResources.java

示例12: getAppManifest

import org.robolectric.res.FileFsFile; //导入依赖的package包/类
@Override
protected AndroidManifest getAppManifest(Config config) {
    if (config.constants() == Void.class) {
        Logger.error("Field 'constants' not specified in @Config annotation");
        Logger.error("This is required when using RobolectricGradleTestRunner!");
        throw new RuntimeException("No 'constants' field in @Config annotation!");
    }

    final String type = getType(config);
    final String flavor = getFlavor(config);
    final String packageName = getPackageName(config);

    final FileFsFile res;
    final FileFsFile assets;
    final FileFsFile manifest;

    // res/merged added in Android Gradle plugin 1.3-beta1

    // Recognize new name for data binding layouts until later plugin version
    if (FileFsFile.from(BUILD_OUTPUT, "data-binding-layout-out").exists()) {
        res = FileFsFile.from(BUILD_OUTPUT, "data-binding-layout-out", flavor, type);
    } else if (FileFsFile.from(BUILD_OUTPUT, "res", "merged").exists()) {
        res = FileFsFile.from(BUILD_OUTPUT, "res", "merged", flavor, type);
    } else if (FileFsFile.from(BUILD_OUTPUT, "res").exists()) {
        res = FileFsFile.from(BUILD_OUTPUT, "res", flavor, type);
    } else {
        res = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "res");
    }

    if (FileFsFile.from(BUILD_OUTPUT, "assets").exists()) {
        assets = FileFsFile.from(BUILD_OUTPUT, "assets", flavor, type);
    } else {
        assets = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "assets");
    }

    if (FileFsFile.from(BUILD_OUTPUT, "manifests").exists()) {
        manifest = FileFsFile.from(BUILD_OUTPUT, "manifests", "full", flavor, type, "AndroidManifest.xml");
    } else {
        manifest = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "AndroidManifest.xml");
    }

    Logger.debug("Robolectric assets directory: " + assets.getPath());
    Logger.debug("   Robolectric res directory: " + res.getPath());
    Logger.debug("   Robolectric manifest path: " + manifest.getPath());
    Logger.debug("    Robolectric package name: " + packageName);
    return new AndroidManifest(manifest, res, assets, packageName);
}
 
开发者ID:AndruByrne,项目名称:rx-daggered-robogradler,代码行数:48,代码来源:RoboTestRunner.java

示例13: getAppManifest

import org.robolectric.res.FileFsFile; //导入依赖的package包/类
@Override
protected AndroidManifest getAppManifest(final Config config) {
  if (config.constants() == Void.class) {
    Logger.error("Field 'constants' not specified in @Config annotation");
    Logger.error("This is required when using RobolectricGradleTestRunner!");
    throw new RuntimeException("No 'constants' field in @Config annotation!");
  }

  final String type = getType(config);
  final String flavor = getFlavor(config);
  final String packageName = getPackageName(config);

  final FileFsFile res;
  final FileFsFile assets;
  final FileFsFile manifest;

  // res/merged added in Android Gradle plugin 1.3-beta1
  if (FileFsFile.from(BUILD_OUTPUT, "res", "merged").exists()) {
    res = FileFsFile.from(BUILD_OUTPUT, "res", "merged", flavor, type);
  } else if (FileFsFile.from(BUILD_OUTPUT, "res").exists()) {
    res = FileFsFile.from(BUILD_OUTPUT, "res", flavor, type);
  } else {
    res = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "res");
  }

  if (FileFsFile.from(BUILD_OUTPUT, "assets").exists()) {
    assets = FileFsFile.from(BUILD_OUTPUT, "assets", flavor, type);
  } else {
    assets = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "assets");
  }

  if (FileFsFile.from(BUILD_OUTPUT, "manifests").exists()) {
    manifest = FileFsFile.from(BUILD_OUTPUT, "manifests", "full", flavor, type, "AndroidManifest.xml");
  } else {
    manifest = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "AndroidManifest.xml");
  }

  Logger.debug("Robolectric assets directory: " + assets.getPath());
  Logger.debug("   Robolectric res directory: " + res.getPath());
  Logger.debug("   Robolectric manifest path: " + manifest.getPath());
  Logger.debug("    Robolectric package name: " + packageName);

  return new AndroidManifest(manifest, res, assets) {
    @Override
    public String getRClassName() throws Exception {
      return com.kickstarter.R.class.getName();
    }
  };
}
 
开发者ID:kickstarter,项目名称:android-oss,代码行数:50,代码来源:KSRobolectricGradleTestRunner.java

示例14: getAppManifest

import org.robolectric.res.FileFsFile; //导入依赖的package包/类
@Override
protected AndroidManifest getAppManifest(Config config) {
    if (config.constants() == Void.class) {
        Logger.error("Field 'constants' not specified in @Config annotation");
        Logger.error("This is required when using RobolectricGradleTestRunner!");
        throw new RuntimeException("No 'constants' field in @Config annotation!");
    }

    final String type = getType(config);
    final String flavor = getFlavor(config);
    final String packageName = getPackageName(config);

    final FileFsFile res;
    final FileFsFile assets;
    final FileFsFile manifest;

    // res/merged added in Android Gradle plugin 1.3-beta1
    if (FileFsFile.from(BUILD_OUTPUT, "res", "merged").exists()) {
        res = FileFsFile.from(BUILD_OUTPUT, "res", "merged", flavor, type);
    } else if (FileFsFile.from(BUILD_OUTPUT, "res").exists()) {
        res = FileFsFile.from(BUILD_OUTPUT, "res", flavor, type);
    } else {
        res = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "res");
    }

    if (FileFsFile.from(BUILD_OUTPUT, "assets").exists()) {
        assets = FileFsFile.from(BUILD_OUTPUT, "assets", flavor, type);
    } else {
        assets = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "assets");
    }

    if (FileFsFile.from(BUILD_OUTPUT, "manifests", "test", flavor, type, "AndroidManifest.xml").exists()) {
        manifest = FileFsFile.from(BUILD_OUTPUT, "manifests", "test", flavor, type, "AndroidManifest.xml");
    } else if (FileFsFile.from(BUILD_OUTPUT, "manifests", "full", flavor, type, "AndroidManifest.xml").exists()) {
        manifest = FileFsFile.from(BUILD_OUTPUT, "manifests", "full", flavor, type, "AndroidManifest.xml");
    } else {
        manifest = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "AndroidManifest.xml");
    }

    Logger.debug("Robolectric assets directory: " + assets.getPath());
    Logger.debug("   Robolectric res directory: " + res.getPath());
    Logger.debug("   Robolectric manifest path: " + manifest.getPath());
    Logger.debug("    Robolectric package name: " + packageName);
    return new AndroidManifest(manifest, res, assets, packageName);
}
 
开发者ID:ayvazj,项目名称:rokontrol-android,代码行数:46,代码来源:PatchedRobolectricGradleTestRunner.java

示例15: getAppManifest

import org.robolectric.res.FileFsFile; //导入依赖的package包/类
@Override
protected AndroidManifest getAppManifest(Config config) {
    if (config.constants() == Void.class) {
        Logger.error("Field 'constants' not specified in @Config annotation");
        Logger.error("This is required when using RobolectricGradleTestRunner!");
        throw new RuntimeException("No 'constants' field in @Config annotation!");
    }

    final String type = getType(config);
    final String flavor = getFlavor(config);
    final String packageName = getPackageName(config);

    final FileFsFile res;
    final FileFsFile assets;
    final FileFsFile manifest;

    if (FileFsFile.from(BUILD_OUTPUT, "data-binding-layout-out").exists()) {
        // Android gradle plugin 1.5.0+ puts the merged layouts in data-binding-layout-out.
        // https://github.com/robolectric/robolectric/issues/2143
        res = FileFsFile.from(BUILD_OUTPUT, "data-binding-layout-out", flavor, type);
    } else if (FileFsFile.from(BUILD_OUTPUT, "res", "merged").exists()) {
        // res/merged added in Android Gradle plugin 1.3-beta1
        res = FileFsFile.from(BUILD_OUTPUT, "res", "merged", flavor, type);
    } else if (FileFsFile.from(BUILD_OUTPUT, "res").exists()) {
        res = FileFsFile.from(BUILD_OUTPUT, "res", flavor, type);
    } else {
        res = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "res");
    }

    if (FileFsFile.from(BUILD_OUTPUT, "assets").exists()) {
        assets = FileFsFile.from(BUILD_OUTPUT, "assets", flavor, type);
    } else {
        assets = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "assets");
    }

    if (FileFsFile.from(BUILD_OUTPUT, "manifests").exists()) {
        manifest = FileFsFile.from(BUILD_OUTPUT, "manifests", "full", flavor, type, "AndroidManifest.xml");
    } else {
        manifest = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "AndroidManifest.xml");
    }

    Logger.debug("Robolectric assets directory: " + assets.getPath());
    Logger.debug("   Robolectric res directory: " + res.getPath());
    Logger.debug("   Robolectric manifest path: " + manifest.getPath());
    Logger.debug("    Robolectric package name: " + packageName);
    return new AndroidManifest(manifest, res, assets, packageName);
}
 
开发者ID:edx,项目名称:edx-app-android,代码行数:48,代码来源:DataBindingRobolectricGradleTestRunner.java


注:本文中的org.robolectric.res.FileFsFile类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。