From 402a8f55342c4565431c2a2e7287a70592f3fe33 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Thu, 6 Oct 2022 12:51:27 +0200 Subject: style: Eliminate use of wildcard imports This change updates the repository to remove the use of wildcard imports everywhere. Wildcard imports are not allowed by default by Ktlint as well as Google's Java style guide. --- .../kotlin/org/opendc/compute/service/driver/Host.kt | 2 +- .../org/opendc/compute/service/internal/ClientImage.kt | 2 +- .../org/opendc/compute/service/internal/ClientServer.kt | 2 +- .../compute/service/internal/ComputeServiceImpl.kt | 17 ++++++++++++++--- .../opendc/compute/service/internal/InternalFlavor.kt | 2 +- .../opendc/compute/service/internal/InternalImage.kt | 2 +- .../opendc/compute/service/internal/InternalServer.kt | 4 +++- .../opendc/compute/service/scheduler/FilterScheduler.kt | 2 +- .../service/scheduler/filters/DifferentHostFilter.kt | 2 +- .../compute/service/scheduler/filters/SameHostFilter.kt | 2 +- .../org/opendc/compute/service/ComputeServiceTest.kt | 15 ++++++++++++--- .../org/opendc/compute/service/InternalFlavorTest.kt | 5 +++-- .../org/opendc/compute/service/InternalImageTest.kt | 5 +++-- .../org/opendc/compute/service/InternalServerTest.kt | 11 ++++++++--- .../compute/service/scheduler/FilterSchedulerTest.kt | 11 +++++++++-- .../main/kotlin/org/opendc/compute/simulator/SimHost.kt | 12 ++++++++---- .../simulator/failure/StochasticVictimSelector.kt | 2 +- .../org/opendc/compute/simulator/internal/Guest.kt | 7 ++++++- .../compute/simulator/internal/HostFaultInjectorImpl.kt | 6 +++++- .../kotlin/org/opendc/compute/simulator/SimHostTest.kt | 14 +++++++++++--- 20 files changed, 91 insertions(+), 34 deletions(-) (limited to 'opendc-compute') diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/Host.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/Host.kt index 67b144d9..fad8757e 100644 --- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/Host.kt +++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/Host.kt @@ -27,7 +27,7 @@ import org.opendc.compute.service.driver.telemetry.GuestCpuStats import org.opendc.compute.service.driver.telemetry.GuestSystemStats import org.opendc.compute.service.driver.telemetry.HostCpuStats import org.opendc.compute.service.driver.telemetry.HostSystemStats -import java.util.* +import java.util.UUID /** * Base interface for representing compute resources that host virtualized [Server] instances. diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ClientImage.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ClientImage.kt index e0b5c171..f0032acf 100644 --- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ClientImage.kt +++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ClientImage.kt @@ -23,7 +23,7 @@ package org.opendc.compute.service.internal import org.opendc.compute.api.Image -import java.util.* +import java.util.UUID /** * An [Image] implementation that is passed to clients but delegates its implementation to another class. diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ClientServer.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ClientServer.kt index 45775640..6cd7d30f 100644 --- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ClientServer.kt +++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ClientServer.kt @@ -28,7 +28,7 @@ import org.opendc.compute.api.Server import org.opendc.compute.api.ServerState import org.opendc.compute.api.ServerWatcher import java.time.Instant -import java.util.* +import java.util.UUID /** * A [Server] implementation that is passed to clients but delegates its implementation to another class. diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ComputeServiceImpl.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ComputeServiceImpl.kt index 519cf6c6..caa95e09 100644 --- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ComputeServiceImpl.kt +++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ComputeServiceImpl.kt @@ -22,10 +22,18 @@ package org.opendc.compute.service.internal -import kotlinx.coroutines.* +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Job +import kotlinx.coroutines.cancel +import kotlinx.coroutines.isActive +import kotlinx.coroutines.launch import mu.KotlinLogging import org.opendc.common.util.Pacer -import org.opendc.compute.api.* +import org.opendc.compute.api.ComputeClient +import org.opendc.compute.api.Flavor +import org.opendc.compute.api.Image +import org.opendc.compute.api.Server +import org.opendc.compute.api.ServerState import org.opendc.compute.service.ComputeService import org.opendc.compute.service.driver.Host import org.opendc.compute.service.driver.HostListener @@ -35,7 +43,10 @@ import org.opendc.compute.service.telemetry.SchedulerStats import java.time.Clock import java.time.Duration import java.time.Instant -import java.util.* +import java.util.ArrayDeque +import java.util.Deque +import java.util.Random +import java.util.UUID import kotlin.coroutines.CoroutineContext import kotlin.math.max diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalFlavor.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalFlavor.kt index b8fb6279..acd87dfc 100644 --- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalFlavor.kt +++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalFlavor.kt @@ -23,7 +23,7 @@ package org.opendc.compute.service.internal import org.opendc.compute.api.Flavor -import java.util.* +import java.util.UUID /** * Internal stateful representation of a [Flavor]. diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalImage.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalImage.kt index d9ed5896..a0a35a55 100644 --- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalImage.kt +++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalImage.kt @@ -23,7 +23,7 @@ package org.opendc.compute.service.internal import org.opendc.compute.api.Image -import java.util.* +import java.util.UUID /** * Internal stateful representation of an [Image]. diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalServer.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalServer.kt index f9da24d8..e3bae405 100644 --- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalServer.kt +++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalServer.kt @@ -23,7 +23,9 @@ package org.opendc.compute.service.internal import mu.KotlinLogging -import org.opendc.compute.api.* +import org.opendc.compute.api.Server +import org.opendc.compute.api.ServerState +import org.opendc.compute.api.ServerWatcher import org.opendc.compute.service.driver.Host import java.time.Instant import java.util.UUID diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/FilterScheduler.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/FilterScheduler.kt index 8c2d4715..233f5ef6 100644 --- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/FilterScheduler.kt +++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/FilterScheduler.kt @@ -26,7 +26,7 @@ import org.opendc.compute.api.Server import org.opendc.compute.service.internal.HostView import org.opendc.compute.service.scheduler.filters.HostFilter import org.opendc.compute.service.scheduler.weights.HostWeigher -import java.util.* +import java.util.Random import kotlin.math.min /** diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/DifferentHostFilter.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/DifferentHostFilter.kt index 54f2f303..f6736ac0 100644 --- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/DifferentHostFilter.kt +++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/DifferentHostFilter.kt @@ -24,7 +24,7 @@ package org.opendc.compute.service.scheduler.filters import org.opendc.compute.api.Server import org.opendc.compute.service.internal.HostView -import java.util.* +import java.util.UUID /** * A [HostFilter] that ensures an instance is scheduled on a different host from a set of instances. diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/SameHostFilter.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/SameHostFilter.kt index febb085d..090e1437 100644 --- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/SameHostFilter.kt +++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/SameHostFilter.kt @@ -24,7 +24,7 @@ package org.opendc.compute.service.scheduler.filters import org.opendc.compute.api.Server import org.opendc.compute.service.internal.HostView -import java.util.* +import java.util.UUID /** * A [HostFilter] that ensures an instance is scheduled on the same host as all other instances in a set of instances. diff --git a/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/ComputeServiceTest.kt b/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/ComputeServiceTest.kt index 4f4008bc..73e9b3d7 100644 --- a/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/ComputeServiceTest.kt +++ b/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/ComputeServiceTest.kt @@ -22,14 +22,23 @@ package org.opendc.compute.service -import io.mockk.* +import io.mockk.coEvery +import io.mockk.coVerify +import io.mockk.every +import io.mockk.mockk +import io.mockk.slot +import io.mockk.verify import kotlinx.coroutines.delay import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows -import org.opendc.compute.api.* +import org.opendc.compute.api.Flavor +import org.opendc.compute.api.Image +import org.opendc.compute.api.Server +import org.opendc.compute.api.ServerState +import org.opendc.compute.api.ServerWatcher import org.opendc.compute.service.driver.Host import org.opendc.compute.service.driver.HostListener import org.opendc.compute.service.driver.HostModel @@ -41,7 +50,7 @@ import org.opendc.compute.service.scheduler.filters.VCpuFilter import org.opendc.compute.service.scheduler.weights.RamWeigher import org.opendc.simulator.kotlin.SimulationCoroutineScope import org.opendc.simulator.kotlin.runSimulation -import java.util.* +import java.util.UUID /** * Test suite for the [ComputeService] interface. diff --git a/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/InternalFlavorTest.kt b/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/InternalFlavorTest.kt index 18d698c6..fe92f7f2 100644 --- a/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/InternalFlavorTest.kt +++ b/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/InternalFlavorTest.kt @@ -22,14 +22,15 @@ package org.opendc.compute.service -import io.mockk.* +import io.mockk.every +import io.mockk.mockk import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertNotEquals import org.junit.jupiter.api.Test import org.opendc.compute.api.Flavor import org.opendc.compute.service.internal.ComputeServiceImpl import org.opendc.compute.service.internal.InternalFlavor -import java.util.* +import java.util.UUID /** * Test suite for the [InternalFlavor] implementation. diff --git a/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/InternalImageTest.kt b/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/InternalImageTest.kt index e1cb0128..d60aa628 100644 --- a/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/InternalImageTest.kt +++ b/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/InternalImageTest.kt @@ -22,7 +22,8 @@ package org.opendc.compute.service -import io.mockk.* +import io.mockk.every +import io.mockk.mockk import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertNotEquals import org.junit.jupiter.api.Test @@ -30,7 +31,7 @@ import org.opendc.compute.api.Image import org.opendc.compute.service.internal.ComputeServiceImpl import org.opendc.compute.service.internal.InternalFlavor import org.opendc.compute.service.internal.InternalImage -import java.util.* +import java.util.UUID /** * Test suite for the [InternalFlavor] implementation. diff --git a/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/InternalServerTest.kt b/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/InternalServerTest.kt index 9e59949f..05a8160e 100644 --- a/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/InternalServerTest.kt +++ b/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/InternalServerTest.kt @@ -22,9 +22,14 @@ package org.opendc.compute.service -import io.mockk.* +import io.mockk.coVerify +import io.mockk.every +import io.mockk.mockk +import io.mockk.verify import kotlinx.coroutines.yield -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertNotEquals +import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows import org.opendc.compute.api.Server @@ -35,7 +40,7 @@ import org.opendc.compute.service.internal.InternalFlavor import org.opendc.compute.service.internal.InternalImage import org.opendc.compute.service.internal.InternalServer import org.opendc.simulator.kotlin.runSimulation -import java.util.* +import java.util.UUID /** * Test suite for the [InternalServer] implementation. diff --git a/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/scheduler/FilterSchedulerTest.kt b/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/scheduler/FilterSchedulerTest.kt index 350ac944..8ecf7f87 100644 --- a/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/scheduler/FilterSchedulerTest.kt +++ b/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/scheduler/FilterSchedulerTest.kt @@ -33,12 +33,19 @@ import org.opendc.compute.api.Server import org.opendc.compute.service.driver.HostModel import org.opendc.compute.service.driver.HostState import org.opendc.compute.service.internal.HostView -import org.opendc.compute.service.scheduler.filters.* +import org.opendc.compute.service.scheduler.filters.ComputeFilter +import org.opendc.compute.service.scheduler.filters.DifferentHostFilter +import org.opendc.compute.service.scheduler.filters.InstanceCountFilter +import org.opendc.compute.service.scheduler.filters.RamFilter +import org.opendc.compute.service.scheduler.filters.SameHostFilter +import org.opendc.compute.service.scheduler.filters.VCpuCapacityFilter +import org.opendc.compute.service.scheduler.filters.VCpuFilter import org.opendc.compute.service.scheduler.weights.CoreRamWeigher import org.opendc.compute.service.scheduler.weights.InstanceCountWeigher import org.opendc.compute.service.scheduler.weights.RamWeigher import org.opendc.compute.service.scheduler.weights.VCpuWeigher -import java.util.* +import java.util.Random +import java.util.UUID /** * Test suite for the [FilterScheduler]. diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt index c04573b5..9969ac2b 100644 --- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt +++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt @@ -22,18 +22,22 @@ package org.opendc.compute.simulator -import kotlinx.coroutines.* +import kotlinx.coroutines.yield import org.opendc.compute.api.Flavor import org.opendc.compute.api.Server import org.opendc.compute.api.ServerState -import org.opendc.compute.service.driver.* +import org.opendc.compute.service.driver.Host +import org.opendc.compute.service.driver.HostListener +import org.opendc.compute.service.driver.HostModel +import org.opendc.compute.service.driver.HostState import org.opendc.compute.service.driver.telemetry.GuestCpuStats import org.opendc.compute.service.driver.telemetry.GuestSystemStats import org.opendc.compute.service.driver.telemetry.HostCpuStats import org.opendc.compute.service.driver.telemetry.HostSystemStats import org.opendc.compute.simulator.internal.Guest import org.opendc.compute.simulator.internal.GuestListener -import org.opendc.simulator.compute.* +import org.opendc.simulator.compute.SimBareMetalMachine +import org.opendc.simulator.compute.SimMachineContext import org.opendc.simulator.compute.kernel.SimHypervisor import org.opendc.simulator.compute.model.MachineModel import org.opendc.simulator.compute.model.MemoryUnit @@ -41,7 +45,7 @@ import org.opendc.simulator.compute.workload.SimWorkload import java.time.Clock import java.time.Duration import java.time.Instant -import java.util.* +import java.util.UUID import kotlin.coroutines.CoroutineContext /** diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/failure/StochasticVictimSelector.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/failure/StochasticVictimSelector.kt index fcd9dd7e..b6d466bd 100644 --- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/failure/StochasticVictimSelector.kt +++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/failure/StochasticVictimSelector.kt @@ -24,7 +24,7 @@ package org.opendc.compute.simulator.failure import org.apache.commons.math3.distribution.RealDistribution import org.opendc.compute.simulator.SimHost -import java.util.* +import java.util.Random import kotlin.math.roundToInt /** diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/internal/Guest.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/internal/Guest.kt index cc084526..6b74fa3a 100644 --- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/internal/Guest.kt +++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/internal/Guest.kt @@ -22,7 +22,12 @@ package org.opendc.compute.simulator.internal -import kotlinx.coroutines.* +import kotlinx.coroutines.CancellationException +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Job +import kotlinx.coroutines.cancel +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch import mu.KotlinLogging import org.opendc.compute.api.Server import org.opendc.compute.api.ServerState diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/internal/HostFaultInjectorImpl.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/internal/HostFaultInjectorImpl.kt index 7d46e626..f03bffe9 100644 --- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/internal/HostFaultInjectorImpl.kt +++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/internal/HostFaultInjectorImpl.kt @@ -22,7 +22,11 @@ package org.opendc.compute.simulator.internal -import kotlinx.coroutines.* +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Job +import kotlinx.coroutines.cancel +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch import org.apache.commons.math3.distribution.RealDistribution import org.opendc.compute.simulator.SimHost import org.opendc.compute.simulator.failure.HostFault diff --git a/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt b/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt index f63d4c6f..7092d57e 100644 --- a/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt +++ b/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt @@ -22,12 +22,19 @@ package org.opendc.compute.simulator -import kotlinx.coroutines.* +import kotlinx.coroutines.coroutineScope +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch +import kotlinx.coroutines.suspendCancellableCoroutine import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertAll -import org.opendc.compute.api.* +import org.opendc.compute.api.Flavor +import org.opendc.compute.api.Image +import org.opendc.compute.api.Server +import org.opendc.compute.api.ServerState +import org.opendc.compute.api.ServerWatcher import org.opendc.compute.service.driver.Host import org.opendc.compute.service.driver.HostListener import org.opendc.simulator.compute.SimBareMetalMachine @@ -45,7 +52,8 @@ import org.opendc.simulator.flow.FlowEngine import org.opendc.simulator.flow.mux.FlowMultiplexerFactory import org.opendc.simulator.kotlin.runSimulation import java.time.Instant -import java.util.* +import java.util.SplittableRandom +import java.util.UUID import kotlin.coroutines.resume /** -- cgit v1.2.3 From 47357afd16f928260db34d4dd3e686fb9ee7c5ff Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Thu, 6 Oct 2022 13:13:10 +0200 Subject: build: Switch to Spotless for formatting This change updates the build configuration to use Spotless for code formating of both Kotlin and Java. --- .../kotlin/org/opendc/compute/api/ServerState.kt | 2 +- .../org/opendc/compute/service/ComputeService.kt | 2 +- .../org/opendc/compute/service/driver/HostState.kt | 2 +- .../service/driver/telemetry/HostSystemStats.kt | 2 +- .../service/scheduler/weights/HostWeigher.kt | 2 +- .../service/scheduler/FilterSchedulerTest.kt | 32 +++++++++++----------- .../org/opendc/compute/simulator/SimHostTest.kt | 2 +- 7 files changed, 22 insertions(+), 22 deletions(-) (limited to 'opendc-compute') diff --git a/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/ServerState.kt b/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/ServerState.kt index a4d7d7d7..2b5aebb1 100644 --- a/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/ServerState.kt +++ b/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/ServerState.kt @@ -49,5 +49,5 @@ public enum class ServerState { /** * The server has been deleted and cannot be started later on. */ - DELETED, + DELETED } diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/ComputeService.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/ComputeService.kt index 28ef7c40..85222c10 100644 --- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/ComputeService.kt +++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/ComputeService.kt @@ -89,7 +89,7 @@ public interface ComputeService : AutoCloseable { context: CoroutineContext, clock: Clock, scheduler: ComputeScheduler, - schedulingQuantum: Duration = Duration.ofMinutes(5), + schedulingQuantum: Duration = Duration.ofMinutes(5) ): ComputeService { return ComputeServiceImpl(context, clock, scheduler, schedulingQuantum) } diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/HostState.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/HostState.kt index ca6c625c..544b6530 100644 --- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/HostState.kt +++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/HostState.kt @@ -39,5 +39,5 @@ public enum class HostState { /** * The host is in an error state and unable to host any guests. */ - ERROR, + ERROR } diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/telemetry/HostSystemStats.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/telemetry/HostSystemStats.kt index 9d34a5ce..56bd017d 100644 --- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/telemetry/HostSystemStats.kt +++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/telemetry/HostSystemStats.kt @@ -47,5 +47,5 @@ public data class HostSystemStats( val guestsTerminated: Int, val guestsRunning: Int, val guestsError: Int, - val guestsInvalid: Int, + val guestsInvalid: Int ) diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/HostWeigher.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/HostWeigher.kt index aca8c4e6..aa8a9d53 100644 --- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/HostWeigher.kt +++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/HostWeigher.kt @@ -70,6 +70,6 @@ public interface HostWeigher { public val weights: DoubleArray, public val min: Double, public val max: Double, - public val multiplier: Double, + public val multiplier: Double ) } diff --git a/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/scheduler/FilterSchedulerTest.kt b/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/scheduler/FilterSchedulerTest.kt index 8ecf7f87..4608bf37 100644 --- a/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/scheduler/FilterSchedulerTest.kt +++ b/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/scheduler/FilterSchedulerTest.kt @@ -74,7 +74,7 @@ internal class FilterSchedulerTest { fun testNoHosts() { val scheduler = FilterScheduler( filters = emptyList(), - weighers = emptyList(), + weighers = emptyList() ) val server = mockk() @@ -88,7 +88,7 @@ internal class FilterSchedulerTest { fun testNoFiltersAndSchedulers() { val scheduler = FilterScheduler( filters = emptyList(), - weighers = emptyList(), + weighers = emptyList() ) val hostA = mockk() @@ -144,7 +144,7 @@ internal class FilterSchedulerTest { fun testHostIsDown() { val scheduler = FilterScheduler( filters = listOf(ComputeFilter()), - weighers = emptyList(), + weighers = emptyList() ) val host = mockk() @@ -163,7 +163,7 @@ internal class FilterSchedulerTest { fun testHostIsUp() { val scheduler = FilterScheduler( filters = listOf(ComputeFilter()), - weighers = emptyList(), + weighers = emptyList() ) val host = mockk() @@ -182,7 +182,7 @@ internal class FilterSchedulerTest { fun testRamFilter() { val scheduler = FilterScheduler( filters = listOf(RamFilter(1.0)), - weighers = emptyList(), + weighers = emptyList() ) val hostA = mockk() @@ -209,7 +209,7 @@ internal class FilterSchedulerTest { fun testRamFilterOvercommit() { val scheduler = FilterScheduler( filters = listOf(RamFilter(1.5)), - weighers = emptyList(), + weighers = emptyList() ) val host = mockk() @@ -230,7 +230,7 @@ internal class FilterSchedulerTest { fun testVCpuFilter() { val scheduler = FilterScheduler( filters = listOf(VCpuFilter(1.0)), - weighers = emptyList(), + weighers = emptyList() ) val hostA = mockk() @@ -257,7 +257,7 @@ internal class FilterSchedulerTest { fun testVCpuFilterOvercommit() { val scheduler = FilterScheduler( filters = listOf(VCpuFilter(16.0)), - weighers = emptyList(), + weighers = emptyList() ) val host = mockk() @@ -278,7 +278,7 @@ internal class FilterSchedulerTest { fun testVCpuCapacityFilter() { val scheduler = FilterScheduler( filters = listOf(VCpuCapacityFilter()), - weighers = emptyList(), + weighers = emptyList() ) val hostA = mockk() @@ -306,7 +306,7 @@ internal class FilterSchedulerTest { fun testInstanceCountFilter() { val scheduler = FilterScheduler( filters = listOf(InstanceCountFilter(limit = 2)), - weighers = emptyList(), + weighers = emptyList() ) val hostA = mockk() @@ -333,7 +333,7 @@ internal class FilterSchedulerTest { fun testAffinityFilter() { val scheduler = FilterScheduler( filters = listOf(SameHostFilter()), - weighers = emptyList(), + weighers = emptyList() ) val serverA = mockk() @@ -372,7 +372,7 @@ internal class FilterSchedulerTest { fun testAntiAffinityFilter() { val scheduler = FilterScheduler( filters = listOf(DifferentHostFilter()), - weighers = emptyList(), + weighers = emptyList() ) val serverA = mockk() @@ -411,7 +411,7 @@ internal class FilterSchedulerTest { fun testRamWeigher() { val scheduler = FilterScheduler( filters = emptyList(), - weighers = listOf(RamWeigher(1.5)), + weighers = listOf(RamWeigher(1.5)) ) val hostA = mockk() @@ -438,7 +438,7 @@ internal class FilterSchedulerTest { fun testCoreRamWeigher() { val scheduler = FilterScheduler( filters = emptyList(), - weighers = listOf(CoreRamWeigher(1.5)), + weighers = listOf(CoreRamWeigher(1.5)) ) val hostA = mockk() @@ -465,7 +465,7 @@ internal class FilterSchedulerTest { fun testVCpuWeigher() { val scheduler = FilterScheduler( filters = emptyList(), - weighers = listOf(VCpuWeigher(16.0)), + weighers = listOf(VCpuWeigher(16.0)) ) val hostA = mockk() @@ -492,7 +492,7 @@ internal class FilterSchedulerTest { fun testInstanceCountWeigher() { val scheduler = FilterScheduler( filters = emptyList(), - weighers = listOf(InstanceCountWeigher(multiplier = -1.0)), + weighers = listOf(InstanceCountWeigher(multiplier = -1.0)) ) val hostA = mockk() diff --git a/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt b/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt index 7092d57e..6be1f3c0 100644 --- a/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt +++ b/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt @@ -225,7 +225,7 @@ internal class SimHostTest { { assertEquals(900001, sysStats.uptime.toMillis(), "Uptime does not match") }, { assertEquals(300000, sysStats.downtime.toMillis(), "Downtime does not match") }, { assertEquals(900001, guestSysStats.uptime.toMillis(), "Guest uptime does not match") }, - { assertEquals(300000, guestSysStats.downtime.toMillis(), "Guest downtime does not match") }, + { assertEquals(300000, guestSysStats.downtime.toMillis(), "Guest downtime does not match") } ) } -- cgit v1.2.3