Bug 356668 - Test case fails when Aptana Studio 3 is installed
Summary: Test case fails when Aptana Studio 3 is installed
Status: NEW
Alias: None
Product: EGit
Classification: Technology
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-03 13:14 EDT by François Rey CLA
Modified: 2011-09-04 08:48 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description François Rey CLA 2011-09-03 13:14:52 EDT
With Aptana Studio 3.0.4 and eGit 1.1 dev installed the following test case fails:
org.eclipse.egit.core.test.GitProjectSetCapabilityTest.testImport()
It fails because import does not result in the project being shared, see junit log below.

I wasn't able to determine the exact cause of this bug, it may be some race condition.
Here's what I've found so far:
- Aptana Studio 3 (AS3) provides its own git plugin, based on git cli. By default AS3 has autosharing enabled, meaning it automatically shares a project containing a .git dir. The bug seems to be linked to AS3 autosharing and happens even if its disabled (which makes sense since JUnit workspace use the default value). Debugging shows that Aptana team provider is used within the test case, see further the stacktrace upon loading com.aptana.git.core.GitRepositoryProviderType. Autosharing is invoked during project.open(monitor) called by
org.eclipse.egit.core.GitProjectSetCapability.addToWorkspace(String[], ProjectSetSerializationContext, IProgressMonitor)
It goes through the following key methods:
org.eclipse.team.internal.core.TeamResourceChangeListener.handleUnsharedProjectChanges(IProject, IResourceDelta)
which calls
com.aptana.git.core.GitRepositoryProviderType.metaFilesDetected(IProject, IContainer[])

- In any case it seems weird that the test case fails because the repository provider for the imported project is null. Code in GitProjectSetCapability.addToWorkspace() calls executes a ConnectProviderOperation right after the project.open() is invoked. Later on it seems that when ConnectProviderOperation calls RepositoryProvider.map() to map to the egit provider, it's already been mapped to aptana's provider, so map() calls unmap().
Also weird is the error log from junit:
Actual: null
Expected: null

Anyway, more investigation is required but I don't have enough knowledge about eclipse internals and it would take too much of my time. I'll just ignore this test for now while developing on egit. Perhaps someone else can pick this up.
I do think it's a valid egit bug because it's possibly a race condition that could be resolved in GitProjectSetCapability and/or ConnectProviderOperation.

-- Error Log from JUnit --
==============
Class: org.eclipse.egit.core.test.GitProjectSetCapabilityTest
Method: testImport
Actual: null
Expected: null
Stack Trace:
java.lang.AssertionError: 
	at org.junit.Assert.fail(Assert.java:91)
	at org.junit.Assert.assertTrue(Assert.java:43)
	at org.junit.Assert.assertNotNull(Assert.java:524)
	at org.junit.Assert.assertNotNull(Assert.java:535)
	at org.eclipse.egit.core.test.GitProjectSetCapabilityTest.testImport(GitProjectSetCapabilityTest.java:131)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
	at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62)
	at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:23)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:587)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1386)

Stacktrace upon loading com.aptana.git.core.GitRepositoryProviderType class
==============================================
Thread [main] (Class load: GitRepositoryProviderType)	
	Class<T>.getDeclaredConstructors0(boolean) line: not available [native method]	
	Class<T>.privateGetDeclaredConstructors(boolean) line: 2389	
	Class<T>.getConstructor0(Class[], int) line: 2699	
	Class<T>.newInstance0() line: 326	
	Class<T>.newInstance() line: 308	
	EquinoxRegistryStrategy(RegistryStrategyOSGI).createExecutableExtension(RegistryContributor, String, String) line: 184	
	ExtensionRegistry.createExecutableExtension(RegistryContributor, String, String) line: 905	
	ConfigurationElement.createExecutableExtension(String) line: 243	
	ConfigurationElementHandle.createExecutableExtension(String) line: 55	
	RepositoryProviderType.newProviderType(String) line: 143	
	RepositoryProviderType.getProviderType(String) line: 83	
	TeamResourceChangeListener.handleUnsharedProjectChanges(IProject, IResourceDelta) line: 94	
	TeamResourceChangeListener.resourceChanged(IResourceChangeEvent) line: 54	
	NotificationManager$1.run() line: 291	
	SafeRunner.run(ISafeRunnable) line: 42	
	NotificationManager.notify(ResourceChangeListenerList$ListenerEntry[], IResourceChangeEvent, boolean) line: 285	
	NotificationManager.broadcastChanges(ElementTree, ResourceChangeEvent, boolean) line: 149	
	Workspace.broadcastPostChange() line: 395	
	Workspace.endOperation(ISchedulingRule, boolean, IProgressMonitor) line: 1530	
	Project.open(int, IProgressMonitor) line: 1167	
	Project.open(IProgressMonitor) line: 1178	
	GitProjectSetCapability.addToWorkspace(String[], ProjectSetSerializationContext, IProgressMonitor) line: 229	
	GitProjectSetCapabilityTest.testImport() line: 122	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25	
	Method.invoke(Object, Object...) line: 597	
	FrameworkMethod$1.runReflectiveCall() line: 44	
	FrameworkMethod$1(ReflectiveCallable).run() line: 15	
	FrameworkMethod.invokeExplosively(Object, Object...) line: 41	
	InvokeMethod.evaluate() line: 20	
	RunBefores.evaluate() line: 28	
	RunAfters.evaluate() line: 31	
	BlockJUnit4ClassRunner.runNotIgnored(FrameworkMethod, EachTestNotifier) line: 79	
	BlockJUnit4ClassRunner.runChild(FrameworkMethod, RunNotifier) line: 71	
	BlockJUnit4ClassRunner.runChild(Object, RunNotifier) line: 49	
	ParentRunner$3.run() line: 193	
	ParentRunner$1.schedule(Runnable) line: 52	
	BlockJUnit4ClassRunner(ParentRunner<T>).runChildren(RunNotifier) line: 191	
	ParentRunner<T>.access$000(ParentRunner, RunNotifier) line: 42	
	ParentRunner$2.evaluate() line: 184	
	BlockJUnit4ClassRunner(ParentRunner<T>).run(RunNotifier) line: 236	
	JUnit4TestClassReference(JUnit4TestReference).run(TestExecution) line: 50	
	TestExecution.run(ITestReference[]) line: 38	
	RemotePluginTestRunner(RemoteTestRunner).runTests(String[], String, TestExecution) line: 467	
	RemotePluginTestRunner(RemoteTestRunner).runTests(TestExecution) line: 683	
	RemotePluginTestRunner(RemoteTestRunner).run() line: 390	
	RemotePluginTestRunner.main(String[]) line: 62	
	CoreTestApplication.run(Object) line: 23	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25	
	Method.invoke(Object, Object...) line: 597	
	EclipseAppContainer.callMethodWithException(Object, String, Class[], Object[]) line: 587	
	EclipseAppHandle.run(Object) line: 198	
	EclipseAppLauncher.runApplication(Object) line: 110	
	EclipseAppLauncher.start(Object) line: 79	
	EclipseStarter.run(Object) line: 344	
	EclipseStarter.run(String[], Runnable) line: 179	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25	
	Method.invoke(Object, Object...) line: 597	
	Main.invokeFramework(String[], URL[]) line: 622	
	Main.basicRun(String[]) line: 577	
	Main.run(String[]) line: 1410	
	Main.main(String[]) line: 1386