Skip to content
This repository has been archived by the owner on Jun 10, 2023. It is now read-only.

Commit

Permalink
target version=1.8, make project buildable with java 11, drop slf4j-a…
Browse files Browse the repository at this point in the history
…pi from distribution
  • Loading branch information
paksv committed Aug 23, 2022
1 parent f2e1a22 commit 0e50876
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 37 deletions.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ allprojects {

subprojects {
apply plugin: 'kotlin'
apply plugin: 'java'
apply plugin: 'java-library'

test.useTestNG()
jar.version = null
Expand Down
Empty file modified gradlew
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions plugin-azure-agent/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ agentPlugin.version = null
agentPlugin.baseName = 'cloud-azure-arm'

compileKotlin {
sourceCompatibility = JavaVersion.VERSION_1_6
targetCompatibility = JavaVersion.VERSION_1_6
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
5 changes: 3 additions & 2 deletions plugin-azure-common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ teamcity {

dependencies {
compile 'com.google.code.gson:gson:2.5'
compile 'javax.xml.bind:jaxb-api:2.3.1'
compile "org.jetbrains.kotlin:kotlin-stdlib"
compile "org.apache.httpcomponents:httpclient:4.3.6"
}

compileKotlin {
sourceCompatibility = JavaVersion.VERSION_1_6
targetCompatibility = JavaVersion.VERSION_1_6
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
5 changes: 4 additions & 1 deletion plugin-azure-server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ teamcity {
}
}

configurations.compile {
exclude group: 'org.slf4j', module: 'slf4j-api'
}
dependencies {
agent project(path: ':plugin-azure-agent', configuration: 'plugin')
compile project(':plugin-azure-server-base')
Expand All @@ -43,7 +46,7 @@ dependencies {
provided "org.jetbrains.teamcity.internal:server:$teamcityVersion"
provided 'com.google.code.gson:gson:2.5'
provided 'org.apache.taglibs:taglibs-standard-impl:1.2.3'
provided 'org.slf4j:slf4j-api:1.7.24'
compileOnly 'org.slf4j:slf4j-api:1.7.24'
provided 'net.jcip:jcip-annotations:1.0'
provided 'javax.mail:mail:1.4.7'
provided 'org.bouncycastle:bcprov-jdk15on:1.60'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class FetchInstancesTaskImpl(private val myNotifications: AzureTaskNotifications
myLastUpdatedDate.set(getCurrentUTC())
myIpAddresses.set(ipList.toTypedArray())

val newInstances = instances.associateBy { it.id.toLowerCase() }
val newInstances = instances.associateBy { it.id.lowercase() }
myInstancesCache.putAll(newInstances)

val keysInCache = myInstancesCache.asMap().keys.toSet()
Expand All @@ -169,7 +169,7 @@ class FetchInstancesTaskImpl(private val myNotifications: AzureTaskNotifications
private fun getLiveInstanceFromSnapshot(resource: HasId?): InstanceDescriptor? {
if (resource?.id() == null) return null

val instance = myInstancesCache.getIfPresent(resource.id().toLowerCase())
val instance = myInstancesCache.getIfPresent(resource.id().lowercase())
if (instance == null) return null

if (needUpdate(instance.lastUpdatedDate)) return null
Expand All @@ -196,8 +196,8 @@ class FetchInstancesTaskImpl(private val myNotifications: AzureTaskNotifications

private fun updateContainer(api: Azure, containerId: String, isDeleting: Boolean) {
if (isDeleting) {
myNotifiedInstances.remove(containerId.toLowerCase())
myInstancesCache.invalidate(containerId.toLowerCase())
myNotifiedInstances.remove(containerId.lowercase())
myInstancesCache.invalidate(containerId.lowercase())
return
}
api.containerGroups()
Expand All @@ -207,11 +207,11 @@ class FetchInstancesTaskImpl(private val myNotifications: AzureTaskNotifications
instance, ipList ->
myIpAddresses.set(ipList.toTypedArray())
if (instance != null) {
myNotifiedInstances.add(instance.id.toLowerCase())
myInstancesCache.put(instance.id.toLowerCase(), instance)
myNotifiedInstances.add(instance.id.lowercase())
myInstancesCache.put(instance.id.lowercase(), instance)
} else {
myNotifiedInstances.remove(containerId.toLowerCase())
myInstancesCache.invalidate(containerId.toLowerCase())
myNotifiedInstances.remove(containerId.lowercase())
myInstancesCache.invalidate(containerId.lowercase())
}
}
.take(1)
Expand Down Expand Up @@ -298,7 +298,7 @@ class FetchInstancesTaskImpl(private val myNotifications: AzureTaskNotifications
fetchVirtualMachine(virtualMachine)
.withLatestFrom(fetchIPAddresses(api)) { instance, ipList ->
myIpAddresses.set(ipList.toTypedArray())
myInstancesCache.put(instance.id.toLowerCase(), instance)
myInstancesCache.put(instance.id.lowercase(), instance)
}
.take(1)
.toCompletable()
Expand All @@ -307,8 +307,8 @@ class FetchInstancesTaskImpl(private val myNotifications: AzureTaskNotifications

private fun updateVirtualMachine(api: Azure, virtualMachineId: String, isDeleting: Boolean) {
if (isDeleting) {
myNotifiedInstances.remove(virtualMachineId.toLowerCase())
myInstancesCache.invalidate(virtualMachineId.toLowerCase())
myNotifiedInstances.remove(virtualMachineId.lowercase())
myInstancesCache.invalidate(virtualMachineId.lowercase())
return
}
api.virtualMachines()
Expand All @@ -318,11 +318,11 @@ class FetchInstancesTaskImpl(private val myNotifications: AzureTaskNotifications
instance, ipList ->
myIpAddresses.set(ipList.toTypedArray())
if (instance != null) {
myNotifiedInstances.add(instance.id.toLowerCase())
myInstancesCache.put(instance.id.toLowerCase(), instance)
myNotifiedInstances.add(instance.id.lowercase())
myInstancesCache.put(instance.id.lowercase(), instance)
} else {
myNotifiedInstances.remove(virtualMachineId.toLowerCase())
myInstancesCache.invalidate(virtualMachineId.toLowerCase())
myNotifiedInstances.remove(virtualMachineId.lowercase())
myInstancesCache.invalidate(virtualMachineId.lowercase())
}
}
.take(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ class AzureCloudImageTest : MockObjectTestCase() {
coVerify { myApiConnector.createInstance(
match { i ->
i.imageId == instance.id &&
i.name == myImageDetails.vmNamePrefix!!.toLowerCase() + "1" &&
i.name == myImageDetails.vmNamePrefix!!.lowercase() + "1" &&
i.image == instance &&
i.status == InstanceStatus.STARTING
},
match { userData ->
userData.agentName == myImageDetails.vmNamePrefix!!.toLowerCase() + "1" &&
userData.agentName == myImageDetails.vmNamePrefix!!.lowercase() + "1" &&
userData.profileId == "profileId" &&
userData.profileDescription == "profileDescr"
})
Expand Down Expand Up @@ -138,12 +138,12 @@ class AzureCloudImageTest : MockObjectTestCase() {
coVerify { myApiConnector.createInstance(
match { i ->
i.imageId == instance.id &&
i.name == myImageDetails.vmNamePrefix!!.toLowerCase() + "2" &&
i.name == myImageDetails.vmNamePrefix!!.lowercase() + "2" &&
i.image == instance &&
i.status == InstanceStatus.STARTING
},
match { userData ->
userData.agentName == myImageDetails.vmNamePrefix!!.toLowerCase() + "2" &&
userData.agentName == myImageDetails.vmNamePrefix!!.lowercase() + "2" &&
userData.profileId == "profileId" &&
userData.profileDescription == "profileDescr"
})
Expand Down Expand Up @@ -181,12 +181,12 @@ class AzureCloudImageTest : MockObjectTestCase() {
coVerify { myApiConnector.createInstance(
match { i ->
i.imageId == instance.id &&
i.name == myImageDetails.vmNamePrefix!!.toLowerCase() + "1" &&
i.name == myImageDetails.vmNamePrefix!!.lowercase() + "1" &&
i.image == instance &&
i.status == InstanceStatus.STARTING
},
match { userData ->
userData.agentName == myImageDetails.vmNamePrefix!!.toLowerCase() + "1" &&
userData.agentName == myImageDetails.vmNamePrefix!!.lowercase() + "1" &&
userData.profileId == "profileId" &&
userData.profileDescription == "profileDescr"
})
Expand All @@ -195,12 +195,12 @@ class AzureCloudImageTest : MockObjectTestCase() {
coVerify { myApiConnector.createInstance(
match { i ->
i.imageId == instance.id &&
i.name == myImageDetails.vmNamePrefix!!.toLowerCase() + "2" &&
i.name == myImageDetails.vmNamePrefix!!.lowercase() + "2" &&
i.image == instance &&
i.status == InstanceStatus.STARTING
},
match { userData ->
userData.agentName == myImageDetails.vmNamePrefix!!.toLowerCase() + "2" &&
userData.agentName == myImageDetails.vmNamePrefix!!.lowercase() + "2" &&
userData.profileId == "profileId" &&
userData.profileDescription == "profileDescr"
})
Expand Down Expand Up @@ -240,12 +240,12 @@ class AzureCloudImageTest : MockObjectTestCase() {
coVerify { myApiConnector.createInstance(
match { i ->
i.imageId == instance.id &&
i.name == myImageDetails.vmNamePrefix!!.toLowerCase() + "1" &&
i.name == myImageDetails.vmNamePrefix!!.lowercase() + "1" &&
i.image == instance &&
i.status == InstanceStatus.STARTING
},
match { userData ->
userData.agentName == myImageDetails.vmNamePrefix!!.toLowerCase() + "1" &&
userData.agentName == myImageDetails.vmNamePrefix!!.lowercase() + "1" &&
userData.profileId == "profileId" &&
userData.profileDescription == "profileDescr"
})
Expand All @@ -254,12 +254,12 @@ class AzureCloudImageTest : MockObjectTestCase() {
coVerify { myApiConnector.createInstance(
match { i ->
i.imageId == instance.id &&
i.name == myImageDetails.vmNamePrefix!!.toLowerCase() + "2" &&
i.name == myImageDetails.vmNamePrefix!!.lowercase() + "2" &&
i.image == instance &&
i.status == InstanceStatus.STARTING
},
match { userData ->
userData.agentName == myImageDetails.vmNamePrefix!!.toLowerCase() + "2" &&
userData.agentName == myImageDetails.vmNamePrefix!!.lowercase() + "2" &&
userData.profileId == "profileId" &&
userData.profileDescription == "profileDescr"
})
Expand All @@ -268,12 +268,12 @@ class AzureCloudImageTest : MockObjectTestCase() {
coVerify(exactly = 0) { myApiConnector.createInstance(
match { i ->
i.imageId == instance.id &&
i.name == myImageDetails.vmNamePrefix!!.toLowerCase() + "3" &&
i.name == myImageDetails.vmNamePrefix!!.lowercase() + "3" &&
i.image == instance &&
i.status == InstanceStatus.STARTING
},
match { userData ->
userData.agentName == myImageDetails.vmNamePrefix!!.toLowerCase() + "3" &&
userData.agentName == myImageDetails.vmNamePrefix!!.lowercase() + "3" &&
userData.profileId == "profileId" &&
userData.profileDescription == "profileDescr"
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
package jetbrains.buildServer.clouds.azure.throttler

import io.mockk.*
import jdk.nashorn.internal.objects.NativeArray
import jetbrains.buildServer.clouds.azure.arm.throttler.*
import jetbrains.buildServer.serverSide.TeamCityProperties
import org.jmock.MockObjectTestCase
import org.testng.Assert
import org.testng.annotations.BeforeMethod
Expand All @@ -28,7 +26,6 @@ import rx.Observable
import rx.Observer
import rx.Scheduler
import rx.Single
import rx.internal.util.SubscriptionList
import rx.schedulers.Schedulers
import rx.schedulers.TestScheduler
import rx.subjects.Subject
Expand Down

0 comments on commit 0e50876

Please sign in to comment.