Ignore devices.xml in test when it can't exist
authorEd Swartz <ed.swartz@nokia.com>
Wed, 09 Dec 2009 08:32:42 -0600
changeset 655 e78a18b4b6a0
parent 654 3d9b565b1b72
child 656 4b577b57a028
Ignore devices.xml in test when it can't exist
project/com.nokia.carbide.cpp.project.core.tests/src/com/nokia/carbide/cpp/project/core/tests/MissingSdkTest.java
--- a/project/com.nokia.carbide.cpp.project.core.tests/src/com/nokia/carbide/cpp/project/core/tests/MissingSdkTest.java	Wed Dec 09 08:31:57 2009 -0600
+++ b/project/com.nokia.carbide.cpp.project.core.tests/src/com/nokia/carbide/cpp/project/core/tests/MissingSdkTest.java	Wed Dec 09 08:32:42 2009 -0600
@@ -30,6 +30,7 @@
 import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
 import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration;
 import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo;
+import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils;
 import com.nokia.carbide.cpp.internal.api.sdk.SDKManagerInternalAPI;
 import com.nokia.carbide.cpp.internal.api.sdk.SymbianBuildContext;
 import com.nokia.carbide.cpp.project.core.ProjectCorePlugin;
@@ -48,23 +49,30 @@
 	}
 	
 	public void testMissingSdk () throws Exception {
-		File devicesFile = SDKCorePlugin.getSDKManager().getDevicesXMLFile(); 
-		assertNotNull("Devices.xml file is NULL!", devicesFile);
-		assertTrue(devicesFile.toString() + "file doesn't exist", devicesFile.exists());
-		File backupFile = new File(devicesFile.toString() + ".backup");
+		
+		File devicesFile = null;
+		File backupFile = null;
+		if (SBSv2Utils.enableSBSv1Support()) {
+			devicesFile = SDKCorePlugin.getSDKManager().getDevicesXMLFile(); 
+			assertNotNull("Devices.xml file is NULL!", devicesFile);
+			assertTrue(devicesFile.toString() + " file doesn't exist", devicesFile.exists());
+			backupFile = new File(devicesFile.toString() + ".backup");
+		}
 		
 		try {
 			ISDKManager sdkManager = SDKCorePlugin.getSDKManager();
 			List<ISymbianSDK> sdkList = sdkManager.getSDKList();
 			assertNotNull(sdkList);
 	
-			if (backupFile.exists()) {
-				backupFile.delete();
+			if (devicesFile != null && backupFile != null) {
+				if (backupFile.exists()) {
+					backupFile.delete();
+				}
+				backupFile.createNewFile();
+			
+				// backup devices.xml
+				copyFile(devicesFile, backupFile);
 			}
-			backupFile.createNewFile();
-			
-			// backup devices.xml
-			copyFile(devicesFile, backupFile);
 			
 			IProject project = null;
 			ISymbianSDK lastSdkFound = null;