aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbveliev2011-10-22 10:31:43 (EDT)
committerbveliev2011-10-22 10:31:43 (EDT)
commit8f128927fe1d93a0e32c3cfd7c8a4553a2b77139 (patch)
tree0896c5f2615ad4851f5773b7f0f7092f0e322962
parentaa0fd5a0bdaecd9c5ca337471d6739c616b48a21 (diff)
downloadorg.eclipse.rtp-8f128927fe1d93a0e32c3cfd7c8a4553a2b77139.zip
org.eclipse.rtp-8f128927fe1d93a0e32c3cfd7c8a4553a2b77139.tar.gz
org.eclipse.rtp-8f128927fe1d93a0e32c3cfd7c8a4553a2b77139.tar.bz2
NEW - bug 361729: [Configurator] Change default service API to use model
objects as parameters instead of string parameters https://bugs.eclipse.org/bugs/show_bug.cgi?id=361729
-rw-r--r--bundles/org.eclipse.rtp.configurator.console/META-INF/MANIFEST.MF4
-rw-r--r--bundles/org.eclipse.rtp.configurator.console/OSGI-INF/rtpConfiguratorServiceReference.xml2
-rw-r--r--bundles/org.eclipse.rtp.configurator.console/src/org/eclipse/rtp/configurator/console/CommandDelegateImpl.java17
-rw-r--r--bundles/org.eclipse.rtp.configurator.console/src/org/eclipse/rtp/configurator/console/internal/CommandUtil.java54
-rw-r--r--bundles/org.eclipse.rtp.core.service.provider/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.rtp.core.service.provider/OSGI-INF/rtpConfiguratorServiceProvider.xml4
-rw-r--r--bundles/org.eclipse.rtp.core.service.provider/build.properties4
-rw-r--r--bundles/org.eclipse.rtp.core.service.provider/data/real-sources.json33
-rw-r--r--bundles/org.eclipse.rtp.core.service.provider/src/org/eclipse/rtp/configurator/service/provider/internal/RTPDefaultService.java (renamed from bundles/org.eclipse.rtp.core.service.provider/src/org/eclipse/rtp/configurator/service/provider/internal/DefaultConfiguratorService.java)120
-rw-r--r--bundles/org.eclipse.rtp.core/META-INF/MANIFEST.MF9
-rw-r--r--bundles/org.eclipse.rtp.core/OSGI-INF/rtpConfiguratorModel.xml (renamed from bundles/org.eclipse.rtp.core.service.provider/OSGI-INF/rtpConfiguratorModel.xml)2
-rw-r--r--bundles/org.eclipse.rtp.core/build.properties6
-rw-r--r--bundles/org.eclipse.rtp.core/data/juno-sources.json (renamed from bundles/org.eclipse.rtp.core.service.provider/data/juno-sources.json)0
-rw-r--r--bundles/org.eclipse.rtp.core/src/org/eclipse/rtp/core/IRTPService.java (renamed from bundles/org.eclipse.rtp.core/src/org/eclipse/rtp/configurator/core/IConfiguratorService.java)9
-rw-r--r--bundles/org.eclipse.rtp.core/src/org/eclipse/rtp/core/internal/RTPCoreActivator.java23
-rw-r--r--bundles/org.eclipse.rtp.core/src/org/eclipse/rtp/core/util/ModelUtil.java (renamed from bundles/org.eclipse.rtp.core.service.provider/src/org/eclipse/rtp/configurator/service/provider/internal/util/ModelUtil.java)67
-rw-r--r--tests/org.eclipse.rtp.configurator.console.test/src/org/eclipse/rtp/configurator/console/internal/CommandUtilTest.java76
-rw-r--r--tests/org.eclipse.rtp.configurator.console.test/src/org/eclipse/rtp/configurator/console/internal/util/Fixture.java31
-rw-r--r--tests/org.eclipse.rtp.core.model.test/build.properties3
-rw-r--r--tests/org.eclipse.rtp.core.model.test/data/example-sources.json (renamed from bundles/org.eclipse.rtp.core.service.provider/data/example-sources.json)0
-rw-r--r--tests/org.eclipse.rtp.core.service.provider.test/src/org/eclipse/rtp/configurator/service/provider/internal/ConfiguratorServiceSearchTest.java6
-rw-r--r--tests/org.eclipse.rtp.core.service.provider.test/src/org/eclipse/rtp/configurator/service/provider/internal/ConfiguratorServiceTest.java40
-rw-r--r--tests/org.eclipse.rtp.core.service.provider.test/src/org/eclipse/rtp/configurator/service/provider/internal/util/Fixture.java3
-rw-r--r--tests/org.eclipse.rtp.core.service.provider.test/src/org/eclipse/rtp/configurator/service/provider/internal/util/ModelUtilTest.java16
-rw-r--r--tests/org.eclipse.rtp.core.test/.classpath1
-rw-r--r--tests/org.eclipse.rtp.core.test/META-INF/MANIFEST.MF2
-rw-r--r--tests/org.eclipse.rtp.core.test/src/org/eclipse/rtp/core/ModelUtilTest.java17
27 files changed, 347 insertions, 204 deletions
diff --git a/bundles/org.eclipse.rtp.configurator.console/META-INF/MANIFEST.MF b/bundles/org.eclipse.rtp.configurator.console/META-INF/MANIFEST.MF
index edb8f89..ed33a38 100644
--- a/bundles/org.eclipse.rtp.configurator.console/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.rtp.configurator.console/META-INF/MANIFEST.MF
@@ -8,4 +8,6 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: org.eclipse.core.runtime;version="3.4.0",
org.eclipse.osgi.framework.console;version="1.1.0"
Service-Component: OSGI-INF/rtpCommandProviderComponent.xml, OSGI-INF/rtpConfiguratorServiceReference.xml
-Require-Bundle: org.eclipse.rtp.core;bundle-version="1.0.0"
+Require-Bundle: org.eclipse.rtp.core;bundle-version="1.0.0",
+ org.eclipse.rtp.core.model;bundle-version="1.0.0",
+ org.eclipse.osgi;bundle-version="3.7.0"
diff --git a/bundles/org.eclipse.rtp.configurator.console/OSGI-INF/rtpConfiguratorServiceReference.xml b/bundles/org.eclipse.rtp.configurator.console/OSGI-INF/rtpConfiguratorServiceReference.xml
index 25ad335..6213a2c 100644
--- a/bundles/org.eclipse.rtp.configurator.console/OSGI-INF/rtpConfiguratorServiceReference.xml
+++ b/bundles/org.eclipse.rtp.configurator.console/OSGI-INF/rtpConfiguratorServiceReference.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.rtp.configurator.console">
<implementation class="org.eclipse.rtp.configurator.console.CommandDelegateImpl"/>
- <reference bind="setUp" cardinality="1..1" interface="org.eclipse.rtp.configurator.core.IConfiguratorService" name="IConfiguratorService" policy="static" unbind="shutDown"/>
+ <reference bind="setUp" cardinality="1..1" interface="org.eclipse.rtp.core.IRTPService" name="IRTPService" policy="static" unbind="shutDown"/>
</scr:component>
diff --git a/bundles/org.eclipse.rtp.configurator.console/src/org/eclipse/rtp/configurator/console/CommandDelegateImpl.java b/bundles/org.eclipse.rtp.configurator.console/src/org/eclipse/rtp/configurator/console/CommandDelegateImpl.java
index b029dc4..47d85ac 100644
--- a/bundles/org.eclipse.rtp.configurator.console/src/org/eclipse/rtp/configurator/console/CommandDelegateImpl.java
+++ b/bundles/org.eclipse.rtp.configurator.console/src/org/eclipse/rtp/configurator/console/CommandDelegateImpl.java
@@ -11,19 +11,22 @@ import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.rtp.configurator.core.IConfiguratorService;
+import org.eclipse.rtp.configurator.console.internal.CommandUtil;
+import org.eclipse.rtp.core.IRTPService;
+import org.eclipse.rtp.core.model.SourceVersion;
public class CommandDelegateImpl implements CommandDelegate {
- private static IConfiguratorService configurationService;
+ private static IRTPService configurationService;
+ private static CommandUtil commandUtil;
private final static String TAB = "\t"; //$NON-NLS-1$
private final static String NEW_LINE = "\r\n"; //$NON-NLS-1$
- public static void setUp( IConfiguratorService service ) {
+ public static void setUp( IRTPService service ) {
CommandDelegateImpl.configurationService = service;
}
- public static void shutDown( IConfiguratorService service ) {
+ public static void shutDown( IRTPService service ) {
CommandDelegateImpl.configurationService = null;
}
@@ -87,7 +90,8 @@ public class CommandDelegateImpl implements CommandDelegate {
* Should install an iu to the latest version. The name of the iu ist the first list entry. If
* the secodn entry is not a OSGI.version than the latest should be installed.
*/
- configurationService.install( parameter );
+ SourceVersion sourceVersion = commandUtil.getSourceVersions( parameter );
+ configurationService.install( sourceVersion );
}
@Override
@@ -103,7 +107,8 @@ public class CommandDelegateImpl implements CommandDelegate {
/*
* removes a spcific compoment. Same parameter as install
*/
- configurationService.remove( anyListOf );
+ List<SourceVersion> sourceVersionsToUninstall = commandUtil.getSourceVersionsToUninstall( anyListOf );
+ configurationService.remove( sourceVersionsToUninstall );
}
@Override
diff --git a/bundles/org.eclipse.rtp.configurator.console/src/org/eclipse/rtp/configurator/console/internal/CommandUtil.java b/bundles/org.eclipse.rtp.configurator.console/src/org/eclipse/rtp/configurator/console/internal/CommandUtil.java
new file mode 100644
index 0000000..8b682a0
--- /dev/null
+++ b/bundles/org.eclipse.rtp.configurator.console/src/org/eclipse/rtp/configurator/console/internal/CommandUtil.java
@@ -0,0 +1,54 @@
+package org.eclipse.rtp.configurator.console.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.rtp.core.model.Source;
+import org.eclipse.rtp.core.model.SourceVersion;
+import org.eclipse.rtp.core.util.ModelUtil;
+
+public class CommandUtil {
+
+ public SourceVersion getSourceVersions( List<String> parameter ) {
+ List<Source> sources = getSources();
+ List<String> sourceName = new ArrayList<String>();
+ sourceName.add( getSourceNameParameter( parameter ) );
+ ModelUtil modelUtil = getModelUtil();
+ List<Source> searchSources = modelUtil.searchSources( sourceName, sources );
+ SourceVersion sourceVersion = modelUtil.searchSourceVerions( getVersionParameter( parameter ),
+ searchSources );
+ return sourceVersion;
+ }
+
+ private String getSourceNameParameter( List<String> parameters ) {
+ return parameters.isEmpty()
+ ? ""
+ : parameters.get( 0 );
+ }
+
+ public List<SourceVersion> getSourceVersionsToUninstall( List<String> anyListOf ) {
+ List<SourceVersion> result = new ArrayList<SourceVersion>();
+ List<Source> sources = getSources();
+ ModelUtil modelUtil = getModelUtil();
+ List<Source> sourceToUinstall = modelUtil.searchSources( anyListOf, sources );
+ for( Source source : sourceToUinstall ) {
+ result.addAll( source.getVersions() );
+ }
+ return result;
+ }
+
+ protected List<Source> getSources() {
+ List<Source> sources = ModelUtil.getSourceProvider().getSources();
+ return sources;
+ }
+
+ protected ModelUtil getModelUtil() {
+ return new ModelUtil();
+ }
+
+ private String getVersionParameter( List<String> parameters ) {
+ return parameters.size() > 1
+ ? parameters.get( 1 )
+ : "";
+ }
+}
diff --git a/bundles/org.eclipse.rtp.core.service.provider/META-INF/MANIFEST.MF b/bundles/org.eclipse.rtp.core.service.provider/META-INF/MANIFEST.MF
index fa5bfaa..bf07e53 100644
--- a/bundles/org.eclipse.rtp.core.service.provider/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.rtp.core.service.provider/META-INF/MANIFEST.MF
@@ -9,7 +9,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.rtp.core.model;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
-Service-Component: OSGI-INF/rtpConfiguratorServiceProvider.xml, OSGI-INF/rtpConfigurator.xml, OSGI-INF/rtpConfiguratorModel.xml
+Service-Component: OSGI-INF/rtpConfiguratorServiceProvider.xml, OSGI-INF/rtpConfigurator.xml
Bundle-Activator: org.eclipse.rtp.configurator.service.provider.internal.ProviderActivator
Import-Package: org.apache.commons.io;version="2.0.1",
org.eclipse.equinox.internal.provisional.configurator,
diff --git a/bundles/org.eclipse.rtp.core.service.provider/OSGI-INF/rtpConfiguratorServiceProvider.xml b/bundles/org.eclipse.rtp.core.service.provider/OSGI-INF/rtpConfiguratorServiceProvider.xml
index f72610f..bc83a3c 100644
--- a/bundles/org.eclipse.rtp.core.service.provider/OSGI-INF/rtpConfiguratorServiceProvider.xml
+++ b/bundles/org.eclipse.rtp.core.service.provider/OSGI-INF/rtpConfiguratorServiceProvider.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="setUp" name="org.eclipse.rtp.core.service.provider">
- <implementation class="org.eclipse.rtp.configurator.service.provider.internal.DefaultConfiguratorService"/>
+ <implementation class="org.eclipse.rtp.configurator.service.provider.internal.RTPDefaultService"/>
<service>
- <provide interface="org.eclipse.rtp.configurator.core.IConfiguratorService"/>
+ <provide interface="org.eclipse.rtp.core.IRTPService"/>
</service>
</scr:component>
diff --git a/bundles/org.eclipse.rtp.core.service.provider/build.properties b/bundles/org.eclipse.rtp.core.service.provider/build.properties
index d4dcada..2bb8207 100644
--- a/bundles/org.eclipse.rtp.core.service.provider/build.properties
+++ b/bundles/org.eclipse.rtp.core.service.provider/build.properties
@@ -2,7 +2,5 @@ output.. = bin/
bin.includes = META-INF/,\
.,\
OSGI-INF/,\
- data/
+ OSGI-INF/rtpConfiguratorServiceProvider.xml
source.. = src/
-bin.excludes = data/real-sources.json,\
- data/example-sources.json
diff --git a/bundles/org.eclipse.rtp.core.service.provider/data/real-sources.json b/bundles/org.eclipse.rtp.core.service.provider/data/real-sources.json
deleted file mode 100644
index 3887b8e..0000000
--- a/bundles/org.eclipse.rtp.core.service.provider/data/real-sources.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- "sources": [
- {
- "name": "rap",
- "description": "RAP",
- "infoUrl": "http://www.eclipse.org/rap/",
- "versions": [
- {
- "features": [ { id : "org.eclipse.rap.tooling.feature.group", version : "1.4.1.20110914-1945" }],
- "version": "1.4.1",
- "repositoryUrl": "http://download.eclipse.org/rt/rap/1.4/tooling"
- },
- {
- "features": [ { id : "org.eclipse.rap.tooling.feature.group", version : "1.4.0" }],
- "version": "1.4.0",
- "repositoryUrl": "http://download.eclipse.org/rt/rap/1.4/tooling"
- }
- ]
- },
- {
- "name": "equinox",
- "description": "Some text3",
- "infoUrl": "http://foo.bar/info3",
- "versions": [
- {
- "features": [ { id : "org.eclipse.rap.feature.group", version : "2.5.0" }, { id : "org.eclipse.rap.feature.group.ext", version : "1.5.0" } ],
- "version": "3.8.1",
- "repositoryUrl": "http://foo.bar3"
- }
- ]
- }
- ]
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.rtp.core.service.provider/src/org/eclipse/rtp/configurator/service/provider/internal/DefaultConfiguratorService.java b/bundles/org.eclipse.rtp.core.service.provider/src/org/eclipse/rtp/configurator/service/provider/internal/RTPDefaultService.java
index 76d606d..8e1b852 100644
--- a/bundles/org.eclipse.rtp.core.service.provider/src/org/eclipse/rtp/configurator/service/provider/internal/DefaultConfiguratorService.java
+++ b/bundles/org.eclipse.rtp.core.service.provider/src/org/eclipse/rtp/configurator/service/provider/internal/RTPDefaultService.java
@@ -11,24 +11,22 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Comparator;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.rtp.configurator.core.IConfiguratorService;
import org.eclipse.rtp.configurator.service.provider.internal.deploy.FeatureInstallException;
import org.eclipse.rtp.configurator.service.provider.internal.deploy.FeatureManager;
import org.eclipse.rtp.configurator.service.provider.internal.deploy.RepositoryManager;
-import org.eclipse.rtp.configurator.service.provider.internal.util.ModelUtil;
import org.eclipse.rtp.configurator.service.provider.internal.util.P2Util;
+import org.eclipse.rtp.core.IRTPService;
import org.eclipse.rtp.core.model.Source;
import org.eclipse.rtp.core.model.SourceVersion;
-import org.osgi.framework.Version;
+import org.eclipse.rtp.core.util.ModelUtil;
-public class DefaultConfiguratorService implements IConfiguratorService {
+public class RTPDefaultService implements IRTPService {
private P2Util p2Util;
@@ -45,16 +43,15 @@ public class DefaultConfiguratorService implements IConfiguratorService {
}
@Override
- public IStatus install( List<String> parameter ) {
+ public IStatus install( SourceVersion sourceVersion ) {
IStatus result = null;
try {
- SourceVersion sourceVersion = getSourceVersions( parameter );
if( sourceVersion != null ) {
System.out.println( "Loading repository: " + sourceVersion.getRepositoryUrl() );
loadRepository( sourceVersion );
System.out.println( "Repository loaded: " + sourceVersion.getRepositoryUrl() );
System.out.println( "Installation started" );
- install( sourceVersion );
+ installVersion( sourceVersion );
System.out.println( "Installaiton successful" );
result = Status.OK_STATUS;
} else {
@@ -72,23 +69,7 @@ public class DefaultConfiguratorService implements IConfiguratorService {
return result;
}
- private SourceVersion getSourceVersions( List<String> parameter ) {
- List<Source> sources = ModelUtil.getSourceProvider().getSources();
- List<String> sourceName = new ArrayList<String>();
- sourceName.add( parameter.get( 0 ) );
- List<Source> searchSources = searchSources( sourceName, sources );
- SourceVersion sourceVersion = searchSourceVerions( getVersionParameter( parameter ),
- searchSources );
- return sourceVersion;
- }
-
- private String getVersionParameter( List<String> parameters ) {
- return parameters.size() > 1
- ? parameters.get( 1 )
- : "";
- }
-
- private void install( SourceVersion sourceVersion ) throws FeatureInstallException {
+ private void installVersion( SourceVersion sourceVersion ) throws FeatureInstallException {
FeatureManager featureManager = p2Util.getFeatureManager();
featureManager.installFeature( sourceVersion );
}
@@ -98,35 +79,9 @@ public class DefaultConfiguratorService implements IConfiguratorService {
repositoryManager.addRepository( new URI( sourceVersion.getRepositoryUrl() ) );
}
- private SourceVersion searchSourceVerions( String sourceVersion, List<Source> sources ) {
- SourceVersion result = null;
- for( Source source : sources ) {
- List<SourceVersion> versions = source.getVersions();
- result = getVersion( sourceVersion, versions );
- }
- return result;
- }
-
- private SourceVersion getVersion( String sourceVersion, List<SourceVersion> versions ) {
- SourceVersion result = null;
- Collections.sort( versions, getSourceVersionComparator() );
- if( sourceVersion == null || sourceVersion.length() == 0 ) {
- result = versions.get( 0 );
- } else {
- for( SourceVersion version : versions ) {
- if( version.getVersion().equals( sourceVersion ) ) {
- result = version;
- }
- }
- }
- return result;
- }
-
@Override
- public IStatus remove( List<String> anyListOf ) {
+ public IStatus remove( List<SourceVersion> sourceVersionsToUnisntall ) {
FeatureManager featureManager = p2Util.getFeatureManager();
- List<SourceVersion> sourceVersionsToUnisntall = getSourceVersionsToUninstall( anyListOf,
- featureManager );
List<IStatus> errorStatus = uninstall( featureManager, sourceVersionsToUnisntall );
return errorStatus.isEmpty()
? Status.OK_STATUS
@@ -137,18 +92,6 @@ public class DefaultConfiguratorService implements IConfiguratorService {
null );
}
- private List<SourceVersion> getSourceVersionsToUninstall( List<String> anyListOf,
- FeatureManager featureManager )
- {
- List<SourceVersion> result = new ArrayList<SourceVersion>();
- List<Source> sources = ModelUtil.getSourceProvider().getSources();
- List<Source> sourceToUinstall = searchSources( anyListOf, sources );
- for( Source source : sourceToUinstall ) {
- result.addAll( source.getVersions() );
- }
- return result;
- }
-
private List<IStatus> uninstall( FeatureManager featureManager,
List<SourceVersion> sourceVersionsToUnisntall )
{
@@ -173,7 +116,7 @@ public class DefaultConfiguratorService implements IConfiguratorService {
@Override
public List<String> search( List<String> anyListOf ) {
List<Source> sources = ModelUtil.getSourceProvider().getSources();
- List<Source> result = searchSources( anyListOf, sources );
+ List<Source> result = searchSources( sources, anyListOf );
return getSortedSources( result );
}
@@ -182,7 +125,7 @@ public class DefaultConfiguratorService implements IConfiguratorService {
List<Source> sources = ModelUtil.getSourceProvider().getSources();
List<String> showSource = new ArrayList<String>();
showSource.add( anyListOf.get( 0 ) );
- List<Source> result = searchSources( showSource, sources );
+ List<Source> result = searchSources( sources, showSource );
return getSortedSources( result );
}
@@ -197,13 +140,18 @@ public class DefaultConfiguratorService implements IConfiguratorService {
public IStatus update( List<String> anyListOf ) {
List<Source> sources = ModelUtil.getSourceProvider().getSources();
System.out.println( "Searching for updates" );
- List<Source> sourceToUpdate = searchSources( anyListOf, sources );
+ List<Source> sourceToUpdate = searchSources( sources, anyListOf );
System.out.println( "Update started" );
IStatus result = updateSources( sourceToUpdate );
System.out.println( "Update successful" );
return result;
}
+ protected List<Source> searchSources( List<Source> sources, List<String> showSource ) {
+ List<Source> result = new ModelUtil().searchSources( showSource, sources );
+ return result;
+ }
+
@Override
public IStatus updateWorld() {
List<Source> sources = ModelUtil.getSourceProvider().getSources();
@@ -218,13 +166,12 @@ public class DefaultConfiguratorService implements IConfiguratorService {
FeatureManager featureManager = p2Util.getFeatureManager();
for( Source source : sources ) {
List<SourceVersion> versions = source.getVersions();
- Collections.sort( versions, getSourceVersionComparator() );
+ Collections.sort( versions, new ModelUtil().getSourceVersionComparator() );
SourceVersion latestSourceVersion = versions.get( 0 );
if( !featureManager.isInstalled( latestSourceVersion ) ) {
System.out.println( "Updating feature: " + source.getName() );
updateStatusList.addAll( uninstall( featureManager, versions ) );
- List<String> parameters = getInstallParameters( source, latestSourceVersion );
- updateStatusList.add( install( parameters ) );
+ updateStatusList.add( install( latestSourceVersion ) );
}
}
IStatus result = new MultiStatus( ProviderActivator.BUNDLE_ID,
@@ -235,39 +182,6 @@ public class DefaultConfiguratorService implements IConfiguratorService {
return result;
}
- private List<String> getInstallParameters( Source source, SourceVersion latestSourceVersion ) {
- List<String> parameters = new ArrayList<String>();
- parameters.add( source.getName() );
- parameters.add( latestSourceVersion.getVersion() );
- return parameters;
- }
-
- private Comparator<SourceVersion> getSourceVersionComparator() {
- Comparator<SourceVersion> comparator = new Comparator<SourceVersion>() {
-
- @Override
- public int compare( SourceVersion arg0, SourceVersion arg1 ) {
- String version = arg0.getVersion();
- String version2 = arg1.getVersion();
- return new Version( version2 ).compareTo( new Version( version ) );
- }
- };
- return comparator;
- }
-
- private List<Source> searchSources( List<String> anyListOf, List<Source> sources ) {
- List<Source> result = new ArrayList<Source>();
- for( Source source : sources ) {
- String name = source.getName();
- for( String term : anyListOf ) {
- if( name.contains( term ) ) {
- result.add( source );
- }
- }
- }
- return result;
- }
-
private List<String> getSortedSources( List<Source> sources ) {
List<String> sourcesAsString = new ArrayList<String>();
for( Source source : sources ) {
diff --git a/bundles/org.eclipse.rtp.core/META-INF/MANIFEST.MF b/bundles/org.eclipse.rtp.core/META-INF/MANIFEST.MF
index bd95665..8ed37dc 100644
--- a/bundles/org.eclipse.rtp.core/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.rtp.core/META-INF/MANIFEST.MF
@@ -5,5 +5,10 @@ Bundle-SymbolicName: org.eclipse.rtp.core
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: EclipseSource
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Export-Package: org.eclipse.rtp.configurator.core
-Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)"
+Export-Package: org.eclipse.rtp.core,
+ org.eclipse.rtp.core.util
+Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)",
+ org.eclipse.rtp.core.model;bundle-version="1.0.0"
+Service-Component: OSGI-INF/rtpConfiguratorModel.xml
+Bundle-Activator: org.eclipse.rtp.core.internal.RTPCoreActivator
+Bundle-ActivationPolicy: lazy
diff --git a/bundles/org.eclipse.rtp.core.service.provider/OSGI-INF/rtpConfiguratorModel.xml b/bundles/org.eclipse.rtp.core/OSGI-INF/rtpConfiguratorModel.xml
index 5af8f2b..46606c8 100644
--- a/bundles/org.eclipse.rtp.core.service.provider/OSGI-INF/rtpConfiguratorModel.xml
+++ b/bundles/org.eclipse.rtp.core/OSGI-INF/rtpConfiguratorModel.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.rtp.core.service.provider.model">
- <implementation class="org.eclipse.rtp.configurator.service.provider.internal.util.ModelUtil"/>
+ <implementation class="org.eclipse.rtp.core.util.ModelUtil"/>
<reference bind="setUnMarshaller" cardinality="1..1" interface="org.eclipse.rtp.core.model.SourceUnMarshaller" name="SourceUnMarshaller" policy="static" unbind="unsetUnMarshaller"/>
</scr:component>
diff --git a/bundles/org.eclipse.rtp.core/build.properties b/bundles/org.eclipse.rtp.core/build.properties
index e256c3f..66c6d76 100644
--- a/bundles/org.eclipse.rtp.core/build.properties
+++ b/bundles/org.eclipse.rtp.core/build.properties
@@ -1,4 +1,8 @@
output.. = bin/
bin.includes = META-INF/,\
- .
+ .,\
+ data/,\
+ OSGI-INF/
source.. = src/
+bin.excludes = data/real-sources.json,\
+ data/example-sources.json
diff --git a/bundles/org.eclipse.rtp.core.service.provider/data/juno-sources.json b/bundles/org.eclipse.rtp.core/data/juno-sources.json
index c76f264..c76f264 100644
--- a/bundles/org.eclipse.rtp.core.service.provider/data/juno-sources.json
+++ b/bundles/org.eclipse.rtp.core/data/juno-sources.json
diff --git a/bundles/org.eclipse.rtp.core/src/org/eclipse/rtp/configurator/core/IConfiguratorService.java b/bundles/org.eclipse.rtp.core/src/org/eclipse/rtp/core/IRTPService.java
index 826286a..43d8d7e 100644
--- a/bundles/org.eclipse.rtp.core/src/org/eclipse/rtp/configurator/core/IConfiguratorService.java
+++ b/bundles/org.eclipse.rtp.core/src/org/eclipse/rtp/core/IRTPService.java
@@ -5,20 +5,21 @@
* http://www.eclipse.org/legal/epl-v10.html Contributors: EclipseSource - initial API and
* implementation
*******************************************************************************/
-package org.eclipse.rtp.configurator.core;
+package org.eclipse.rtp.core;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.rtp.core.model.SourceVersion;
-public interface IConfiguratorService {
+public interface IRTPService {
- IStatus install( List<String> parameter );
+ IStatus install( SourceVersion sourceVersion );
IStatus update( List<String> anyListOf );
- IStatus remove( List<String> anyListOf );
+ IStatus remove( List<SourceVersion> sourceVersionsToUnisntall );
List<String> search( List<String> anyListOf );
diff --git a/bundles/org.eclipse.rtp.core/src/org/eclipse/rtp/core/internal/RTPCoreActivator.java b/bundles/org.eclipse.rtp.core/src/org/eclipse/rtp/core/internal/RTPCoreActivator.java
new file mode 100644
index 0000000..a90b042
--- /dev/null
+++ b/bundles/org.eclipse.rtp.core/src/org/eclipse/rtp/core/internal/RTPCoreActivator.java
@@ -0,0 +1,23 @@
+package org.eclipse.rtp.core.internal;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class RTPCoreActivator implements BundleActivator {
+
+ public static String BUNDLE_ID = "org.eclipse.rtp.coree";
+ private static BundleContext bundleContext;
+
+ @Override
+ public void start( BundleContext context ) throws Exception {
+ bundleContext = context;
+ }
+
+ @Override
+ public void stop( BundleContext context ) throws Exception {
+ bundleContext = null;
+ }
+
+ public static BundleContext getBundleContext() {
+ return bundleContext;
+ }
+}
diff --git a/bundles/org.eclipse.rtp.core.service.provider/src/org/eclipse/rtp/configurator/service/provider/internal/util/ModelUtil.java b/bundles/org.eclipse.rtp.core/src/org/eclipse/rtp/core/util/ModelUtil.java
index 321926e..bf054ae 100644
--- a/bundles/org.eclipse.rtp.core.service.provider/src/org/eclipse/rtp/configurator/service/provider/internal/util/ModelUtil.java
+++ b/bundles/org.eclipse.rtp.core/src/org/eclipse/rtp/core/util/ModelUtil.java
@@ -5,15 +5,22 @@
* http://www.eclipse.org/legal/epl-v10.html Contributors: EclipseSource - initial API and
* implementation
*******************************************************************************/
-package org.eclipse.rtp.configurator.service.provider.internal.util;
+package org.eclipse.rtp.core.util;
import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
-import org.eclipse.rtp.configurator.service.provider.internal.ProviderActivator;
+import org.eclipse.rtp.core.internal.RTPCoreActivator;
+import org.eclipse.rtp.core.model.Source;
import org.eclipse.rtp.core.model.SourceProvider;
import org.eclipse.rtp.core.model.SourceUnMarshaller;
+import org.eclipse.rtp.core.model.SourceVersion;
+import org.osgi.framework.Version;
public class ModelUtil {
@@ -64,7 +71,7 @@ public class ModelUtil {
private static String getLocalURL() {
String result = "";
try {
- URL unresolvedURL = FileLocator.find( ProviderActivator.getBundleContext().getBundle(),
+ URL unresolvedURL = FileLocator.find( RTPCoreActivator.getBundleContext().getBundle(),
new Path( "data/juno-sources.json" ),
null );
result = FileLocator.resolve( unresolvedURL ).toExternalForm();
@@ -74,7 +81,57 @@ public class ModelUtil {
return result;
}
- protected static String getConfigurationURL() {
- return ProviderActivator.getBundleContext().getProperty( CONFIGURATION_URL );
+ public static String getConfigurationURL() {
+ return RTPCoreActivator.getBundleContext().getProperty( CONFIGURATION_URL );
+ }
+
+ public Comparator<SourceVersion> getSourceVersionComparator() {
+ Comparator<SourceVersion> comparator = new Comparator<SourceVersion>() {
+
+ @Override
+ public int compare( SourceVersion arg0, SourceVersion arg1 ) {
+ String version = arg0.getVersion();
+ String version2 = arg1.getVersion();
+ return new Version( version2 ).compareTo( new Version( version ) );
+ }
+ };
+ return comparator;
+ }
+
+ public List<Source> searchSources( List<String> anyListOf, List<Source> sources ) {
+ List<Source> result = new ArrayList<Source>();
+ for( Source source : sources ) {
+ String name = source.getName();
+ for( String term : anyListOf ) {
+ if( term.length() > 0 && name.contains( term ) ) {
+ result.add( source );
+ }
+ }
+ }
+ return result;
+ }
+
+ public SourceVersion searchSourceVerions( String sourceVersion, List<Source> sources ) {
+ SourceVersion result = null;
+ for( Source source : sources ) {
+ List<SourceVersion> versions = source.getVersions();
+ result = getVersion( sourceVersion, versions );
+ }
+ return result;
+ }
+
+ public SourceVersion getVersion( String sourceVersion, List<SourceVersion> versions ) {
+ SourceVersion result = null;
+ Collections.sort( versions, getSourceVersionComparator() );
+ if( sourceVersion == null || sourceVersion.length() == 0 ) {
+ result = versions.get( 0 );
+ } else {
+ for( SourceVersion version : versions ) {
+ if( version.getVersion().equals( sourceVersion ) ) {
+ result = version;
+ }
+ }
+ }
+ return result;
}
}
diff --git a/tests/org.eclipse.rtp.configurator.console.test/src/org/eclipse/rtp/configurator/console/internal/CommandUtilTest.java b/tests/org.eclipse.rtp.configurator.console.test/src/org/eclipse/rtp/configurator/console/internal/CommandUtilTest.java
new file mode 100644
index 0000000..67923e0
--- /dev/null
+++ b/tests/org.eclipse.rtp.configurator.console.test/src/org/eclipse/rtp/configurator/console/internal/CommandUtilTest.java
@@ -0,0 +1,76 @@
+package org.eclipse.rtp.configurator.console.internal;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.rtp.configurator.console.internal.util.Fixture;
+import org.eclipse.rtp.core.model.Source;
+import org.eclipse.rtp.core.model.SourceProvider;
+import org.eclipse.rtp.core.model.SourceVersion;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class CommandUtilTest {
+
+ private CommandUtil commandUtil;
+ private List<Source> exampleSources;
+
+ @Before
+ public void setUp() throws Exception {
+ exampleSources = getExampleSources();
+ commandUtil = new CommandUtil() {
+
+ @Override
+ protected List<Source> getSources() {
+ return exampleSources;
+ }
+ };
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetSourceVersions() {
+ Source source = exampleSources.get( 0 );
+ List<String> parameters = new ArrayList<String>();
+ parameters.add( source.getName() );
+ parameters.add( "1.4" );
+ SourceVersion sourceVersions = commandUtil.getSourceVersions( parameters );
+ assertEquals( source.getVersions().get( 0 ), sourceVersions );
+ }
+
+ @Test
+ public void testNoParametersProvided() {
+ List<String> parameters = new ArrayList<String>();
+ SourceVersion sourceVersions = commandUtil.getSourceVersions( parameters );
+ assertNull( sourceVersions );
+ }
+
+ @Test
+ public void testGetSourceVersionsToUninstall() {
+ Source source = exampleSources.get( 0 );
+ List<String> parameters = new ArrayList<String>();
+ parameters.add( source.getName() );
+ List<SourceVersion> sourceVersions = commandUtil.getSourceVersionsToUninstall( parameters );
+ assertEquals( source.getVersions(), sourceVersions );
+ }
+
+ @Test
+ public void testUninstallEmptyList() {
+ List<String> parameters = new ArrayList<String>();
+ List<SourceVersion> sourceVersions = commandUtil.getSourceVersionsToUninstall( parameters );
+ assertEquals( 0, sourceVersions.size() );
+ }
+
+ private List<Source> getExampleSources() throws IOException {
+ SourceProvider sourceProvider = Fixture.getSourceProvider( Fixture.readExampleSources() );
+ return sourceProvider.getSources();
+ }
+}
diff --git a/tests/org.eclipse.rtp.configurator.console.test/src/org/eclipse/rtp/configurator/console/internal/util/Fixture.java b/tests/org.eclipse.rtp.configurator.console.test/src/org/eclipse/rtp/configurator/console/internal/util/Fixture.java
new file mode 100644
index 0000000..68255be
--- /dev/null
+++ b/tests/org.eclipse.rtp.configurator.console.test/src/org/eclipse/rtp/configurator/console/internal/util/Fixture.java
@@ -0,0 +1,31 @@
+package org.eclipse.rtp.configurator.console.internal.util;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.rtp.core.model.SourceProvider;
+import org.eclipse.rtp.core.model.SourceUnMarshaller;
+import org.eclipse.rtp.core.util.ModelUtil;
+import org.osgi.framework.Bundle;
+
+public class Fixture {
+
+ public static InputStream readExampleSources() throws IOException {
+ Bundle bundle = Platform.getBundle( "org.eclipse.rtp.core.model.test" );
+ URL unResolvedUrl = FileLocator.find( bundle, new Path( "data/example-sources.json" ), null );
+ URL testDataUrl = FileLocator.resolve( unResolvedUrl );
+ File testDataFile = new Path( testDataUrl.getFile() ).toFile();
+ return new FileInputStream( testDataFile );
+ }
+
+ public static SourceProvider getSourceProvider( InputStream inputStream ) {
+ SourceUnMarshaller marshaller = ModelUtil.getSourceUnMarshaller();
+ return marshaller.marshal( inputStream );
+ }
+}
diff --git a/tests/org.eclipse.rtp.core.model.test/build.properties b/tests/org.eclipse.rtp.core.model.test/build.properties
index 34d2e4d..be6734d 100644
--- a/tests/org.eclipse.rtp.core.model.test/build.properties
+++ b/tests/org.eclipse.rtp.core.model.test/build.properties
@@ -1,4 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
- .
+ .,\
+ data/
diff --git a/bundles/org.eclipse.rtp.core.service.provider/data/example-sources.json b/tests/org.eclipse.rtp.core.model.test/data/example-sources.json
index ff65b7e..ff65b7e 100644
--- a/bundles/org.eclipse.rtp.core.service.provider/data/example-sources.json
+++ b/tests/org.eclipse.rtp.core.model.test/data/example-sources.json
diff --git a/tests/org.eclipse.rtp.core.service.provider.test/src/org/eclipse/rtp/configurator/service/provider/internal/ConfiguratorServiceSearchTest.java b/tests/org.eclipse.rtp.core.service.provider.test/src/org/eclipse/rtp/configurator/service/provider/internal/ConfiguratorServiceSearchTest.java
index 00c885d..0df013a 100644
--- a/tests/org.eclipse.rtp.core.service.provider.test/src/org/eclipse/rtp/configurator/service/provider/internal/ConfiguratorServiceSearchTest.java
+++ b/tests/org.eclipse.rtp.core.service.provider.test/src/org/eclipse/rtp/configurator/service/provider/internal/ConfiguratorServiceSearchTest.java
@@ -17,21 +17,21 @@ import java.util.Collections;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.rtp.configurator.service.provider.internal.util.ModelUtil;
import org.eclipse.rtp.configurator.service.provider.internal.util.Fixture;
import org.eclipse.rtp.core.model.Source;
import org.eclipse.rtp.core.model.SourceProvider;
+import org.eclipse.rtp.core.util.ModelUtil;
import org.junit.Before;
import org.junit.Test;
public class ConfiguratorServiceSearchTest {
private SourceProvider provider;
- private DefaultConfiguratorService configuratorService;
+ private RTPDefaultService configuratorService;
@Before
public void setUp() throws IOException {
- configuratorService = new DefaultConfiguratorService();
+ configuratorService = new RTPDefaultService();
InputStream stream = Fixture.readExampleSources();
provider = Fixture.getSourceProvider( stream );
ModelUtil.setSourceProvider( provider );
diff --git a/tests/org.eclipse.rtp.core.service.provider.test/src/org/eclipse/rtp/configurator/service/provider/internal/ConfiguratorServiceTest.java b/tests/org.eclipse.rtp.core.service.provider.test/src/org/eclipse/rtp/configurator/service/provider/internal/ConfiguratorServiceTest.java
index e7d28a6..379f64b 100644
--- a/tests/org.eclipse.rtp.core.service.provider.test/src/org/eclipse/rtp/configurator/service/provider/internal/ConfiguratorServiceTest.java
+++ b/tests/org.eclipse.rtp.core.service.provider.test/src/org/eclipse/rtp/configurator/service/provider/internal/ConfiguratorServiceTest.java
@@ -29,18 +29,18 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.rtp.configurator.service.provider.internal.deploy.FeatureInstallException;
import org.eclipse.rtp.configurator.service.provider.internal.deploy.FeatureManager;
import org.eclipse.rtp.configurator.service.provider.internal.deploy.RepositoryManager;
-import org.eclipse.rtp.configurator.service.provider.internal.util.ModelUtil;
import org.eclipse.rtp.configurator.service.provider.internal.util.Fixture;
import org.eclipse.rtp.configurator.service.provider.internal.util.P2Util;
import org.eclipse.rtp.core.model.SourceProvider;
import org.eclipse.rtp.core.model.SourceVersion;
+import org.eclipse.rtp.core.util.ModelUtil;
import org.junit.Before;
import org.junit.Test;
import org.osgi.framework.Version;
public class ConfiguratorServiceTest {
- private DefaultConfiguratorService configuratorService;
+ private RTPDefaultService configuratorService;
private P2Util p2UtilMock;
private SourceProvider sourceProvider;
private FeatureManager featureManager;
@@ -48,7 +48,7 @@ public class ConfiguratorServiceTest {
@Before
public void setUp() throws IOException {
- configuratorService = new DefaultConfiguratorService();
+ configuratorService = new RTPDefaultService();
p2UtilMock = mock( P2Util.class );
configuratorService.setP2Util( p2UtilMock );
InputStream inputStream = Fixture.readExampleSources();
@@ -63,10 +63,7 @@ public class ConfiguratorServiceTest {
when( p2UtilMock.getFeatureManager() ).thenReturn( featureManager );
when( p2UtilMock.getRepositoryManager() ).thenReturn( repositoryManager );
SourceVersion sourceVersion = sourceProvider.getSources().get( 0 ).getVersions().get( 0 );
- List<String> parameters = new ArrayList<String>();
- parameters.add( "rap" );
- parameters.add( "1.4" );
- IStatus status = configuratorService.install( parameters );
+ IStatus status = configuratorService.install( sourceVersion );
verify( featureManager, atLeastOnce() ).installFeature( sourceVersion );
verify( repositoryManager, atLeastOnce() ).addRepository( new URI( "http://foo.bar" ) );
assertTrue( status.isOK() );
@@ -83,9 +80,7 @@ public class ConfiguratorServiceTest {
List<SourceVersion> versions = sourceProvider.getSources().get( 0 ).getVersions();
Collections.sort( versions, getSourceVersionComparator() );
SourceVersion latestSourceVersion = versions.get( 0 );
- List<String> parameters = new ArrayList<String>();
- parameters.add( "rap" );
- IStatus status = configuratorService.install( parameters );
+ IStatus status = configuratorService.install( latestSourceVersion );
verify( featureManager, atLeastOnce() ).installFeature( latestSourceVersion );
verify( repositoryManager, atLeastOnce() ).addRepository( new URI( "http://foo.bar2" ) );
assertTrue( status.isOK() );
@@ -95,21 +90,22 @@ public class ConfiguratorServiceTest {
public void testNothingToInstall()
throws CoreException, FeatureInstallException, URISyntaxException
{
- List<String> parameters = new ArrayList<String>();
- parameters.add( "rap" );
- parameters.add( "1.6" );
- IStatus status = configuratorService.install( parameters );
+ SourceVersion sourceVersion = new SourceVersion( "1.6",
+ "http://test.com",
+ "",
+ "http://test.com" );
+ IStatus status = configuratorService.install( sourceVersion );
assertFalse( status.isOK() );
}
@Test
public void testRemove() throws CoreException, FeatureInstallException, URISyntaxException {
SourceVersion sourceVersion = sourceProvider.getSources().get( 0 ).getVersions().get( 0 );
+ List<SourceVersion> souceVersionToUninstall = new ArrayList<SourceVersion>();
+ souceVersionToUninstall.add( sourceVersion );
featureManager = mock( FeatureManager.class );
when( p2UtilMock.getFeatureManager() ).thenReturn( featureManager );
- List<String> parameters = new ArrayList<String>();
- parameters.add( "rap" );
- IStatus status = configuratorService.remove( parameters );
+ IStatus status = configuratorService.remove( souceVersionToUninstall );
verify( featureManager, atLeastOnce() ).uninstallFeature( sourceVersion );
assertTrue( status.isOK() );
}
@@ -120,9 +116,13 @@ public class ConfiguratorServiceTest {
{
featureManager = mock( FeatureManager.class );
when( p2UtilMock.getFeatureManager() ).thenReturn( featureManager );
- List<String> parameters = new ArrayList<String>();
- parameters.add( "rap" );
- IStatus status = configuratorService.remove( parameters );
+ SourceVersion sourceVersion = new SourceVersion( "1.6",
+ "http://test.com",
+ "",
+ "http://test.com" );
+ List<SourceVersion> sourceVersionsToUninstall = new ArrayList<SourceVersion>();
+ sourceVersionsToUninstall.add( sourceVersion );
+ IStatus status = configuratorService.remove( sourceVersionsToUninstall );
assertTrue( status.isOK() );
}
diff --git a/tests/org.eclipse.rtp.core.service.provider.test/src/org/eclipse/rtp/configurator/service/provider/internal/util/Fixture.java b/tests/org.eclipse.rtp.core.service.provider.test/src/org/eclipse/rtp/configurator/service/provider/internal/util/Fixture.java
index c3c7840..5f7129b 100644
--- a/tests/org.eclipse.rtp.core.service.provider.test/src/org/eclipse/rtp/configurator/service/provider/internal/util/Fixture.java
+++ b/tests/org.eclipse.rtp.core.service.provider.test/src/org/eclipse/rtp/configurator/service/provider/internal/util/Fixture.java
@@ -11,12 +11,13 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.rtp.core.model.SourceProvider;
import org.eclipse.rtp.core.model.SourceUnMarshaller;
+import org.eclipse.rtp.core.util.ModelUtil;
import org.osgi.framework.Bundle;
public class Fixture {
public static InputStream readExampleSources() throws IOException {
- Bundle bundle = Platform.getBundle( "org.eclipse.rtp.core.service.provider" );
+ Bundle bundle = Platform.getBundle( "org.eclipse.rtp.core.model.test" );
URL unResolvedUrl = FileLocator.find( bundle, new Path( "data/example-sources.json" ), null );
URL testDataUrl = FileLocator.resolve( unResolvedUrl );
File testDataFile = new Path( testDataUrl.getFile() ).toFile();
diff --git a/tests/org.eclipse.rtp.core.service.provider.test/src/org/eclipse/rtp/configurator/service/provider/internal/util/ModelUtilTest.java b/tests/org.eclipse.rtp.core.service.provider.test/src/org/eclipse/rtp/configurator/service/provider/internal/util/ModelUtilTest.java
deleted file mode 100644
index dfdf8ff..0000000
--- a/tests/org.eclipse.rtp.core.service.provider.test/src/org/eclipse/rtp/configurator/service/provider/internal/util/ModelUtilTest.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.eclipse.rtp.configurator.service.provider.internal.util;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-public class ModelUtilTest {
-
- @Test
- public void testModelUrlReadFromProperty() {
- String expectedURL = "http://test.com";
- System.setProperty( "configuration.url", expectedURL );
- String configurationURL = ModelUtil.getConfigurationURL();
- assertEquals( expectedURL, configurationURL );
- }
-}
diff --git a/tests/org.eclipse.rtp.core.test/.classpath b/tests/org.eclipse.rtp.core.test/.classpath
index 78d5ded..ed2bc12 100644
--- a/tests/org.eclipse.rtp.core.test/.classpath
+++ b/tests/org.eclipse.rtp.core.test/.classpath
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
+ <classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
diff --git a/tests/org.eclipse.rtp.core.test/META-INF/MANIFEST.MF b/tests/org.eclipse.rtp.core.test/META-INF/MANIFEST.MF
index 83f4beb..c6c81bd 100644
--- a/tests/org.eclipse.rtp.core.test/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.rtp.core.test/META-INF/MANIFEST.MF
@@ -3,5 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: Core Test
Bundle-SymbolicName: org.eclipse.rtp.core.test
Bundle-Version: 1.0.0.qualifier
+Fragment-Host: org.eclipse.rtp.core;bundle-version="1.0.0.qualifier"
Bundle-Vendor: EclipseSource
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.junit;bundle-version="4.8.2"
diff --git a/tests/org.eclipse.rtp.core.test/src/org/eclipse/rtp/core/ModelUtilTest.java b/tests/org.eclipse.rtp.core.test/src/org/eclipse/rtp/core/ModelUtilTest.java
new file mode 100644
index 0000000..b2ea92e
--- /dev/null
+++ b/tests/org.eclipse.rtp.core.test/src/org/eclipse/rtp/core/ModelUtilTest.java
@@ -0,0 +1,17 @@
+package org.eclipse.rtp.core;
+
+import static org.junit.Assert.assertEquals;
+
+import org.eclipse.rtp.core.util.ModelUtil;
+import org.junit.Test;
+
+public class ModelUtilTest {
+
+ @Test
+ public void testModelUrlReadFromProperty() {
+ String expectedURL = "http://test.com";
+ System.setProperty("configuration.url", expectedURL);
+ String configurationURL = ModelUtil.getConfigurationURL();
+ assertEquals(expectedURL, configurationURL);
+ }
+}