Skip to content
This repository has been archived by the owner on May 27, 2020. It is now read-only.

Commit

Permalink
filling missing steps, correction steps, assertj
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandro2003 authored and aaitor committed Mar 22, 2016
1 parent 69a49e6 commit 03a66c3
Show file tree
Hide file tree
Showing 11 changed files with 165 additions and 146 deletions.
6 changes: 3 additions & 3 deletions testsAT/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -65,7 +65,7 @@
</property>
</properties>
<argLine>-Xmx1024m -XX:+HeapDumpOnOutOfMemoryError
-javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/1.8.2/aspectjweaver-1.8.2.jar</argLine>
-javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/1.8.8/aspectjweaver-1.8.8.jar</argLine>
<useSystemClassloader>true</useSystemClassloader>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import cucumber.api.CucumberOptions;

@CucumberOptions(features = { "src/test/resources/features/automated/automated/StreamStopIndex.feature" })
@CucumberOptions(features = { "src/test/resources/features/automated/StreamStopIndex.feature" })
public class ATStopIndex extends BaseTest {

public ATStopIndex() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import cucumber.api.CucumberOptions;

@CucumberOptions(features = { "src/test/resources/features/StreamStopListen.feature" })
@CucumberOptions(features = { "src/test/resources/features/automated/StreamStopListen.feature" })
public class ATStopListen extends BaseTest {

public ATStopListen() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@

import java.io.IOException;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.*;

import net.sf.expectit.Result;
import kafka.consumer.ConsumerIterator;
Expand Down Expand Up @@ -238,13 +235,26 @@ public void assertStreamActions(

Iterator<StreamAction> sAactions = actions.iterator();
String[] sActions = new String[actions.size()];
int i = 0;
while (sAactions.hasNext()) {
sActions[i] = sAactions.next().toString();
if(!(sActions.length==0)) {
int i = 0;
while (sAactions.hasNext()) {
sActions[i] = sAactions.next().toString();
}
assertThat(expectedActions).as("Unexistant action").contains(sActions);
} else {
assertThat(sActions).as("Unexistant action").isEmpty();
}
assertThat(expectedActions).as("Unexistant action").contains(sActions); //contains(sActions);
}










@Then("^the shell must output the string '(.*?)'$")
public void assertShellOutput(String expectedOutput) throws IOException {
commonspec.getLogger().info("Verifying shell output");
Expand Down
24 changes: 12 additions & 12 deletions testsAT/src/test/resources/features/automated/StreamAlter.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ Feature: Stream alter
alterStream method should add the specified columns to an existing stream

Scenario: Alter non-exixtent stream
Given I drop every existing stream
Given I drop every existing stream
When I alter a stream with name 'testStream', setting its columns (with type) as:
| 1 | Boolean |
Then an exception 'IS' thrown with class 'StratioEngineOperationException' and message like 'Stream .*? does not exists'

Scenario: Alter pre-existing columns
Given I drop every existing stream
When I create a stream with name 'testStream' and columns (with type):
Expand All @@ -16,14 +16,14 @@ Feature: Stream alter
Then the count of created streams is '1'
And the stream 'testStream' has this columns (with name and type):
| 1 | String |
| 2 | Integer |
| 2 | Integer |
And an exception 'IS NOT' thrown

When I alter a stream with name 'testStream', setting its columns (with type) as:
| 1 | Boolean |
| b | String |
Then an exception 'IS' thrown with class 'StratioEngineOperationException' and message like 'Column 1 already exists'

When I alter a stream with name 'testStream', setting its columns (with type) as:
| a | Boolean |
| b | String |
Expand All @@ -32,8 +32,8 @@ Feature: Stream alter
| 1 | String |
| 2 | Integer |
| a | Boolean |
| b | String |
| b | String |

When I alter a stream with name 'testStream', setting its columns (with type) as:
| 6 | Integer |
| 6 | String |
Expand All @@ -44,18 +44,18 @@ Feature: Stream alter
| a | Boolean |
| b | String |
| 6 | Integer |

Scenario: Alter with non-existant column type
When I alter a stream with name 'testStream', setting its columns (with type) as:
| 33 | NiftyType |
Then an exception 'IS' thrown with class 'StratioEngineOperationException' and message like 'Bad column definition at alter'

Scenario: alter with empty columns
When I alter a stream with name 'testStream', setting its columns (with type) as:
||
Then an exception 'IS' thrown with class 'StratioAPISecurityException' and message like 'Invalid column list'
Scenario: Alter a non-existing stream with a non-existant column type
Then an exception 'IS' thrown with class 'StratioAPISecurityException' and message like 'Invalid column list'

Scenario: Alter a non-existing stream with a non-existant column type
When I alter a stream with name 'NonExistantTestStream', setting its columns (with type) as:
| 33 | NiftyType |
Then an exception 'IS' thrown with class 'StratioEngineOperationException' and message like 'Stream .*? does not exists'
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,38 @@ Feature: Stream deletion operation

Scenario: Previous cleaunup
Given I drop every existing stream
Scenario Outline: System stream deletion

Scenario Outline: System stream deletion
When I delete the stream '<streamToDelete>'
Then an exception 'IS' thrown with class 'StratioAPISecurityException' and message like 'Operation drop not allowed in stream .*?'
And the count of created streams is '<streamCount>'
And the count of created streams is '<streamCount>'

Examples:
| streamToDelete | streamCount |
| stratio_stats_base | 0 |
| stratio_stats_global_by_operation | 0 |

Scenario Outline: Existing stream deletion
Scenario Outline: Existing stream deletion
When I create a stream with name '<streamName>' and columns (with type):
| 1 | String |
| 2 | Integer |
And I wait '1' seconds
And I delete the stream '<streamToDelete>'
Then an exception 'IS NOT' thrown
And the count of created streams is '0'
Then an exception 'IS NOT' thrown
And the count of created streams is '0'

Examples:
| streamName | streamToDelete | exception |
| auditorias | auditorias | IS NOT |
| estadisticas | estadisticas | IS NOT |
| '": | '": | IS NOT |
| testDeletion | testDeletion | IS NOT |
| streamName | streamToDelete | exception |
| auditorias | auditorias | IS NOT |
| estadisticas | estadisticas | IS NOT |
| '": | '": | IS NOT |
| testDeletion | testDeletion | IS NOT |

Scenario Outline: Non-existing stream deletion
Scenario Outline: Non-existing stream deletion
When I delete the stream '<streamName>'
Then an exception 'IS' thrown with class '<exceptionClass>' and message like '<message>'
And the count of created streams is '0'

Examples:
| streamName | exceptionClass | message |
| testDeletion | StratioEngineOperationException | .*? does not exists |
Expand Down
89 changes: 49 additions & 40 deletions testsAT/src/test/resources/features/automated/StreamIndex.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,86 +3,95 @@ Feature: Index to elasticsearch
index should backup the whole stream to elasticsearch

Background:
Given I connect to 'Elasticsearch' cluster at '${ES_NODE}'
Given I drop every existing stream
And I empty every existing elasticsearch index
# Given I drop an elasticsearch index named 'stratiodecision'

Scenario Outline: Indexing a neat stream
# Given I drop an elasticsearch index named 'stratiodecision'
When I create a stream with name '<streamName>' and columns (with type):
| 1 | String |
| 2 | Integer |
When I index a stream with name '<streamName>'
Then the stream '<streamName>' has 'INDEXED' as active actions
Then the stream '<streamName>' has 'SAVE_TO_ELASTICSEARCH' as active actions
When I insert into a stream with name '<streamName>' this data:
| 1 | a |
| 1 | a |
| 2 | 4 |
When I insert into a stream with name '<streamName>' this data:
| 1 | b |
| 1 | b |
| 2 | 5 |
When I wait '30' seconds
When I wait '30' seconds
Then an exception 'IS NOT' thrown
And the 'stratiostreaming' index has a type '<convertedStreamName>' with content (key and value): '1:b,2:5'
And the 'stratiostreaming' index has a type '<convertedStreamName>' with content (key and value): '1:a,2:4'
And I execute an elasticsearch query over index 'stratiodecision' and mapping '<convertedStreamName>' and column '1' with value 'equals' to 'a'
And I execute an elasticsearch query over index 'stratiodecision' and mapping '<convertedStreamName>' and column '2' with value 'equals' to '4'
Then There are results found with:
| 1 | 2 |
| a | 4 |
And I execute an elasticsearch query over index 'stratiodecision' and mapping '<convertedStreamName>' and column '1' with value 'equals' to 'b'
And I execute an elasticsearch query over index 'stratiodecision' and mapping '<convertedStreamName>' and column '2' with value 'equals' to 'c'
Then There are results found with:
| 1 | 2 |
| b | 5 |
# Then I drop an elasticsearch index named 'stratiodecision'

Examples:
| streamName | convertedStreamName |
| streamName | convertedStreamName |
| " | %22 |
| testESnumber | testESnumber |
| 0x0008 | %08 |
| ' | %27 |
| / | %2F |
| korean:향 | korean:향 |
| korean:향 | korean:향 |
| 0x0000 | %00 |

Scenario Outline: Indexing an unnacepted stream name
When I create a stream with name '<streamName>' and columns (with type):
| c1 | String |
When I index a stream with name '<streamName>'
Then the stream '<streamName>' has '' as active actions
Then an exception 'IS' thrown with class 'StratioAPISecurityException' and message like 'Stream name .*? is not compatible with INDEX action'

Examples:
| streamName |
| |


Scenario Outline: Index a stream, delete it, recreate it with different contract and listen again
When I create a stream with name '<streamName>' and columns (with type):
| 1 | String |
| 2 | Integer |
When I index a stream with name '<streamName>'
Then the stream '<streamName>' has 'INDEXED' as active actions
Then the stream '<streamName>' has 'SAVE_TO_ELASTICSEARCH' as active actions
When I insert into a stream with name '<streamName>' this data:
| 1 | a |
| 1 | a |
| 2 | 4 |
When I insert into a stream with name '<streamName>' this data:
| 1 | b |
| 1 | b |
| 2 | 5 |
When I wait '20' seconds
When I wait '20' seconds
Then an exception 'IS NOT' thrown
And the 'stratiostreaming' index has a type '<streamName>' with content (key and value): '1:b,2:5'
And the 'stratiostreaming' index has a type '<streamName>' with content (key and value): '1:a,2:4'

And I execute an elasticsearch query over index 'stratiodecision' and mapping '<streamName>' and column '1' with value 'equals' to 'b'
And I execute an elasticsearch query over index 'stratiodecision' and mapping '<streamName>' and column '2' with value 'equals' to '5'
Then There are results found with:
| 1 | 2 |
| b | 5 |
And I execute an elasticsearch query over index 'stratiodecision' and mapping '<streamName>' and column '1' with value 'equals' to 'a'
And I execute an elasticsearch query over index 'stratiodecision' and mapping '<streamName>' and column '2' with value 'equals' to '4'
Then There are results found with:
| 1 | 2 |
| a | 4 |

Given I drop every existing stream
Given I drop an elasticsearch index named 'stratiodecision'
When I create a stream with name '<streamName>' and columns (with type):
| c1 | String |
| c1 | String |
Then the stream '<streamName>' has '' as active actions
When I index a stream with name '<streamName>'
Then the stream '<streamName>' has 'INDEXED' as active actions
Then the stream '<streamName>' has 'SAVE_TO_ELASTICSEARCH' as active actions
When I insert into a stream with name '<streamName>' this data:
| c1 | a |
| c1 | a |
When I insert into a stream with name '<streamName>' this data:
| c1 | b |
When I wait '20' seconds
| c1 | b |
When I wait '20' seconds
Then an exception 'IS NOT' thrown

Examples:
| streamName |
| a |
| streamName |
| a |

Scenario Outline: Index from a an non-existing stream
When I index a stream with name '<streamName>'
Then an exception 'IS' thrown with class 'StratioEngineOperationException' and message like 'Stream <streamName> does not exists'

Scenario Outline: Index from a an non-existing stream
When I index a stream with name '<streamName>'
Then an exception 'IS' thrown with class 'StratioEngineOperationException' and message like 'Stream <streamName> does not exists'

Examples:
| streamName |
| streamName |
| inexistentIndexTestStream |

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Feature: Setting a milliseconds value for timing out a communication.
When I set a '1' milliseconds ACK timeout

Scenario: Wipe every stream on a previous scenario so it wont collide with setting the timeout
When I set a '10000' milliseconds ACK timeout
When I set a '10000' milliseconds ACK timeout
Given I drop every existing stream
When I wait '10' seconds

Expand All @@ -17,7 +17,7 @@ Feature: Setting a milliseconds value for timing out a communication.
Then an exception 'IS' thrown with class 'StratioEngineOperationException' and message like 'Acknowledge timeout expired'

Scenario: Timeout set after any operation wont be honored
When I set a '10000' milliseconds ACK timeout
When I set a '10000' milliseconds ACK timeout
And I create a stream with name 'testStreamACK1' and columns (with type):
| 1 | String |
| 2 | Integer |
Expand All @@ -40,19 +40,18 @@ Feature: Setting a milliseconds value for timing out a communication.
Then an exception 'IS' thrown with class 'StratioEngineOperationException' and message like 'Acknowledge timeout expired'

Scenario: Drop Stream on low ack must timeout (even it will succeed eventually)
When I delete the stream 'testStreamACK0'
When I delete the stream 'testStreamACK0'
Then an exception 'IS' thrown with class 'StratioEngineOperationException' and message like 'Acknowledge timeout expired'

Scenario Outline: Non valid ack timeout must be forbidden
When I set a '<timeout>' milliseconds ACK timeout
When I set a '<timeout>' milliseconds ACK timeout
When I create a stream with name '<streamName>' and columns (with type):
| 1 | String |
| 2 | Integer |
Then an exception 'IS' thrown with class 'StratioApiOperationException' and message like '<message>'

Examples:
| streamName | timeout | message |
| testStreamACK5 | -1 | timeout value must be a positive int |
| testStreamACK6 | 0 | timeout value must be a positive int |
| testStreamACK7 | //NULL// | Stream name cannot be null |

Loading

0 comments on commit 03a66c3

Please sign in to comment.