Skip to content

Commit acddcac

Browse files
committed
Replace 'commitId' with 'version' in Service & Tests
1 parent 5806dc8 commit acddcac

File tree

1 file changed

+12
-12
lines changed
  • src/main/kotlin/spp/protocol/platform/general

1 file changed

+12
-12
lines changed

src/main/kotlin/spp/protocol/platform/general/Service.kt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ data class Service(
3333
val layers: List<String> = emptyList(),
3434
val normal: Boolean = true,
3535
val environment: String? = null,
36-
val commitId: String? = null
36+
val version: String? = null
3737
) {
3838

3939
val id by lazy {
40-
if (commitId != null) {
41-
IDManager.ServiceID.buildId("$name|$environment|$commitId", normal)
40+
if (version != null) {
41+
IDManager.ServiceID.buildId("$name|$environment|$version", normal)
4242
} else {
4343
IDManager.ServiceID.buildId(name, normal)
4444
}
@@ -51,7 +51,7 @@ data class Service(
5151
json.getJsonArray("layers").map { it as String },
5252
json.getBoolean("normal"),
5353
json.getString("environment"),
54-
json.getString("commitId")
54+
json.getString("version")
5555
)
5656

5757
fun toJson(): JsonObject {
@@ -62,16 +62,16 @@ data class Service(
6262
json.put("layers", layers)
6363
json.put("normal", normal)
6464
json.put("environment", environment)
65-
json.put("commitId", commitId)
65+
json.put("version", version)
6666
return json
6767
}
6868

6969
fun withEnvironment(environment: String?): Service {
7070
return copy(environment = environment)
7171
}
7272

73-
fun withCommitId(commitId: String?): Service {
74-
return copy(commitId = commitId)
73+
fun withVersion(version: String?): Service {
74+
return copy(version = version)
7575
}
7676

7777
/**
@@ -84,7 +84,7 @@ data class Service(
8484
if (layers != other.layers) return false
8585
if (normal != other.normal) return false
8686
if (environment != null && environment != other.environment) return false
87-
if (commitId != null && commitId != other.commitId) return false
87+
if (version != null && version != other.version) return false
8888
return true
8989
}
9090

@@ -94,7 +94,7 @@ data class Service(
9494
val parts = name.split("|")
9595
return withName(parts[0])
9696
.withEnvironment(if (parts[1] != "null") parts[1] else null)
97-
.withCommitId(if (parts[2] != "null") parts[2] else null)
97+
.withVersion(if (parts[2] != "null") parts[2] else null)
9898
}
9999
return copy(name = name)
100100
}
@@ -107,7 +107,7 @@ data class Service(
107107
return copy(
108108
name = parts[0],
109109
environment = if (parts[1] != "null") parts[1] else null,
110-
commitId = if (parts[2] != "null") parts[2] else null,
110+
version = if (parts[2] != "null") parts[2] else null,
111111
normal = definition.isReal
112112
)
113113
}
@@ -123,7 +123,7 @@ data class Service(
123123
if (layers.isNotEmpty()) append(", layers=$layers")
124124
if (!normal) append(", normal=$normal")
125125
if (environment != null) append(", environment=$environment")
126-
if (commitId != null) append(", commitId=$commitId")
126+
if (version != null) append(", version=$version")
127127
append(")")
128128
}
129129
}
@@ -142,7 +142,7 @@ data class Service(
142142
val parts = name.split("|")
143143
return fromName(parts[0])
144144
.withEnvironment(if (parts[1] != "null") parts[1] else null)
145-
.withCommitId(if (parts[2] != "null") parts[2] else null)
145+
.withVersion(if (parts[2] != "null") parts[2] else null)
146146
}
147147
return Service(name = name)
148148
}

0 commit comments

Comments
 (0)