This file contains hidden or 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
@Component | |
public class IgniteAlertConfigStore implements AlertsConfigStore { | |
private static final Logger logger = LoggerFactory.getLogger(IgniteAlertConfigStore.class); | |
// here it will be injected as a spring bean | |
@Autowired | |
private Ignite ignite; | |
@Override | |
public AlertConfigEntry getConfigForServiceIdCodeId(String serviceId, String codeId) { |
This file contains hidden or 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
<dependency> | |
<groupId>org.apache.ignite</groupId> | |
<artifactId>ignite-core</artifactId> | |
<version>${ignite.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>org.apache.ignite</groupId> | |
<artifactId>ignite-spring</artifactId> | |
<version>${ignite.version}</version> | |
</dependency> |
This file contains hidden or 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
@RunWith(MockitoJUnitRunner.class) | |
public class IgniteAlertsSoreTest { | |
@Mock | |
private Ignite ignite; | |
@Mock | |
Cache<String, List<AlertEntry>> cache; | |
@Mock | |
IgniteCache IgniteCache; | |
@InjectMocks | |
private IgniteAlertsStore igniteAlertsStore; |
This file contains hidden or 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
@RunWith(SpringRunner.class) | |
@SpringBootTest(classes = AlertManagerApplication.class,webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) | |
@ActiveProfiles("INTEGRATION_TEST") | |
public class AlertManagerApplicationIT { | |
@LocalServerPort | |
private int port; | |
@Autowired | |
private TestRestTemplate template; | |
private URL base; | |
@Before |
This file contains hidden or 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
package com.test.SpringBootSample.retry; | |
/** | |
* Created by id961900 on 05/09/2017. | |
*/ | |
import java.lang.annotation.ElementType; | |
import java.lang.annotation.Retention; | |
import java.lang.annotation.RetentionPolicy; | |
import java.lang.annotation.Target; |
This file contains hidden or 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
/** | |
* An exception thrown to signal that a retry operation (executed via {@link RetryRule}) has retried more than the | |
* allowed number of times, and has still failed. | |
*/ | |
public final class RetryException extends RuntimeException { | |
private RetryException(@NotNull String message) { | |
super(message); | |
} |
This file contains hidden or 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
public final class RetryRule implements TestRule { | |
@NotNull | |
private Throwable[] errors = new Throwable[0]; | |
private int currentAttempt = 0; | |
@Override | |
public Statement apply(final Statement base, final Description description) { | |
final Retry retryAnnotation = description.getAnnotation(Retry.class); |
This file contains hidden or 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
public class ApplicationSanityCheck{ | |
@Rule | |
public final RetryRule retry = new RetryRule(); | |
private int port = 8080; | |
private RestTemplate template; | |
private URL base; | |
@Before | |
public void setUp() throws Exception { | |
this.base = new URL("http://localhost:" + port + "/"); |
This file contains hidden or 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
Feature: the health can be retrieved | |
Scenario: client makes call to GET /health | |
When the client calls /health | |
Then the client receives response status code of 200 |
This file contains hidden or 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
/** | |
* the main class for cucumber where you configure where the features are defined and which formats of reports needed to be generated | |
*/ | |
@RunWith(Cucumber.class) | |
@CucumberOptions(features = {"src/test/resources/features"}, format = {"pretty", "html:target/reports/cucumber/html", | |
"json:target/cucumber.json", "usage:target/usage.jsonx", "junit:target/junit.xml"}) | |
public class CucumberIntegrationIT { | |
} |