aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbveliev2011-09-25 06:35:10 (EDT)
committerbveliev2011-09-25 06:35:10 (EDT)
commit3f690b4ceefd243fa3a7115b85bdda94ab5ecb26 (patch)
treef5914831fc4be61dd1aa73227d938032b9ed7394
parent50b2549ae952972141eea89af3357a104faafeb0 (diff)
downloadorg.eclipse.rtp-3f690b4ceefd243fa3a7115b85bdda94ab5ecb26.zip
org.eclipse.rtp-3f690b4ceefd243fa3a7115b85bdda94ab5ecb26.tar.gz
org.eclipse.rtp-3f690b4ceefd243fa3a7115b85bdda94ab5ecb26.tar.bz2
* description and infoUrl moved from SourceVersion to Source
-rw-r--r--configurator.test/org.eclipse.rtp.configurator.model.test/src/org/eclipse/rtp/configurator/model/SourceMarshallerTest.java12
-rw-r--r--configurator.test/org.eclipse.rtp.configurator.model.test/src/org/eclipse/rtp/configurator/model/SourceTest.java12
-rw-r--r--configurator.test/org.eclipse.rtp.configurator.model.test/src/org/eclipse/rtp/configurator/model/SourceVersionTest.java2
-rw-r--r--configurator.test/org.eclipse.rtp.configurator.model.test/src/org/eclipse/rtp/configurator/model/example-sources.json16
-rw-r--r--configurator/org.eclipse.rtp.configurator.model/src/org/eclipse/rtp/configurator/model/Source.java15
-rw-r--r--configurator/org.eclipse.rtp.configurator.model/src/org/eclipse/rtp/configurator/model/SourceUnMarshaller.java (renamed from configurator/org.eclipse.rtp.configurator.model/src/org/eclipse/rtp/configurator/model/SourceMarshaller.java)2
-rw-r--r--configurator/org.eclipse.rtp.configurator.model/src/org/eclipse/rtp/configurator/model/SourceVersion.java12
-rw-r--r--configurator/org.eclipse.rtp.configurator.model/src/org/eclipse/rtp/configurator/model/internal/SourceUnMarshallerImpl.java4
8 files changed, 40 insertions, 35 deletions
diff --git a/configurator.test/org.eclipse.rtp.configurator.model.test/src/org/eclipse/rtp/configurator/model/SourceMarshallerTest.java b/configurator.test/org.eclipse.rtp.configurator.model.test/src/org/eclipse/rtp/configurator/model/SourceMarshallerTest.java
index 5044047..891f16a 100644
--- a/configurator.test/org.eclipse.rtp.configurator.model.test/src/org/eclipse/rtp/configurator/model/SourceMarshallerTest.java
+++ b/configurator.test/org.eclipse.rtp.configurator.model.test/src/org/eclipse/rtp/configurator/model/SourceMarshallerTest.java
@@ -23,7 +23,7 @@ public class SourceMarshallerTest {
@Test
public void first() throws IOException {
InputStream stream = readExampleSources();
- SourceMarshaller marshaller = new SourceUnMarshallerImpl();
+ SourceUnMarshaller marshaller = new SourceUnMarshallerImpl();
SourceProvider provider = marshaller.marshal( stream );
assertEquals( 2, provider.getSources().size() );
@@ -33,6 +33,8 @@ public class SourceMarshallerTest {
private void checkFirstSource( Source source ) {
assertEquals( "rap", source.getName() );
+ assertEquals( "Some text", source.getDescription() );
+ assertEquals( "http://foo.bar/info", source.getInfoUrl() );
assertEquals( 2, source.getVersions().size() );
checkFirstRapVersion( source );
checkSecondRapVersion( source );
@@ -42,20 +44,18 @@ public class SourceMarshallerTest {
SourceVersion source1 = source.getVersions().get( 0 );
assertEquals( "1.4", source1.getVersion() );
assertEquals( "http://foo.bar", source1.getRepositoryUrl() );
- assertEquals( "Some text", source1.getDescription() );
- assertEquals( "http://foo.bar/info", source1.getInfoUrl() );
}
private void checkSecondRapVersion( Source source ) {
SourceVersion source2 = source.getVersions().get( 1 );
assertEquals( "1.5", source2.getVersion() );
assertEquals( "http://foo.bar2", source2.getRepositoryUrl() );
- assertEquals( "Some text2", source2.getDescription() );
- assertEquals( "http://foo.bar/info2", source2.getInfoUrl() );
}
private void checkSecondSource( Source source ) {
assertEquals( "equinox", source.getName() );
+ assertEquals( "Some text3", source.getDescription() );
+ assertEquals( "http://foo.bar/info3", source.getInfoUrl() );
assertEquals( 1, source.getVersions().size() );
checkEquinoxVersion( source );
}
@@ -64,8 +64,6 @@ public class SourceMarshallerTest {
SourceVersion source1 = source.getVersions().get( 0 );
assertEquals( "3.8.1", source1.getVersion() );
assertEquals( "http://foo.bar3", source1.getRepositoryUrl() );
- assertEquals( "Some text3", source1.getDescription() );
- assertEquals( "http://foo.bar/info3", source1.getInfoUrl() );
}
private InputStream readExampleSources() {
diff --git a/configurator.test/org.eclipse.rtp.configurator.model.test/src/org/eclipse/rtp/configurator/model/SourceTest.java b/configurator.test/org.eclipse.rtp.configurator.model.test/src/org/eclipse/rtp/configurator/model/SourceTest.java
index 9a2ba4f..df71f09 100644
--- a/configurator.test/org.eclipse.rtp.configurator.model.test/src/org/eclipse/rtp/configurator/model/SourceTest.java
+++ b/configurator.test/org.eclipse.rtp.configurator.model.test/src/org/eclipse/rtp/configurator/model/SourceTest.java
@@ -25,7 +25,7 @@ public class SourceTest {
@Before
public void setUp() {
- source = new Source( "foo" );
+ source = new Source( "foo", "description", "http://info.bar" );
}
@Test
@@ -34,6 +34,16 @@ public class SourceTest {
}
@Test
+ public void testGetDescription() {
+ assertEquals( "description", source.getDescription() );
+ }
+
+ @Test
+ public void testGetInfoUrl() {
+ assertEquals( "http://info.bar", source.getInfoUrl() );
+ }
+
+ @Test
public void testAddVersion() {
SourceVersion version = mock( SourceVersion.class );
diff --git a/configurator.test/org.eclipse.rtp.configurator.model.test/src/org/eclipse/rtp/configurator/model/SourceVersionTest.java b/configurator.test/org.eclipse.rtp.configurator.model.test/src/org/eclipse/rtp/configurator/model/SourceVersionTest.java
index 8763cc5..400af85 100644
--- a/configurator.test/org.eclipse.rtp.configurator.model.test/src/org/eclipse/rtp/configurator/model/SourceVersionTest.java
+++ b/configurator.test/org.eclipse.rtp.configurator.model.test/src/org/eclipse/rtp/configurator/model/SourceVersionTest.java
@@ -25,7 +25,5 @@ public class SourceVersionTest {
assertEquals( "1.4", version.getVersion() );
assertEquals( "http://foo.bar", version.getRepositoryUrl() );
- assertEquals( "description", version.getDescription() );
- assertEquals( "http://info.bar", version.getInfoUrl() );
}
}
diff --git a/configurator.test/org.eclipse.rtp.configurator.model.test/src/org/eclipse/rtp/configurator/model/example-sources.json b/configurator.test/org.eclipse.rtp.configurator.model.test/src/org/eclipse/rtp/configurator/model/example-sources.json
index a38c823..c6ec22f 100644
--- a/configurator.test/org.eclipse.rtp.configurator.model.test/src/org/eclipse/rtp/configurator/model/example-sources.json
+++ b/configurator.test/org.eclipse.rtp.configurator.model.test/src/org/eclipse/rtp/configurator/model/example-sources.json
@@ -2,29 +2,27 @@
"sources": [
{
"name": "rap",
+ "description": "Some text",
+ "infoUrl": "http://foo.bar/info",
"versions": [
{
"version": "1.4",
- "repositoryUrl": "http://foo.bar",
- "description": "Some text",
- "infoUrl": "http://foo.bar/info"
+ "repositoryUrl": "http://foo.bar"
},
{
"version": "1.5",
- "repositoryUrl": "http://foo.bar2",
- "description": "Some text2",
- "infoUrl": "http://foo.bar/info2"
+ "repositoryUrl": "http://foo.bar2"
}
]
},
{
"name": "equinox",
+ "description": "Some text3",
+ "infoUrl": "http://foo.bar/info3",
"versions": [
{
"version": "3.8.1",
- "repositoryUrl": "http://foo.bar3",
- "description": "Some text3",
- "infoUrl": "http://foo.bar/info3"
+ "repositoryUrl": "http://foo.bar3"
}
]
}
diff --git a/configurator/org.eclipse.rtp.configurator.model/src/org/eclipse/rtp/configurator/model/Source.java b/configurator/org.eclipse.rtp.configurator.model/src/org/eclipse/rtp/configurator/model/Source.java
index 416f940..3332d0b 100644
--- a/configurator/org.eclipse.rtp.configurator.model/src/org/eclipse/rtp/configurator/model/Source.java
+++ b/configurator/org.eclipse.rtp.configurator.model/src/org/eclipse/rtp/configurator/model/Source.java
@@ -18,13 +18,18 @@ public class Source {
private String name;
private List<SourceVersion> versions;
+ private String description;
+ private String infoUrl;
+
Source() {
// only for Gson
}
- public Source( String name ) {
+ public Source( String name, String description, String infoUrl ) {
this.name = name;
+ this.description = description;
+ this.infoUrl = infoUrl;
this.versions = new ArrayList<SourceVersion>();
}
@@ -39,4 +44,12 @@ public class Source {
public List<SourceVersion> getVersions() {
return new ArrayList<SourceVersion>( versions );
}
+
+ public String getDescription() {
+ return description;
+ }
+
+ public String getInfoUrl() {
+ return infoUrl;
+ }
}
diff --git a/configurator/org.eclipse.rtp.configurator.model/src/org/eclipse/rtp/configurator/model/SourceMarshaller.java b/configurator/org.eclipse.rtp.configurator.model/src/org/eclipse/rtp/configurator/model/SourceUnMarshaller.java
index beef3ae..7efd799 100644
--- a/configurator/org.eclipse.rtp.configurator.model/src/org/eclipse/rtp/configurator/model/SourceMarshaller.java
+++ b/configurator/org.eclipse.rtp.configurator.model/src/org/eclipse/rtp/configurator/model/SourceUnMarshaller.java
@@ -12,7 +12,7 @@ package org.eclipse.rtp.configurator.model;
import java.io.InputStream;
-public interface SourceMarshaller {
+public interface SourceUnMarshaller {
SourceProvider marshal( InputStream sources );
}
diff --git a/configurator/org.eclipse.rtp.configurator.model/src/org/eclipse/rtp/configurator/model/SourceVersion.java b/configurator/org.eclipse.rtp.configurator.model/src/org/eclipse/rtp/configurator/model/SourceVersion.java
index e749918..99701d9 100644
--- a/configurator/org.eclipse.rtp.configurator.model/src/org/eclipse/rtp/configurator/model/SourceVersion.java
+++ b/configurator/org.eclipse.rtp.configurator.model/src/org/eclipse/rtp/configurator/model/SourceVersion.java
@@ -14,8 +14,6 @@ public class SourceVersion {
private String version;
private String repositoryUrl;
- private String description;
- private String infoUrl;
SourceVersion() {
// only for Gson
@@ -24,8 +22,6 @@ public class SourceVersion {
public SourceVersion( String version, String repositoryUrl, String description, String infoUrl ) {
this.version = version;
this.repositoryUrl = repositoryUrl;
- this.description = description;
- this.infoUrl = infoUrl;
}
public String getVersion() {
@@ -35,12 +31,4 @@ public class SourceVersion {
public String getRepositoryUrl() {
return repositoryUrl;
}
-
- public String getDescription() {
- return description;
- }
-
- public String getInfoUrl() {
- return infoUrl;
- }
}
diff --git a/configurator/org.eclipse.rtp.configurator.model/src/org/eclipse/rtp/configurator/model/internal/SourceUnMarshallerImpl.java b/configurator/org.eclipse.rtp.configurator.model/src/org/eclipse/rtp/configurator/model/internal/SourceUnMarshallerImpl.java
index 2352e93..b57560f 100644
--- a/configurator/org.eclipse.rtp.configurator.model/src/org/eclipse/rtp/configurator/model/internal/SourceUnMarshallerImpl.java
+++ b/configurator/org.eclipse.rtp.configurator.model/src/org/eclipse/rtp/configurator/model/internal/SourceUnMarshallerImpl.java
@@ -13,14 +13,14 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
-import org.eclipse.rtp.configurator.model.SourceMarshaller;
+import org.eclipse.rtp.configurator.model.SourceUnMarshaller;
import org.eclipse.rtp.configurator.model.SourceProvider;
import com.google.gson.Gson;
import com.google.gson.stream.JsonReader;
-public class SourceUnMarshallerImpl implements SourceMarshaller {
+public class SourceUnMarshallerImpl implements SourceUnMarshaller {
@Override
public SourceProvider marshal( InputStream sources ) {