[Esbox-commits] r928 - in branches/work_Ed: org.maemo.esbox-feature org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/tools org.maemo.esbox.maemosdk.tests org.maemo.esbox.maemosdk.tests/META-INF org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/internal/scratchbox/tests org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/scratchbox/core/sdk org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/preferences org.maemo.esbox.scratchbox.ui org.maemo.esbox.scratchbox.ui/src/org/maemo/esbox/internal/scratchbox/ui

eswartz at garage.maemo.org eswartz at garage.maemo.org
Mon Nov 10 18:56:53 EET 2008


Author: eswartz
Date: 2008-11-10 18:56:52 +0200 (Mon, 10 Nov 2008)
New Revision: 928

Added:
   branches/work_Ed/org.maemo.esbox.maemosdk.tests/plugin.xml
   branches/work_Ed/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/internal/scratchbox/tests/EdTestQemuConfiguration.java
Removed:
   branches/work_Ed/org.maemo.esbox.scratchbox.ui/src/org/maemo/esbox/internal/scratchbox/ui/actions/
Modified:
   branches/work_Ed/org.maemo.esbox-feature/feature.xml
   branches/work_Ed/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/tools/MaemoScriptLauncher.java
   branches/work_Ed/org.maemo.esbox.maemosdk.tests/META-INF/MANIFEST.MF
   branches/work_Ed/org.maemo.esbox.maemosdk.tests/build.properties
   branches/work_Ed/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/internal/scratchbox/tests/Activator.java
   branches/work_Ed/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/scratchbox/core/sdk/ScratchboxSDKFacade.java
   branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/preferences/Scratchbox1PreferencesPage.java
   branches/work_Ed/org.maemo.esbox.scratchbox.ui/plugin.xml
Log:
Checkpoint for VM support.  Currently works OK in workspace but unit tests are flaky due to asynchronous acquisition of VMs and SDKs.

Modified: branches/work_Ed/org.maemo.esbox-feature/feature.xml
===================================================================
--- branches/work_Ed/org.maemo.esbox-feature/feature.xml	2008-11-07 11:38:59 UTC (rev 927)
+++ branches/work_Ed/org.maemo.esbox-feature/feature.xml	2008-11-10 16:56:52 UTC (rev 928)
@@ -8,9 +8,9 @@
    <description>
       ESbox feature, containing all the ESbox-specific plugins.
    </description>
-   
+
    <copyright>
-      Copyright (c) 2007-2008 INdT, (c) 2007-2008 Nokia. All rights
+      Copyright (c) 2007-2008 INdT, (c) 2007-2008 Nokia. All rights
 reserved.
    </copyright>
 
@@ -59,4 +59,11 @@
          version="0.0.0"
          unpack="false"/>
 
+   <plugin
+         id="org.maemo.esbox.vm.qemu"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
 </feature>

