-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
73 changed files
with
1,057 additions
and
1,297 deletions.
There are no files selected for viewing
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
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
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
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
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
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,26 @@ | ||
# Default parameters for Gradle tasks in the root project are propagated to the downstream projects. | ||
# These default parameters could be overridden by passing arguments to the make command in the following way: | ||
# make build-stable GRADLE_COMPILE_PARAMS="-x test -q" | ||
|
||
# Execute Gradle as a daemon. | ||
org.gradle.daemon=true | ||
|
||
# Equivalent to --build-cache; this enables caching, significantly speeding up consecutive runs. | ||
org.gradle.caching=true | ||
|
||
# Maximum memory set to 4G. If OutOfMemoryError persists, consider increasing the value and adding the -Xms4g parameter. | ||
org.gradle.jvmargs=-Xmx4g | ||
|
||
# This parameter performs the configuration phase before all other tasks and only when needed, optimizing Gradle for not so big projects. | ||
org.gradle.configureondemand=true | ||
|
||
# Enable parallel execution of Gradle tasks. Max workers set to 7, optimal for most modern PCs with hyper-threading and more than 4 physical cores. | ||
# This configuration ensures at least 1 core remains for OS purposes, preventing console glitches, SSH connection drops, and similar issues. | ||
org.gradle.parallel=true | ||
org.gradle.workers.max=7 | ||
|
||
# Suppress gradle welcome messages. | ||
org.gradle.welcome=never | ||
|
||
# Display only info messages. Alternatively, one could use the 'quiet' level to reduce the output. | ||
org.gradle.logging.level=info |
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
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
90 changes: 90 additions & 0 deletions
90
...test/java/org/openkilda/northbound/utils/flowhistory/FlowHistoryRangeConstraintsTest.java
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,90 @@ | ||
/* Copyright 2023 Telstra Open Source | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.openkilda.northbound.utils.flowhistory; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertThrows; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import org.openkilda.messaging.error.MessageException; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import java.time.Instant; | ||
import java.util.Optional; | ||
|
||
class FlowHistoryRangeConstraintsTest { | ||
@Test | ||
void validateTimeParametersTest() { | ||
assertThrows(MessageException.class, () -> | ||
new FlowHistoryRangeConstraints(Optional.of(300L), Optional.of(20L), Optional.empty())); | ||
|
||
assertDoesNotThrow(() -> | ||
new FlowHistoryRangeConstraints(Optional.of(20L), Optional.of(300L), Optional.empty())); | ||
|
||
assertDoesNotThrow(() -> | ||
new FlowHistoryRangeConstraints(Optional.empty(), Optional.of(300L), Optional.empty())); | ||
|
||
assertDoesNotThrow(() -> | ||
new FlowHistoryRangeConstraints(Optional.of(20L), Optional.empty(), Optional.empty())); | ||
} | ||
|
||
@Test | ||
void whenNoTimeParameterProvided_defaultIsSet() { | ||
FlowHistoryRangeConstraints f1 = new FlowHistoryRangeConstraints( | ||
Optional.empty(), Optional.of(300L), Optional.empty()); | ||
assertEquals(Instant.ofEpochSecond(0L), f1.getTimeFrom()); | ||
|
||
FlowHistoryRangeConstraints f2 = new FlowHistoryRangeConstraints( | ||
Optional.of(300L), Optional.empty(), Optional.empty()); | ||
assertTrue(f2.getTimeTo().isBefore(Instant.now().plusNanos(1))); | ||
|
||
FlowHistoryRangeConstraints f3 = new FlowHistoryRangeConstraints( | ||
Optional.empty(), Optional.empty(), Optional.empty()); | ||
assertEquals(Instant.ofEpochSecond(0L), f3.getTimeFrom()); | ||
assertTrue(f3.getTimeTo().isBefore(Instant.now().plusNanos(1))); | ||
} | ||
|
||
@Test | ||
void maxCountTest() { | ||
assertThrows(MessageException.class, () -> | ||
new FlowHistoryRangeConstraints(Optional.empty(), Optional.empty(), Optional.of(-5))); | ||
|
||
assertDoesNotThrow(() -> | ||
new FlowHistoryRangeConstraints(Optional.empty(), Optional.empty(), Optional.empty())); | ||
|
||
assertDoesNotThrow(() -> | ||
new FlowHistoryRangeConstraints(Optional.empty(), Optional.empty(), Optional.of(12))); | ||
} | ||
|
||
@Test | ||
void contentRangeRequiredTest() { | ||
FlowHistoryRangeConstraints f1 = new FlowHistoryRangeConstraints( | ||
Optional.empty(), Optional.of(300L), Optional.empty()); | ||
assertFalse(f1.isContentRangeRequired(142)); | ||
FlowHistoryRangeConstraints f2 = new FlowHistoryRangeConstraints( | ||
Optional.of(300L), Optional.empty(), Optional.empty()); | ||
assertFalse(f2.isContentRangeRequired(142)); | ||
FlowHistoryRangeConstraints f3 = new FlowHistoryRangeConstraints( | ||
Optional.empty(), Optional.empty(), Optional.of(1)); | ||
assertFalse(f3.isContentRangeRequired(142)); | ||
FlowHistoryRangeConstraints f4 = new FlowHistoryRangeConstraints( | ||
Optional.empty(), Optional.empty(), Optional.empty()); | ||
assertTrue(f4.isContentRangeRequired(142)); | ||
} | ||
} |
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
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
15 changes: 15 additions & 0 deletions
15
...oovy/org/openkilda/functionaltests/error/flow/FlowEndpointsNotSwappedExpectedError.groovy
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,15 @@ | ||
package org.openkilda.functionaltests.error.flow | ||
|
||
import org.openkilda.functionaltests.error.AbstractExpectedError | ||
import org.springframework.http.HttpStatus | ||
|
||
import java.util.regex.Pattern | ||
|
||
class FlowEndpointsNotSwappedExpectedError extends AbstractExpectedError{ | ||
final static HttpStatus statusCode = HttpStatus.INTERNAL_SERVER_ERROR | ||
final static String message = "Could not swap endpoints" | ||
|
||
FlowEndpointsNotSwappedExpectedError(Pattern descriptionPattern) { | ||
super(statusCode, message, descriptionPattern) | ||
} | ||
} |
Oops, something went wrong.