use of com.android.sdklib.IAndroidTarget in project android by JetBrains.
the class AndroidSdksTest method testFindSuitableAndroidSdk.
public void testFindSuitableAndroidSdk() {
IAndroidTarget target = findAndroidTarget();
Sdk sdk = myAndroidSdks.create(target, mySdkPath, myJdk, false);
assertNotNull(sdk);
String hash = getTargetHashString(target);
Sdk foundSdk = myAndroidSdks.findSuitableAndroidSdk(hash);
assertNotNull(foundSdk);
assertEquals(sdk.getHomePath(), foundSdk.getHomePath());
AndroidSdkAdditionalData data = getAndroidSdkAdditionalData(foundSdk);
assertEquals(hash, data.getBuildTargetHashString());
}
use of com.android.sdklib.IAndroidTarget in project android by JetBrains.
the class AndroidSdksTest method testCreateSdk.
public void testCreateSdk() {
IAndroidTarget target = findAndroidTarget();
String name = "testSdk";
Sdk sdk = myAndroidSdks.create(target, mySdkPath, name, myJdk, true);
assertNotNull(sdk);
assertEquals(name, sdk.getName());
verifyCorrectPath(sdk);
AndroidSdkAdditionalData androidData = getAndroidSdkAdditionalData(sdk);
assertSame(myJdk, androidData.getJavaSdk());
AndroidPlatform androidPlatform = androidData.getAndroidPlatform();
assertNotNull(androidPlatform);
assertSame(target, androidPlatform.getTarget());
File platformPath = new File(mySdkPath, join("platforms", androidData.getBuildTargetHashString()));
// Check roots added to SDK
Map<String, VirtualFile> classRootsByName = getSdkRootsByName(sdk, CLASSES);
// android.jar and res folder
assertThat(classRootsByName).hasSize(2);
VirtualFile androidJar = classRootsByName.get("android.jar");
File expectedAndroidJarPath = new File(platformPath, androidJar.getName());
assertAbout(file()).that(virtualToIoFile(androidJar)).isEquivalentAccordingToCompareTo(expectedAndroidJarPath);
VirtualFile resFolder = classRootsByName.get("res");
File expectedResFolderPath = new File(platformPath, join("data", resFolder.getName()));
assertAbout(file()).that(virtualToIoFile(resFolder)).isEquivalentAccordingToCompareTo(expectedResFolderPath);
}
use of com.android.sdklib.IAndroidTarget in project android by JetBrains.
the class AndroidSdksTest method createTargetWithApiLevel.
@NotNull
private static IAndroidTarget createTargetWithApiLevel(int apiLevel) {
AndroidVersion version = new AndroidVersion(apiLevel, null);
IAndroidTarget target = mock(IAndroidTarget.class);
when(target.getVersion()).thenReturn(version);
return target;
}
use of com.android.sdklib.IAndroidTarget in project android by JetBrains.
the class AndroidSdksTest method testNeedsAnnotationsJarInClasspathWithApiLevel15.
public void testNeedsAnnotationsJarInClasspathWithApiLevel15() {
IAndroidTarget target = createTargetWithApiLevel(15);
assertTrue(myAndroidSdks.needsAnnotationsJarInClasspath(target));
}
use of com.android.sdklib.IAndroidTarget in project android by JetBrains.
the class AndroidSdksTest method testChooseNameForNewLibrary.
public void testChooseNameForNewLibrary() {
IAndroidTarget target = findAndroidTarget();
String name = myAndroidSdks.chooseNameForNewLibrary(target);
assertEquals("Android " + target.getVersion().toString() + " Platform", name);
}
Aggregations