Modified: branches/work_Ed/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/tools/MaemoScriptLauncher.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/tools/MaemoScriptLauncher.java	2008-11-07 11:38:59 UTC (rev 927)
+++ branches/work_Ed/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/tools/MaemoScriptLauncher.java	2008-11-10 16:56:52 UTC (rev 928)
@@ -736,6 +736,7 @@
 			throws MicaException {
 		if (monitor == null)
 			monitor = new NullProgressMonitor();
+		SDKFactory.getInstance().waitForRefreshComplete(monitor);
 		ISDK sdk = ProjectManager.getInstance().getSDK(project);
 		if (sdk == null)
 			throw new MicaException("Invalid SDK for project: " + project);

Modified: branches/work_Ed/org.maemo.esbox.maemosdk.tests/META-INF/MANIFEST.MF
===================================================================
--- branches/work_Ed/org.maemo.esbox.maemosdk.tests/META-INF/MANIFEST.MF	2008-11-07 11:38:59 UTC (rev 927)
+++ branches/work_Ed/org.maemo.esbox.maemosdk.tests/META-INF/MANIFEST.MF	2008-11-10 16:56:52 UTC (rev 928)
@@ -1,7 +1,7 @@
 Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: ESbox Scratchbox Feature Tests Plug-in
-Bundle-SymbolicName: org.maemo.esbox.scratchbox.tests
+Bundle-SymbolicName: org.maemo.esbox.scratchbox.tests;singleton:=true
 Bundle-Version: 2.0.0.qualifier
 Bundle-Activator: org.maemo.esbox.internal.scratchbox.tests.Activator
 Bundle-Vendor: INdT / Nokia
@@ -28,6 +28,8 @@
  org.maemo.esbox.scratchbox.sb1;bundle-version="2.0.0",
  org.maemo.esbox.scratchbox.sb2;bundle-version="2.0.0",
  org.maemo.esbox.scratchbox.core;bundle-version="2.0.0",
- org.maemo.esbox.maemosdk.core
+ org.maemo.esbox.maemosdk.core,
+ org.maemo.esbox.vm;bundle-version="2.0.0",
+ org.maemo.esbox.vm.qemu;bundle-version="2.0.0"
 Bundle-RequiredExecutionEnvironment: J2SE-1.5
 Bundle-ActivationPolicy: lazy

Modified: branches/work_Ed/org.maemo.esbox.maemosdk.tests/build.properties
===================================================================
--- branches/work_Ed/org.maemo.esbox.maemosdk.tests/build.properties	2008-11-07 11:38:59 UTC (rev 927)
+++ branches/work_Ed/org.maemo.esbox.maemosdk.tests/build.properties	2008-11-10 16:56:52 UTC (rev 928)
@@ -1,4 +1,5 @@
 source.. = src/
 output.. = bin/
 bin.includes = META-INF/,\
-               .
+               .,\
+               plugin.xml

Added: branches/work_Ed/org.maemo.esbox.maemosdk.tests/plugin.xml
===================================================================
--- branches/work_Ed/org.maemo.esbox.maemosdk.tests/plugin.xml	                        (rev 0)
+++ branches/work_Ed/org.maemo.esbox.maemosdk.tests/plugin.xml	2008-11-10 16:56:52 UTC (rev 928)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+   <extension
+         point="org.eclipse.ui.startup">
+      <startup></startup>
+   </extension>
+
+</plugin>

Modified: branches/work_Ed/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/internal/scratchbox/tests/Activator.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/internal/scratchbox/tests/Activator.java	2008-11-07 11:38:59 UTC (rev 927)
+++ branches/work_Ed/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/internal/scratchbox/tests/Activator.java	2008-11-10 16:56:52 UTC (rev 928)
@@ -10,13 +10,21 @@
  *******************************************************************************/
 package org.maemo.esbox.internal.scratchbox.tests;
 
+import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
+
+import org.eclipse.ui.IStartup;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.maemo.esbox.internal.vm.qemu.QemuMachine;
+import org.maemo.esbox.vm.core.IVirtualMachine;
+import org.maemo.esbox.vm.qemu.IQemuConfiguration;
+import org.maemo.mica.common.core.HostUtils;
+import org.maemo.mica.common.core.machine.*;
 import org.osgi.framework.BundleContext;
 
 /**
  * The activator class controls the plug-in life cycle
  */
-public class Activator extends AbstractUIPlugin {
+public class Activator extends AbstractUIPlugin implements IStartup, IBuildMachineConfigurationListener {
 
 	// The plug-in ID
 	public static final String PLUGIN_ID = "org.maemo.esbox.scratchbox.tests";
@@ -36,7 +44,7 @@
 	 */
 	public void start(BundleContext context) throws Exception {
 		super.start(context);
-		plugin = this;
+		plugin = this;
 	}
 
 	/*
@@ -56,5 +64,35 @@
 	public static Activator getDefault() {
 		return plugin;
 	}
-
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.ui.IStartup#earlyStartup()
+	 */
+	public void earlyStartup() {
+		// wire ourselves up to handle selecting the build machine
+		if (WorkbenchUtils.isJUnitRunning()) {
+			MachineRegistry.getInstance().addBuildMachineConfigurationListener(
+					this);
+		}
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.maemo.mica.common.core.machine.IBuildMachineConfigurationListener#buildMachineConfigurationNeeded()
+	 */
+	public void buildMachineConfigurationNeeded() {
+		// Under a JUnit test, we will forcibly inject the known VM with the known
+		// configuration
+		if (HostUtils.isWindows()) { /// TODO XXX: macos
+			IQemuConfiguration config = new EdTestQemuConfiguration();
+			QemuMachine machine = new QemuMachine(config);
+			MachineRegistry.getInstance().setCurrentBuildMachine(machine);
+		}
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.maemo.mica.common.core.machine.IBuildMachineConfigurationListener#buildMachinesChanged()
+	 */
+	public void buildMachinesChanged() {
+		
+	}
 }

Added: branches/work_Ed/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/internal/scratchbox/tests/EdTestQemuConfiguration.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/internal/scratchbox/tests/EdTestQemuConfiguration.java	                        (rev 0)
+++ branches/work_Ed/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/internal/scratchbox/tests/EdTestQemuConfiguration.java	2008-11-10 16:56:52 UTC (rev 928)
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.scratchbox.tests;
+
+import org.eclipse.core.runtime.Platform;
+import org.maemo.esbox.vm.qemu.IQemuConfiguration;
+import org.maemo.mica.common.core.machine.ISharedFilesystemProvider;
+import org.maemo.mica.internal.api.common.core.machine.StockSharedFilesystemProvider;
+import org.maemo.mica.protocol.ssh.SSHConfiguration;
+
+/**
+ * This configuration corresponds to Ed's own qemu image.
+ * @author eswartz
+ *
+ */
+public class EdTestQemuConfiguration implements IQemuConfiguration {
+
+	private SSHConfiguration sshConfiguration = new SSHConfiguration(
+			"127.0.0.1", 2222, 
+			"10.0.2.2", 22,
+			"devel", "qatest", 
+			10 /*timeout*/ 
+			);
+
+	/* (non-Javadoc)
+	 * @see org.maemo.mica.common.core.machine.IQemuConfiguration#getOS()
+	 */
+	public String getOS() {
+		return Platform.OS_LINUX;
+	}
+	
+	/* (non-Javadoc)
+	 * @see testrse.IQemuConfiguration#getSSHConfiguration()
+	 */
+	public SSHConfiguration getSSHConfiguration() {
+		return sshConfiguration;
+	}
+
+	/* (non-Javadoc)
+	 * @see testrse.IQemuConfiguration#getBiosPath()
+	 */
+	public String getInstallPath() {
+		return "c:/Program Files/Qemu";
+	}
+
+	/* (non-Javadoc)
+	 * @see testrse.IQemuConfiguration#getDiskImagePath()
+	 */
+	public String getDiskImagePath() {
+		return "c:/Program Files/Nokia/Carbide for Maemo/vm/hda.img";
+	}
+
+	/* (non-Javadoc)
+	 * @see testrse.IQemuConfiguration#getExecutable()
+	 */
+	public String getExecutable() {
+		return "c:/program files/qemu/qemu.exe";
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.maemo.mica.common.core.machine.IQemuConfiguration#getSharedFilesystemProvider()
+	 */
+	public ISharedFilesystemProvider getSharedFilesystemProvider() {
+		return new StockSharedFilesystemProvider(sshConfiguration.getUserName());
+	}
+
+	/* (non-Javadoc)
+	 * @see org.maemo.mica.common.core.machine.IQemuConfiguration#getCIFSPort()
+	 */
+	public int getCIFSPort() {
+		return 4445;
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.vm.qemu.IQemuConfiguration#getCommandLaunchPattern()
+	 */
+	public String getCommandLaunchPattern() {
+		return "\"${QEMU}\" -kernel-kqemu -hda \"${DISK_PATH}\" -usb -L \"${INSTALL_PATH}\" " +
+		"-m ${MEMORY} -redir tcp:${SSH_PORT}::22 "+
+		"-hdb \"c:/Program Files/Nokia/Carbide for Maemo/vm/hdb.img\"";
+				
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.vm.qemu.IQemuConfiguration#getMemorySize()
+	 */
+	public int getMemorySize() {
+		return 512;
+	}
+}

Modified: branches/work_Ed/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/scratchbox/core/sdk/ScratchboxSDKFacade.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/scratchbox/core/sdk/ScratchboxSDKFacade.java	2008-11-07 11:38:59 UTC (rev 927)
+++ branches/work_Ed/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/scratchbox/core/sdk/ScratchboxSDKFacade.java	2008-11-10 16:56:52 UTC (rev 928)
@@ -11,8 +11,7 @@
  *******************************************************************************/
 package org.maemo.esbox.scratchbox.core.sdk;
 
-import java.util.ArrayList;
-import java.util.List;
+import java.util.*;
 
 import org.maemo.esbox.scratchbox.core.scratchbox.ScratchboxException;
 import org.maemo.mica.common.core.sdk.*;
@@ -41,13 +40,14 @@
 	/**
 	 * Get the (first) scratchbox 1 installation on the system.
 	 * 
-	 * @return {@link IScratchbox1SDK}, never <code>null</code>
+	 * @return list of IScratchbox1SDK, never <code>null</code>
 	 * @throws ScratchboxException
-	 *             if no scratchbox 1 SDK available
+	 *             if no scratchbox SDKs available
 	 * */
-	public List<IScratchboxSDK> getAllScratchboxSDKs()
+	public synchronized List<IScratchboxSDK> getAllScratchboxSDKs()
 			throws ScratchboxException {
 		if (scratchboxSDKs == null) {
+			SDKFactory.getInstance().waitForRefreshComplete(null);
 			List<ISDK> sdks = SDKFactory.getInstance().getSDKs();
 			scratchboxSDKs = new ArrayList<IScratchboxSDK>();
 			for (ISDK sdk : sdks) {
@@ -86,7 +86,7 @@
 		try {
 			sboxSDKs = getAllScratchboxSDKs();
 		} catch (ScratchboxException e) {
-
+			sboxSDKs = Collections.emptyList();
 		}
 		for (IScratchboxSDK sboxSDK : sboxSDKs) {
 			ISDKTarget[] targets = sboxSDK.getSDKTargets();

Modified: branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/preferences/Scratchbox1PreferencesPage.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/preferences/Scratchbox1PreferencesPage.java	2008-11-07 11:38:59 UTC (rev 927)
+++ branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/preferences/Scratchbox1PreferencesPage.java	2008-11-10 16:56:52 UTC (rev 928)
@@ -11,7 +11,6 @@
 
 package org.maemo.esbox.internal.scratchbox.sb1.ui.preferences;
 
-import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.jface.preference.*;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
@@ -147,7 +146,8 @@
 				String curSandboxRoot = getPreferenceStore().getString(
 						SB1PreferenceConstants.SB1_SBOX_SANDBOX.toString());
 				if (!curSandboxRoot.equals(origSandboxRoot)) {
-					SDKFactory.getInstance().refresh(new NullProgressMonitor());
+					// asynchronous
+					SDKFactory.getInstance().refresh(true);
 					origSandboxRoot = curSandboxRoot;
 				}
 			}

Modified: branches/work_Ed/org.maemo.esbox.scratchbox.ui/plugin.xml
===================================================================
--- branches/work_Ed/org.maemo.esbox.scratchbox.ui/plugin.xml	2008-11-07 11:38:59 UTC (rev 927)
+++ branches/work_Ed/org.maemo.esbox.scratchbox.ui/plugin.xml	2008-11-10 16:56:52 UTC (rev 928)
@@ -1,27 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?eclipse version="3.2"?>
 <plugin>
-   <extension
-         point="org.eclipse.ui.commands">
-      <command
-            categoryId="org.eclipse.ui.category.help"
-            defaultHandler="org.maemo.esbox.internal.scratchbox.ui.actions.ValidateVirtualMachineCommand"
-            description="Validate launching and communication with ESbox virtual machine"
-            id="org.maemo.esbox.scratchbox.ui.validateVirtualMachineCommand"
-            name="Validate ESbox Virtual Machine">
-      </command>
-   </extension>
-   <extension
-         point="org.eclipse.ui.menus">
-      <menuContribution
-            locationURI="menu:help?after=additions">
-         <command
-               commandId="org.maemo.esbox.scratchbox.ui.validateVirtualMachineCommand"
-               mnemonic="V"
-               style="push"
-               tooltip="Run to ensure that the virtual machine build host is properly configured.">
-         </command>
-      </menuContribution>
-   </extension>
+ 
 
 </plugin>



More information about the Esbox-commits mailing list