Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Testing problems
Testing problems [message #1413843] Fri, 29 August 2014 15:07 Go to next message
Beatriz SanchezFriend
Messages: 22
Registered: July 2014
Location: York
Junior Member
I'm having trouble using the runAs with the ClientTest tag. I believe I'm doing the same thing as in the autotest example but apparently it doesn't recognize the default user declared in the AutotestClientUtility class.
When I check the log I see that it's my eclipse user the one who's active during tests. How can I change this? Is it the Multyclient? The cookieManager?
Also, is there a way to use the basicSecurityFilter instead of the multiclient?
I'm not sure what more to say, so if I didn't make myself clear go ahead and ask for details.


The Autotest ClientUtility : https://github.com/innovad/scout.autotest.demo/blob/06f53439906d8225f46a065d77f56abec843001b/org.eclipse.scout.autotest.client.test/src/org/eclipse/autotest/client/test/AutotestClientUtility.java

[Updated on: Thu, 04 September 2014 13:40]

Report message to a moderator

Re: Testing problems [message #1414730 is a reply to message #1413843] Mon, 01 September 2014 07:08 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
Can you tell what is not working? (Stacktrace or a description
Re: Testing problems [message #1420601 is a reply to message #1414730] Wed, 10 September 2014 07:52 Go to previous messageGo to next message
Beatriz SanchezFriend
Messages: 22
Registered: July 2014
Location: York
Junior Member
Sorry for the delay.
Like in the autotest example, I tried to run client tests by creating new sessions with the multiclient authenticator in the ClientUtility class. However this didn't seem to work. I then added the BasicSecurityFilter to the server product for client tests and also to the client tests product and it did work. I had to add a function to read these parammeters from the config.ini. The problem is that this only works in eclipse since in maven tycho makes a new config.ini file with the default testRuntime, so the tests fail.. When I use the multiclient authenticator it uses my eclipse user or my computer name instead of the predefined users that I add manually.

	public static Object installNetAuthenticator() {
		LOG.info("Test Authentication Installation");
		BundleContext bundleContext = FrameworkUtil.getBundle(MyProjectClientUtility.class).getBundleContext();
		ServiceRegistration<?> serviceRegistration = null;
		Hashtable<String, Object> map = new Hashtable<String, Object>();
		map.put(Constants.SERVICE_RANKING, 1);

		// add credentials of test users
		MultiClientAuthenticator.addUser("admin", "admin");
		MultiClientAuthenticator.addUser("user", "user");
		MultiClientAuthenticator.setDefaultUser("admin");

		MultiClientAuthenticator multiClientAuthenticator = new MultiClientAuthenticator();
		serviceRegistration = bundleContext.registerService(java.net.Authenticator.class.getName(), multiClientAuthenticator, map);

		checkParameters();

		// start the netBundle, it is not started from OSGI because no references exists
		Bundle netBundle = Platform.getBundle("org.eclipse.scout.net");
		if (netBundle != null) {
			try {
				netBundle.start();
				LOG.info("Testing Net Authenticator STARTED");
			}
			catch (BundleException bundleExeption) {
				LOG.error(bundleExeption.getCause().getMessage());
				bundleExeption.printStackTrace();
				netBundle = null;
			}
		}
		else {
			LOG.info("Testing Net Authenticator NOT STARTED");
		}
		return serviceRegistration;
	}

	public static void installCookieStore() {
		CookieManager.setDefault(new CookieManager(new MultiClientSessionCookieStore(), CookiePolicy.ACCEPT_ALL));
	}

	private static void checkParameters() {
		Properties props = System.getProperties();
		
		if (TypeCastUtility.castValue(getConfigParameter(BASIC_SECURITY_FILTER), boolean.class)){
			props.setProperty(BASIC_SECURITY_FILTER, "false");
		} else {
			props.setProperty(BASIC_SECURITY_FILTER, "true");
		}
		System.setProperties(props);
		LOG.info("changed property security filter?");
		LOG.info("new value of " + BASIC_SECURITY_FILTER + " = " + System.getProperty(BASIC_SECURITY_FILTER));
	}
	
	private static String getConfigParameter(String parameterName) {
		String commandLineArgumentName = "-" + parameterName + "=";
		for (String arg : Platform.getCommandLineArgs()) {
			if (arg != null && arg.startsWith(commandLineArgumentName)) {
				return arg.substring(commandLineArgumentName.length());
			}
		}
		return System.getProperty(parameterName);
	}


If I could stop depending in the config.ini it would be great to test the users.

But there are also other issues.. my feature is not beeing read.. this is something I hadn't seen. Apparently, in the autotest example, when we execute the surefire plugin we add the corresponding feature.group that references the feature. I hadn't realized that I had miswritten the configuration that references the server feature (so it wasn't beeing read, since it did the same thing when I removed those lines) and tests have passed anyway. I don't know how to reference the feature. It always says that it cannot find it either if I reference it as an eclipse-feature or a p2-installable-unit. Maybe if I fix this it would make everything work...
I've tried with both:
<groupId>com.my.project</groupId>
<artifactId>com.my.project.server.feature</artifactId>
<type>eclipse-feature</type>

and
<type>p2-installable-unit</type>
<id>com.my.project.server.feature.feature.group</id>
<versionRange>0.0.0</versionRange>

[Updated on: Fri, 12 September 2014 10:59]

Report message to a moderator

Re: Testing problems [message #1422120 is a reply to message #1420601] Fri, 12 September 2014 10:59 Go to previous message
Beatriz SanchezFriend
Messages: 22
Registered: July 2014
Location: York
Junior Member
Since the feature problem might be whats affecting me I would like to know what's wrong with my configuration

I get this error :
You requested to install 'com.my.project.server.feature.feature.group 0.0.0' but it could not be found

My project com.my.project.server.feature has same id and artifactId and version number.
On my parent plugins I have :
			<!-- Tycho Maven Plugin -->
			<plugin>
				<groupId>org.eclipse.tycho</groupId>
				<artifactId>tycho-maven-plugin</artifactId>
				<version>${tycho.version}</version>
				<extensions>true</extensions>
			</plugin>

			<!-- Tycho Target Platform Configuration Plugin -->
			<plugin>
				<groupId>org.eclipse.tycho</groupId>
				<artifactId>target-platform-configuration</artifactId>
				<configuration>
					<resolver>p2</resolver>
					<pomDependencies>consider</pomDependencies>
					<target>
						<artifact>
							<groupId>com.my.project</groupId>
							<artifactId>com.my.project.target</artifactId>
							<classifier>nexus</classifier>
						</artifact>
					</target>
					<environments>
						<environment>
							<os>win32</os>
							<ws>win32</ws>
							<arch>x86</arch>
						</environment>
					</environments>
					<ignoreTychoRepositories>false</ignoreTychoRepositories>
				</configuration>
			</plugin>
And on the plugin manager
			<!-- Tycho Target Platform Configuration Plugin -->
				<plugin>
					<groupId>org.eclipse.tycho</groupId>
					<artifactId>target-platform-configuration</artifactId>
					<version>${tycho.version}</version>
					<!-- <configuration>
						<filters>
							<filter> 
								<type>p2-installable-unit</type>
								<id>org.eclipse.equinox.servletbridge.extensionbundle</id>
								<removeAll />
							</filter>
						</filters>
					</configuration> -->
				</plugin>

				<!--
				 | PACKAGING
				 ¡ -->

				<!-- Tycho p2 Director Plugin -->
				<plugin>
					<groupId>org.eclipse.tycho</groupId>
					<artifactId>tycho-p2-director-plugin</artifactId>
					<version>${tycho.version}</version>
					<!-- 
					<configuration>
						<installFeatures>true</installFeatures>
					</configuration>
					 -->
				</plugin>
				
				<plugin>
					<groupId>org.eclipse.tycho</groupId>
					<artifactId>tycho-p2-repository-plugin</artifactId>
					<version>${tycho.version}</version>
					<configuration>
						<includeAllDependencies>true</includeAllDependencies>
					</configuration>
				</plugin>


On my server.test.fragment I have:

			<plugin>
				<groupId>org.eclipse.tycho</groupId>
				<artifactId>tycho-surefire-plugin</artifactId>
				<configuration>
					<argLine>${arg.Line}</argLine>
					<dependencies>
						<dependency>
							<type>eclipse-feature</type>
							<artifactId>com.my.project.server.feature</artifactId>
							<version>0.0.0</version>
						</dependency>
					</dependencies>
				</configuration>
			</plugin>


what am I doing wrong?
Previous Topic:Tree & visibility
Next Topic:RAP customize loading panel
Goto Forum:
  


Current Time: Tue Apr 23 13:18:21 GMT 2024

Powered by FUDForum. Page generated in 0.04263 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top