-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from 4TechTeams/feature/domain-extension
Feature/domain extension
- Loading branch information
Showing
13 changed files
with
848 additions
and
41 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
.../src/jvmTest/kotlin/com/fortechteams/valuetypes/examples/example-network-ApexDomain-01.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// This file was automatically generated from Domain.kt by Knit tool. Do not edit. | ||
package com.fotechteams.valuetypes.examples.exampleNetworkApexDomain01 | ||
|
||
import com.fortechteams.valuetypes.network.ApexDomain | ||
import io.kotest.matchers.shouldBe | ||
|
||
fun test() { | ||
val apex = ApexDomain("example", "com") | ||
apex.name shouldBe "example" | ||
apex.tld shouldBe "com" | ||
apex.toString() shouldBe "example.com" | ||
apex.toFQDN() shouldBe "example.com." | ||
} |
12 changes: 12 additions & 0 deletions
12
.../src/jvmTest/kotlin/com/fortechteams/valuetypes/examples/example-network-ApexDomain-02.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// This file was automatically generated from Domain.kt by Knit tool. Do not edit. | ||
package com.fotechteams.valuetypes.examples.exampleNetworkApexDomain02 | ||
|
||
import com.fortechteams.valuetypes.network.ApexDomain | ||
import com.fortechteams.valuetypes.network.TopLevelDomain | ||
import io.kotest.matchers.shouldBe | ||
|
||
fun test() { | ||
val apex = ApexDomain("example", "com") | ||
val parent = apex.parent() | ||
parent shouldBe TopLevelDomain("com") | ||
} |
21 changes: 21 additions & 0 deletions
21
...ples/src/jvmTest/kotlin/com/fortechteams/valuetypes/examples/example-network-Domain-01.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// This file was automatically generated from Domain.kt by Knit tool. Do not edit. | ||
package com.fotechteams.valuetypes.examples.exampleNetworkDomain01 | ||
|
||
import com.fortechteams.valuetypes.network.Domain | ||
import com.fortechteams.valuetypes.network.Subdomain | ||
import io.kotest.matchers.shouldBe | ||
|
||
fun test() { | ||
// Parse different types of domains | ||
val tld = Domain.parse("com") | ||
val apex = Domain.parse("example.com") | ||
val subdomain = Domain.parse("www.example.com") | ||
|
||
// Convert to FQDN (Fully Qualified Domain Name) | ||
tld.toFQDN() shouldBe "com." | ||
apex.toFQDN() shouldBe "example.com." | ||
subdomain.toFQDN() shouldBe "www.example.com." | ||
|
||
// Access domain parts | ||
(subdomain as Subdomain).apexDomain.toString() shouldBe "example.com" | ||
} |
9 changes: 9 additions & 0 deletions
9
...ples/src/jvmTest/kotlin/com/fortechteams/valuetypes/examples/example-network-Domain-02.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// This file was automatically generated from Domain.kt by Knit tool. Do not edit. | ||
package com.fotechteams.valuetypes.examples.exampleNetworkDomain02 | ||
|
||
import com.fortechteams.valuetypes.network.Domain | ||
import io.kotest.matchers.shouldBe | ||
|
||
fun test() { | ||
Domain.parse("www.example.com").toFQDN() shouldBe "www.example.com." | ||
} |
18 changes: 18 additions & 0 deletions
18
...ples/src/jvmTest/kotlin/com/fortechteams/valuetypes/examples/example-network-Domain-03.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// This file was automatically generated from Domain.kt by Knit tool. Do not edit. | ||
package com.fotechteams.valuetypes.examples.exampleNetworkDomain03 | ||
|
||
import com.fortechteams.valuetypes.network.Domain | ||
import com.fortechteams.valuetypes.network.TopLevelDomain | ||
import com.fortechteams.valuetypes.network.ApexDomain | ||
import com.fortechteams.valuetypes.network.Subdomain | ||
import io.kotest.matchers.shouldBe | ||
|
||
fun test() { | ||
Domain.parse("com") shouldBe TopLevelDomain("com") | ||
Domain.parse("example.com") shouldBe ApexDomain("example", "com") | ||
Domain.parse("www.example.com") shouldBe | ||
Subdomain(listOf("www"), "example", "com") | ||
|
||
// Invalid domains throw InvalidDomainException | ||
runCatching { Domain.parse("invalid..com") }.isFailure shouldBe true | ||
} |
24 changes: 24 additions & 0 deletions
24
...s/src/jvmTest/kotlin/com/fortechteams/valuetypes/examples/example-network-Subdomain-01.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// This file was automatically generated from Domain.kt by Knit tool. Do not edit. | ||
package com.fotechteams.valuetypes.examples.exampleNetworkSubdomain01 | ||
|
||
import com.fortechteams.valuetypes.network.Subdomain | ||
import io.kotest.matchers.shouldBe | ||
|
||
fun test() { | ||
val sub = Subdomain(listOf("www"), "example", "com") | ||
|
||
// Access individual parts | ||
sub.subdomainLabels shouldBe listOf("www") | ||
sub.apexName shouldBe "example" | ||
sub.tld shouldBe "com" | ||
|
||
// Get the apex domain | ||
sub.apexDomain.toString() shouldBe "example.com" | ||
|
||
// Get full hierarchy | ||
val complex = Subdomain(listOf("dev", "staging"), "example", "com") | ||
complex.getSubdomainHierarchy().map { it.toString() } shouldBe listOf( | ||
"dev.staging.example.com", | ||
"staging.example.com" | ||
) | ||
} |
16 changes: 16 additions & 0 deletions
16
...s/src/jvmTest/kotlin/com/fortechteams/valuetypes/examples/example-network-Subdomain-02.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// This file was automatically generated from Domain.kt by Knit tool. Do not edit. | ||
package com.fotechteams.valuetypes.examples.exampleNetworkSubdomain02 | ||
|
||
import com.fortechteams.valuetypes.network.Subdomain | ||
import com.fortechteams.valuetypes.network.ApexDomain | ||
import io.kotest.matchers.shouldBe | ||
|
||
fun test() { | ||
// Single level subdomain | ||
val www = Subdomain(listOf("www"), "example", "com") | ||
www.parent() shouldBe ApexDomain("example", "com") | ||
|
||
// Multi-level subdomain | ||
val dev = Subdomain(listOf("dev", "www"), "example", "com") | ||
dev.parent().toString() shouldBe "www.example.com" | ||
} |
19 changes: 19 additions & 0 deletions
19
...s/src/jvmTest/kotlin/com/fortechteams/valuetypes/examples/example-network-Subdomain-03.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// This file was automatically generated from Domain.kt by Knit tool. Do not edit. | ||
package com.fotechteams.valuetypes.examples.exampleNetworkSubdomain03 | ||
|
||
import com.fortechteams.valuetypes.network.Subdomain | ||
import io.kotest.matchers.shouldBe | ||
|
||
fun test() { | ||
val domain = Subdomain( | ||
labels = listOf("dev", "staging"), | ||
apexName = "example", | ||
tld = "com" | ||
) | ||
|
||
val hierarchy = domain.getSubdomainHierarchy() | ||
hierarchy.map { it.toString() } shouldBe listOf( | ||
"dev.staging.example.com", | ||
"staging.example.com" | ||
) | ||
} |
12 changes: 12 additions & 0 deletions
12
.../jvmTest/kotlin/com/fortechteams/valuetypes/examples/example-network-TopLevelDomain-01.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// This file was automatically generated from Domain.kt by Knit tool. Do not edit. | ||
package com.fotechteams.valuetypes.examples.exampleNetworkTopLevelDomain01 | ||
|
||
import com.fortechteams.valuetypes.network.TopLevelDomain | ||
import io.kotest.matchers.shouldBe | ||
|
||
fun test() { | ||
val tld = TopLevelDomain("com") | ||
tld.toString() shouldBe "com" | ||
tld.toFQDN() shouldBe "com." | ||
tld.labels shouldBe listOf("com") | ||
} |
44 changes: 44 additions & 0 deletions
44
...les/src/jvmTest/kotlin/com/fortechteams/valuetypes/examples/test/NetworkDomainKnitTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// This file was automatically generated from Domain.kt by Knit tool. Do not edit. | ||
package com.fortechteams.valuetypes.examples.test | ||
|
||
import kotlin.test.Test | ||
import kotlinx.coroutines.test.runTest | ||
|
||
class NetworkDomainKnitTest { | ||
@Test fun exampleNetworkDomain01() = runTest { | ||
com.fotechteams.valuetypes.examples.exampleNetworkDomain01.test() | ||
} | ||
|
||
@Test fun exampleNetworkDomain02() = runTest { | ||
com.fotechteams.valuetypes.examples.exampleNetworkDomain02.test() | ||
} | ||
|
||
@Test fun exampleNetworkDomain03() = runTest { | ||
com.fotechteams.valuetypes.examples.exampleNetworkDomain03.test() | ||
} | ||
|
||
@Test fun exampleNetworkTopLevelDomain01() = runTest { | ||
com.fotechteams.valuetypes.examples.exampleNetworkTopLevelDomain01.test() | ||
} | ||
|
||
@Test fun exampleNetworkApexDomain01() = runTest { | ||
com.fotechteams.valuetypes.examples.exampleNetworkApexDomain01.test() | ||
} | ||
|
||
@Test fun exampleNetworkApexDomain02() = runTest { | ||
com.fotechteams.valuetypes.examples.exampleNetworkApexDomain02.test() | ||
} | ||
|
||
@Test fun exampleNetworkSubdomain01() = runTest { | ||
com.fotechteams.valuetypes.examples.exampleNetworkSubdomain01.test() | ||
} | ||
|
||
@Test fun exampleNetworkSubdomain02() = runTest { | ||
com.fotechteams.valuetypes.examples.exampleNetworkSubdomain02.test() | ||
} | ||
|
||
@Test fun exampleNetworkSubdomain03() = runTest { | ||
com.fotechteams.valuetypes.examples.exampleNetworkSubdomain03.test() | ||
} | ||
|
||
} |
Oops, something went wrong.