This repository has been archived by the owner on Jul 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
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
10 changed files
with
343 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,31 +22,26 @@ | |
|
||
package io.github.eocqrs.cmig.session; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Disabled; | ||
import org.hamcrest.MatcherAssert; | ||
import org.hamcrest.Matchers; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.mockito.Mock; | ||
import org.mockito.junit.jupiter.MockitoExtension; | ||
|
||
/** | ||
* Test suite for {@link InFile}. | ||
* | ||
* @author Aliaksei Bialiauski ([email protected]) | ||
* @since 0.0.0 | ||
*/ | ||
@ExtendWith(MockitoExtension.class) | ||
final class InFileTest { | ||
|
||
@Test | ||
@Disabled | ||
void appliesInRightFormat() throws Exception { | ||
Assertions.assertDoesNotThrow( | ||
() -> | ||
new InFile( | ||
new Simple( | ||
"localhost", | ||
9042 | ||
), | ||
"cmig/002-queries-table.cql" | ||
).apply(), | ||
"Applies does not throw exception" | ||
void createsWithMockCassandra(@Mock final Cassandra mock) { | ||
MatcherAssert.assertThat( | ||
"Creates cql in file", | ||
new InFile(mock, "cmig/001-initial-keyspace.cql"), | ||
Matchers.notNullValue() | ||
); | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
src/test/java/io/github/eocqrs/cmig/session/SimpleTest.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,70 @@ | ||
/* | ||
* Copyright (c) 2023 Aliaksei Bialiauski, EO-CQRS | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package io.github.eocqrs.cmig.session; | ||
|
||
import com.datastax.driver.core.Cluster; | ||
import org.hamcrest.MatcherAssert; | ||
import org.hamcrest.Matchers; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.mockito.Mock; | ||
import org.mockito.junit.jupiter.MockitoExtension; | ||
|
||
/** | ||
* Test suite for {@link Simple}. | ||
* | ||
* @author Aliaksei Bialiauski ([email protected]) | ||
* @since 0.0.0 | ||
*/ | ||
@ExtendWith(MockitoExtension.class) | ||
final class SimpleTest { | ||
|
||
@Test | ||
void createsCassandra(@Mock final Cluster mock) { | ||
final Cassandra cassandra = new Simple(mock); | ||
MatcherAssert.assertThat( | ||
"Creates Cassandra", | ||
cassandra, | ||
Matchers.notNullValue() | ||
); | ||
} | ||
|
||
@Test | ||
void closesWithoutException(@Mock final Cluster mock) { | ||
final Cassandra cassandra = new Simple(mock); | ||
Assertions.assertDoesNotThrow( | ||
cassandra::close, | ||
"Closes without exception" | ||
); | ||
} | ||
|
||
@Test | ||
void connectsToMockWithoutException(@Mock final Cluster mock) { | ||
final Cassandra cassandra = new Simple(mock); | ||
Assertions.assertDoesNotThrow( | ||
cassandra::value, | ||
"Connect to mocked cluster doesnt throw exception" | ||
); | ||
} | ||
} |
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,56 @@ | ||
/* | ||
* Copyright (c) 2023 Aliaksei Bialiauski, EO-CQRS | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package it; | ||
|
||
import org.junit.AfterClass; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.testcontainers.containers.CassandraContainer; | ||
import org.testcontainers.utility.DockerImageName; | ||
|
||
/** | ||
* Cassandra for Integration Testing. | ||
* | ||
* @author Aliaksei Bialiauski ([email protected]) | ||
* @since 0.0.0 | ||
*/ | ||
@SuppressWarnings("JTCOP.RuleCorrectTestName") | ||
public abstract class CassandraIntegration { | ||
|
||
protected static final CassandraContainer<?> CASSANDRA = | ||
new CassandraContainer<>( | ||
DockerImageName.parse("cassandra:3.11.15") | ||
).withExposedPorts(9042); | ||
protected static String host; | ||
|
||
@BeforeAll | ||
static void beforeAll() { | ||
CassandraIntegration.CASSANDRA.start(); | ||
CassandraIntegration.host = | ||
CassandraIntegration.CASSANDRA.getHost(); | ||
} | ||
|
||
@AfterClass | ||
public static void tearDown() { | ||
CassandraIntegration.CASSANDRA.stop(); | ||
} | ||
} |
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,46 @@ | ||
/* | ||
* Copyright (c) 2023 Aliaksei Bialiauski, EO-CQRS | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package it; | ||
|
||
import org.hamcrest.MatcherAssert; | ||
import org.hamcrest.core.IsEqual; | ||
import org.junit.jupiter.api.Test; | ||
|
||
/** | ||
* Cassandra Runs Integration test. | ||
* | ||
* @author Aliaksei Bialiauski ([email protected]) | ||
* @since 0.0.0 | ||
*/ | ||
@SuppressWarnings("JTCOP.RuleCorrectTestName") | ||
final class CassandraRunsIT extends CassandraIntegration { | ||
|
||
@Test | ||
void runs() { | ||
MatcherAssert.assertThat( | ||
"Cassandra runs", | ||
CASSANDRA.isRunning(), | ||
new IsEqual<>(true) | ||
); | ||
} | ||
} |
Oops, something went wrong.
4d580ac
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Puzzle
11-6586cbb4
disappeared fromsrc/test/java/io/github/eocqrs/cmig/MasterTest.java
), that's why I closed #24. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.4d580ac
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Puzzle
11-44949247
disappeared fromsrc/test/java/io/github/eocqrs/cmig/MasterTest.java
), that's why I closed #25. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.4d580ac
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Puzzle
36-b04b7b08
discovered insrc/test/java/io/github/eocqrs/cmig/MasterTest.java
) and submitted as #47. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.4d580ac
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Puzzle
36-fd704288
discovered insrc/test/java/io/github/eocqrs/cmig/MasterTest.java
) and submitted as #48. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.