Skip to content

Instantly share code, notes, and snippets.

View Romeh's full-sized avatar

MRomeh Romeh

View GitHub Profile
<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>
@RunWith(MockitoJUnitRunner.class)
public class IgniteAlertsSoreTest {
@Mock
private Ignite ignite;
@Mock
Cache<String, List<AlertEntry>> cache;
@Mock
IgniteCache IgniteCache;
@InjectMocks
private IgniteAlertsStore igniteAlertsStore;
@Builder
@Getter
@Setter
@ToString
@EqualsAndHashCode
public class AlertEntry implements Serializable {
@ApiModelProperty(notes = "the key value alert content for error description required to be entered by user into REST API ", required = true)
@NotNull
private Map<String,String> alertContent;
@ApiModelProperty(notes = "alert error code required to be entered by user into REST API ", required = true)
@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
@Romeh
Romeh / Retry.java
Last active December 3, 2017 17:43
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;
/**
* 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);
}
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);
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 + "/");
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
/**
* 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 {
}