Skip to content

Commit f647700

Browse files
committed
Upgrade to latest kotlin + techstacks version
1 parent b8c1af6 commit f647700

File tree

14 files changed

+7094
-1696
lines changed

14 files changed

+7094
-1696
lines changed

src/AndroidClient/client/src/test/java/io/techstacks/dto.java

Lines changed: 3569 additions & 860 deletions
Large diffs are not rendered by default.

src/AndroidClient/client/src/test/java/net/servicestack/client/JsonServiceClientTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
public class JsonServiceClientTests extends TestCase {
1717

1818
public JsonServiceClientTests() {
19-
19+
Log.setInstance(new LogProvider("", true));
2020
}
2121
//10.0.2.2 = loopback
2222
//http://developer.android.com/tools/devices/emulator.html
@@ -52,7 +52,7 @@ public void exec(HttpURLConnection conn) {
5252
}
5353

5454
public void test_does_process_missing_service_correctly() {
55-
JsonServiceClient localTestClient = new JsonServiceClient("http://techstacks.io/");
55+
JsonServiceClient localTestClient = new JsonServiceClient("https://www.techstacks.io/");
5656

5757
try {
5858
localTestClient.get(new EchoTypes());

src/AndroidClient/client/src/test/java/net/servicestack/client/TechStacksServiceTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public TechStacksServiceTests() {
1717

1818
}
1919

20-
JsonServiceClient client = new JsonServiceClient("http://techstacks.io");
20+
JsonServiceClient client = new JsonServiceClient("https://www.techstacks.io");
2121

2222
public void test_Can_GET_TechStacks_Overview(){
2323
OverviewResponse response = client.get(new Overview());
@@ -148,7 +148,7 @@ public void test_Can_deserialize_Overview() throws IOException {
148148
assertEquals(1, (long)techstacks.getId());
149149
assertEquals("TechStacks Website", techstacks.getName());
150150
assertEquals("ServiceStack", techstacks.getVendorName());
151-
assertTrue(techstacks.Description.startsWith("This Website! "));
151+
assertTrue(techstacks.description.startsWith("This Website! "));
152152
assertEquals("http://techstacks.io", techstacks.getAppUrl());
153153
assertEquals("https://raw.githubusercontent.com/ServiceStack/Assets/master/img/livedemos/techstacks/screenshots/techstacks.png", techstacks.getScreenshotUrl());
154154
assertEquals(Utils.parseDate("2015-01-01T17:33:58.9892560"), techstacks.getCreated());

src/AndroidClient/kotlin/src/androidTest/java/test/servicestack/net/kotlin/ApplicationTest.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ApplicationTest : ApplicationTestCase<Application>(Application::class.java
2222
super.setUp()
2323
Log.Instance = AndroidLogProvider("ZZZ");
2424

25-
val client = AndroidServiceClient("http://techstacks.io")
25+
val client = AndroidServiceClient("https://www.techstacks.io")
2626
}
2727

2828
fun test_Fail() {
@@ -31,8 +31,8 @@ class ApplicationTest : ApplicationTestCase<Application>(Application::class.java
3131

3232
fun test_Can_Serialize_Technology(){
3333
val dto = Technology();
34-
dto.Name = "Test";
35-
dto.Tier = TechnologyTier.ProgrammingLanguage;
34+
dto.name = "Test";
35+
dto.tier = TechnologyTier.ProgrammingLanguage;
3636

3737
var gson = Gson()
3838

@@ -42,6 +42,6 @@ class ApplicationTest : ApplicationTestCase<Application>(Application::class.java
4242

4343
val fromJson = gson.fromJson(json, Technology::class.java)
4444

45-
Log.d("Name: ${fromJson.Name}, Tier: ${fromJson.Tier}")
45+
Log.d("Name: ${fromJson.name}, Tier: ${fromJson.tier}")
4646
}
4747
}

src/AndroidClient/kotlin/src/androidTest/java/test/servicestack/net/kotlin/techstacks/TechStacksServiceTests.kt

Lines changed: 91 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ import junit.framework.TestCase
77
import net.servicestack.client.JsonServiceClient
88
import net.servicestack.client.Utils
99
import java.io.IOException
10+
import java.util.ArrayList
1011

1112
class TechStacksServiceTests : TestCase() {
1213

13-
internal var client = JsonServiceClient("http://techstacks.io")
14+
internal var client = JsonServiceClient("https://www.techstacks.io")
1415

1516
fun test_Can_GET_TechStacks_Overview() {
1617
val response = client.get<OverviewResponse>(Overview())
@@ -23,8 +24,8 @@ class TechStacksServiceTests : TestCase() {
2324
fun test_Can_GET_TechStacks_AppOverview() {
2425
val r = client.get<AppOverviewResponse>(AppOverview())
2526
Assert.assertNotNull(r)
26-
Assert.assertTrue(r.TopTechnologies!!.size > 0)
27-
Assert.assertTrue(r.AllTiers!!.size > 0)
27+
Assert.assertTrue(r.topTechnologies.size > 0)
28+
Assert.assertTrue(r.allTiers.size > 0)
2829
}
2930

3031
fun test_Can_GET_TechStacks_Overview_with_relative_url() {
@@ -39,7 +40,7 @@ class TechStacksServiceTests : TestCase() {
3940

4041
fun test_Can_GET_GetTechnology_with_params() {
4142
val requestDto = GetTechnology()
42-
requestDto.Slug = "servicestack"
43+
requestDto.slug = "servicestack"
4344

4445
val response = client.get<GetTechnologyResponse>(requestDto)
4546
assertGetTechnologyResponse(response)
@@ -52,21 +53,21 @@ class TechStacksServiceTests : TestCase() {
5253

5354
fun test_Can_call_FindTechnologies_AutoQuery_Service() {
5455
val request = FindTechnologies()
55-
request.Name = "ServiceStack"
56+
request.name = "ServiceStack"
5657

5758
val response = client.get<QueryResponse<Technology>>(request)
5859

59-
Assert.assertEquals(1, response.Results?.size)
60+
Assert.assertEquals(1, response.results.size)
6061
}
6162

6263
fun test_Can_call_FindTechnologies_AutoQuery_Implicit_Service() {
6364
val request = FindTechnologies()
64-
request.Take = 5
65+
request.take = 5
6566

6667
val response = client.get<QueryResponse<Technology>>(request,
6768
Utils.createMap("DescriptionContains", "framework"))
6869

69-
Assert.assertEquals(5, response.Results?.size)
70+
Assert.assertEquals(5, response.results.size)
7071
}
7172

7273
fun test_Can_serialize_Empty_Option() {
@@ -82,16 +83,16 @@ class TechStacksServiceTests : TestCase() {
8283

8384
val dto = client.fromJson(json, Option::class.java) as Option
8485

85-
Assert.assertNull(dto.Name)
86-
Assert.assertNull(dto.Title)
87-
Assert.assertNull(dto.Value)
86+
Assert.assertNull(dto.name)
87+
Assert.assertNull(dto.title)
88+
Assert.assertNull(dto.value)
8889
}
8990

9091
fun test_Can_serialize_Full_Option() {
9192
val dto = Option()
92-
dto.Name = "name"
93-
dto.Title = "title"
94-
dto.Value = TechnologyTier.ProgrammingLanguage
93+
dto.name = "name"
94+
dto.title = "title"
95+
dto.value = TechnologyTier.ProgrammingLanguage
9596

9697
val json = client.toJson(dto)
9798

@@ -103,9 +104,9 @@ class TechStacksServiceTests : TestCase() {
103104

104105
val dto = client.fromJson(json, Option::class.java) as Option
105106

106-
Assert.assertEquals("name", dto.Name)
107-
Assert.assertEquals("title", dto.Title)
108-
Assert.assertEquals(TechnologyTier.ProgrammingLanguage, dto.Value)
107+
Assert.assertEquals("name", dto.name)
108+
Assert.assertEquals("title", dto.title)
109+
Assert.assertEquals(TechnologyTier.ProgrammingLanguage, dto.value)
109110
}
110111

111112
@Throws(IOException::class)
@@ -117,72 +118,72 @@ class TechStacksServiceTests : TestCase() {
117118

118119
val dto = client.fromJson(json, OverviewResponse::class.java) as OverviewResponse
119120

120-
Assert.assertEquals(6, dto.TopUsers?.size)
121-
val topUser = dto.TopUsers!![0]
122-
Assert.assertEquals("demisbellot", topUser.UserName)
123-
Assert.assertEquals("http:\\/\\/pbs.twimg.com\\/profile_images\\/1765666853\\/image1326949938_normal.png", topUser.AvatarUrl)
124-
Assert.assertEquals(61, topUser.StacksCount)
125-
126-
127-
Assert.assertEquals(20, dto.TopTechnologies?.size)
128-
val topTech = dto.TopTechnologies!![0]
129-
Assert.assertEquals(TechnologyTier.Data, topTech.Tier)
130-
Assert.assertEquals("redis", topTech.Slug)
131-
Assert.assertEquals("Redis", topTech.Name)
132-
Assert.assertEquals("https://raw.githubusercontent.com/ServiceStack/Assets/master/img/livedemos/techstacks/redis-logo.png", topTech.LogoUrl)
133-
Assert.assertEquals(35, topTech.StacksCount)
134-
135-
136-
val latestStacks = dto.LatestTechStacks
137-
Assert.assertEquals(20, latestStacks?.size)
138-
139-
val techstacks = latestStacks!![0]
140-
Assert.assertEquals(1, techstacks.Id!!)
141-
Assert.assertEquals("TechStacks Website", techstacks.Name)
142-
Assert.assertEquals("ServiceStack", techstacks.VendorName)
143-
Assert.assertTrue(techstacks.Description!!.startsWith("This Website! "))
144-
Assert.assertEquals("http://techstacks.io", techstacks.AppUrl)
145-
Assert.assertEquals("https://raw.githubusercontent.com/ServiceStack/Assets/master/img/livedemos/techstacks/screenshots/techstacks.png", techstacks.ScreenshotUrl)
146-
Assert.assertEquals(Utils.parseDate("2015-01-01T17:33:58.9892560"), techstacks.Created)
147-
Assert.assertEquals("layoric", techstacks.CreatedBy)
148-
Assert.assertEquals(Utils.parseDate("2015-01-12T23:34:12.4516410"), techstacks.LastModified)
149-
Assert.assertEquals("layoric", techstacks.LastModifiedBy)
150-
Assert.assertTrue(techstacks.IsLocked!!)
151-
Assert.assertEquals("2", techstacks.OwnerId)
152-
Assert.assertEquals("techstacks-website", techstacks.Slug)
153-
Assert.assertEquals(Utils.parseDate("2015-01-12T23:34:12.4516410"), techstacks.LastStatusUpdate)
154-
155-
val techstackChoices = techstacks.TechnologyChoices
156-
Assert.assertEquals(10, techstackChoices?.size)
157-
val techChoice = techstackChoices!![0]
158-
Assert.assertEquals(1, techChoice.TechnologyId!!)
159-
Assert.assertEquals(1, techChoice.TechnologyStackId!!)
160-
Assert.assertEquals(2, techChoice.Id!!)
161-
Assert.assertEquals("ServiceStack", techChoice.Name)
162-
Assert.assertEquals("Service Stack", techChoice.VendorName)
163-
Assert.assertEquals("https://servicestack.net", techChoice.VendorUrl)
164-
Assert.assertEquals("https://servicestack.net", techChoice.ProductUrl)
165-
Assert.assertEquals("https://raw.githubusercontent.com/ServiceStack/Assets/master/img/livedemos/techstacks/servicestack-logo.png", techChoice.LogoUrl)
166-
Assert.assertEquals(Utils.parseDate("2014-12-28T08:49:20.9542550"), techChoice.Created)
167-
Assert.assertEquals("demisbellot", techChoice.CreatedBy)
168-
Assert.assertEquals(Utils.parseDate("2014-12-28T08:49:20.9542550"), techChoice.LastModified)
169-
Assert.assertEquals("demisbellot", techChoice.LastModifiedBy)
170-
Assert.assertEquals("1", techChoice.OwnerId)
171-
Assert.assertEquals("servicestack", techChoice.Slug)
172-
Assert.assertTrue(techChoice.LogoApproved!!)
173-
Assert.assertFalse(techChoice.IsLocked!!)
174-
Assert.assertEquals(TechnologyTier.Server, techChoice.Tier)
175-
176-
177-
Assert.assertEquals(9, dto.TopTechnologiesByTier?.size)
178-
val langs = dto.TopTechnologiesByTier!![TechnologyTier.ProgrammingLanguage]
179-
Assert.assertEquals(3, langs?.size)
180-
val lang = langs!![0]
181-
Assert.assertEquals(TechnologyTier.ProgrammingLanguage, lang.Tier)
182-
Assert.assertEquals("python", lang.Slug)
183-
Assert.assertEquals("Python", lang.Name)
184-
Assert.assertEquals("https://raw.githubusercontent.com/ServiceStack/Assets/master/img/livedemos/techstacks/python-logo.png", lang.LogoUrl)
185-
Assert.assertEquals(25, lang.StacksCount)
121+
Assert.assertEquals(20, dto.topUsers.size)
122+
val topUser = dto.topUsers[0]
123+
Assert.assertEquals("demisbellot", topUser.userName)
124+
Assert.assertEquals("http://pbs.twimg.com/profile_images/1765666853/image1326949938_normal.png", topUser.avatarUrl)
125+
Assert.assertEquals(95, topUser.stacksCount)
126+
127+
128+
Assert.assertEquals(50, dto.topTechnologies.size)
129+
val topTech = dto.topTechnologies[0]
130+
Assert.assertEquals(TechnologyTier.Data, topTech.tier)
131+
Assert.assertEquals("redis", topTech.slug)
132+
Assert.assertEquals("Redis", topTech.name)
133+
Assert.assertEquals("https://raw.githubusercontent.com/ServiceStack/Assets/master/img/livedemos/techstacks/redis-logo.png", topTech.logoUrl)
134+
Assert.assertEquals(73, topTech.stacksCount)
135+
136+
137+
val latestStacks = dto.latestTechStacks
138+
Assert.assertEquals(20, latestStacks.size)
139+
140+
val techstacks = latestStacks[0]
141+
Assert.assertEquals(1, techstacks.id!!)
142+
Assert.assertEquals("TechStacks Website", techstacks.name)
143+
Assert.assertEquals("ServiceStack", techstacks.vendorName)
144+
Assert.assertTrue(techstacks.description!!.startsWith("The original TechStacks Website"))
145+
Assert.assertEquals("http://angular.techstacks.io", techstacks.appUrl)
146+
Assert.assertEquals("https://raw.githubusercontent.com/ServiceStack/Assets/master/img/livedemos/techstacks/screenshots/techstacks.png", techstacks.screenshotUrl)
147+
Assert.assertEquals(Utils.parseDate("2015-01-01T17:33:58.9892560"), techstacks.created)
148+
Assert.assertEquals("layoric", techstacks.createdBy)
149+
Assert.assertEquals(Utils.parseDate("2018-03-23T03:18:38.9958030"), techstacks.lastModified)
150+
Assert.assertEquals("mythz", techstacks.lastModifiedBy)
151+
Assert.assertTrue(techstacks.isLocked!!)
152+
Assert.assertEquals("2", techstacks.ownerId)
153+
Assert.assertEquals("techstacks-website", techstacks.slug)
154+
Assert.assertEquals(Utils.parseDate("2018-03-23T03:12:44.0426320"), techstacks.lastStatusUpdate)
155+
156+
val techstackChoices = techstacks.technologyChoices
157+
Assert.assertEquals(11, techstackChoices.size)
158+
val techChoice = techstackChoices[0]
159+
Assert.assertEquals(1, techChoice.technologyId!!)
160+
Assert.assertEquals(1, techChoice.technologyStackId!!)
161+
Assert.assertEquals(2, techChoice.id!!)
162+
Assert.assertEquals("ServiceStack", techChoice.name)
163+
Assert.assertEquals("ServiceStack", techChoice.vendorName)
164+
Assert.assertEquals("https://servicestack.net", techChoice.vendorUrl)
165+
Assert.assertEquals("https://servicestack.net", techChoice.productUrl)
166+
Assert.assertEquals("https://raw.githubusercontent.com/ServiceStack/Assets/master/img/livedemos/techstacks/servicestack-logo.png", techChoice.logoUrl)
167+
Assert.assertEquals(Utils.parseDate("2014-12-28T08:49:20.9542550"), techChoice.created)
168+
Assert.assertEquals("demisbellot", techChoice.createdBy)
169+
Assert.assertEquals(Utils.parseDate("2018-03-14T06:01:13.9571660"), techChoice.lastModified)
170+
Assert.assertEquals("mythz", techChoice.lastModifiedBy)
171+
Assert.assertEquals("1", techChoice.ownerId)
172+
Assert.assertEquals("servicestack", techChoice.slug)
173+
Assert.assertTrue(techChoice.logoApproved!!)
174+
Assert.assertFalse(techChoice.isLocked!!)
175+
Assert.assertEquals(TechnologyTier.Server, techChoice.tier)
176+
177+
178+
Assert.assertEquals(9, dto.topTechnologiesByTier.size)
179+
val langs = dto.topTechnologiesByTier[TechnologyTier.ProgrammingLanguage.toString()]
180+
Assert.assertEquals(5, langs!!.size)
181+
val lang = langs[0]
182+
Assert.assertEquals(TechnologyTier.ProgrammingLanguage, lang.tier)
183+
Assert.assertEquals("python", lang.slug)
184+
Assert.assertEquals("Python", lang.name)
185+
Assert.assertEquals("https://raw.githubusercontent.com/ServiceStack/Assets/master/img/livedemos/techstacks/python-logo.png", lang.logoUrl)
186+
Assert.assertEquals(47, lang.stacksCount)
186187

187188
// let toJson = dtos.toJson()
188189
// println(toJson)
@@ -193,17 +194,17 @@ class TechStacksServiceTests : TestCase() {
193194

194195
fun assertOverviewResponse(r: OverviewResponse) {
195196
Assert.assertNotNull(r)
196-
Assert.assertTrue(r.TopUsers!!.size > 0)
197-
Assert.assertTrue(r.TopTechnologies!!.size > 0)
198-
Assert.assertTrue(r.LatestTechStacks!!.size > 0)
199-
Assert.assertTrue(r.LatestTechStacks!![0].TechnologyChoices!!.size > 0)
200-
Assert.assertTrue(r.TopTechnologiesByTier!!.size > 0)
197+
Assert.assertTrue(r.topUsers.size > 0)
198+
Assert.assertTrue(r.topTechnologies.size > 0)
199+
Assert.assertTrue(r.latestTechStacks.size > 0)
200+
Assert.assertTrue(r.latestTechStacks[0].technologyChoices.size > 0)
201+
Assert.assertTrue(r.topTechnologiesByTier.size > 0)
201202
}
202203

203204
fun assertGetTechnologyResponse(r: GetTechnologyResponse) {
204205
Assert.assertNotNull(r)
205-
Assert.assertEquals("ServiceStack", r.Technology?.Name)
206-
Assert.assertTrue(r.TechnologyStacks!!.size > 0)
206+
Assert.assertEquals("ServiceStack", r.technology?.name)
207+
Assert.assertTrue(r.technologyStacks.size > 0)
207208
}
208209
}
209210
}

0 commit comments

Comments
 (0)