Commit 7710e143 authored by Alicja Reniewicz's avatar Alicja Reniewicz
Browse files

Merge branch 'rc3.1' into 'master'

Rc3.1

See merge request melodic/melodic-upperware!14
parents 6b78216f ba1fa74e
Pipeline #19882 passed with stages
in 22 minutes and 19 seconds
......@@ -101,7 +101,8 @@ melodic.security.enabled=false
### Web configuration - Resources
static.favicon.path=classpath:/public/favicon.ico
static.resource.path=file:${MELODIC_CONFIG_DIR}/resources/
static.resource.path=file:resources/
#static.resource.path=file:${MELODIC_CONFIG_DIR}/resources/
#static.resource.path=file:/opt/ems-server/resources/
static.resource.context=/resources/**
#static.resource.redirect=/resources/index.html
......
......@@ -13,7 +13,7 @@
<parent>
<groupId>eu.melodic.event</groupId>
<artifactId>event-management</artifactId>
<version>3.0.0-SNAPSHOT</version>
<version>3.1.0-SNAPSHOT</version>
</parent>
<artifactId>control-service</artifactId>
......@@ -38,7 +38,7 @@
<dependency>
<groupId>eu.melodic.security.authorization</groupId>
<artifactId>authorization-service-client</artifactId>
<version>3.0.0-SNAPSHOT</version>
<version>${melodic.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
......@@ -163,11 +163,85 @@
<type>jar</type>
<outputDirectory>${project.build.directory}</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>eu.melodic.event</groupId>
<artifactId>baguette-client</artifactId>
<version>${project.version}</version>
<type>tgz</type>
<classifier>installation-package</classifier>
<outputDirectory>${project.build.directory}</outputDirectory>
<destFileName>baguette-client.tgz</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<!-- Checksum Maven plugin (http://checksum-maven-plugin.nicoulaj.net) -->
<plugin>
<groupId>net.nicoulaj.maven.plugins</groupId>
<artifactId>checksum-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>files</goal>
</goals>
</execution>
</executions>
<configuration>
<fileSets>
<fileSet>
<directory>${project.build.directory}</directory>
<!--<directory>target</directory>-->
<includes>
<include>*.zip</include>
<include>*.tar</include>
<include>*.tar.gz</include>
<include>*.tgz</include>
</includes>
<excludes>
<exclude>*.jar</exclude>
</excludes>
</fileSet>
</fileSets>
<algorithms>
<algorithm>MD5</algorithm>
</algorithms>
<individualFiles>true</individualFiles>
<failOnError>true</failOnError>
<failIfNoFiles>false</failIfNoFiles>
</configuration>
</plugin>
<!-- Copy-Rename Maven plugin (https://coderplus.github.io/copy-rename-maven-plugin/) -->
<plugin>
<groupId>com.coderplus.maven.plugins</groupId>
<artifactId>copy-rename-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>copy-files</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<fileSets>
<fileSet>
<sourceFile>../baguette-client/bin/install.sh</sourceFile>
<destinationFile>target/install.sh</destinationFile>
</fileSet>
</fileSets>
<ignoreFileNotFoundOnIncremental>true</ignoreFileNotFoundOnIncremental>
<overWrite>true</overWrite>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
......@@ -187,10 +261,25 @@
<resource>
<targetPath>/config</targetPath>
<directory>${project.basedir}/../config-files</directory>
<excludes>
<exclude>resources/**/*</exclude>
</excludes>
</resource>
<resource>
<!--<resource>
<targetPath>/resources</targetPath>
<directory>${project.basedir}/../config-files/resources</directory>
</resource>-->
<resource>
<targetPath>/resources</targetPath>
<directory>${project.build.directory}</directory>
<include>baguette-client.tgz</include>
<include>baguette-client.tgz.md5</include>
<include>install.sh</include>
</resource>
<resource>
<targetPath>/resources</targetPath>
<directory>${project.basedir}/src/main/resources/public</directory>
<include>*</include>
</resource>
</resources>
</configuration>
......
......@@ -10,8 +10,8 @@
FROM java:8-alpine
ENV BASEDIR /opt/ems-server
#ENV MELODIC_CONFIG_DIR ${BASEDIR}/config
#ENV PAASAGE_CONFIG_DIR ${BASEDIR}/config
ENV MELODIC_CONFIG_DIR ${BASEDIR}/config
ENV PAASAGE_CONFIG_DIR ${BASEDIR}/config
ENV JAR_PATH ${BASEDIR}/jars
WORKDIR ${BASEDIR}
......@@ -23,7 +23,6 @@ ADD config ./config
ADD resources ./resources
RUN mkdir logs
RUN bash -c 'touch jars/*.jar'
RUN bash -c 'chmod +rx ./bin/*.sh'
ENTRYPOINT ["./bin/run.sh"]
\ No newline at end of file
......@@ -14,12 +14,12 @@
<parent>
<groupId>org.ow2.paasage</groupId>
<artifactId>upperware</artifactId>
<version>3.0.0-SNAPSHOT</version>
<version>3.1.0-SNAPSHOT</version>
</parent>
<groupId>eu.melodic.event</groupId>
<artifactId>event-management</artifactId>
<version>3.0.0-SNAPSHOT</version>
<version>3.1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Upperware - Event Management System</name>
......@@ -35,6 +35,7 @@
<esper-version>7.1.0</esper-version>
<!-- MathParser version -->
<mathparser-version>4.2.0</mathparser-version>
<melodic.version>3.1.0-SNAPSHOT</melodic.version>
</properties>
<modules>
......@@ -47,4 +48,4 @@
<module>translator</module>
<module>control-service</module>
</modules>
</project>
\ No newline at end of file
</project>
......@@ -13,7 +13,7 @@
<parent>
<groupId>eu.melodic.event</groupId>
<artifactId>event-management</artifactId>
<version>3.0.0-SNAPSHOT</version>
<version>3.1.0-SNAPSHOT</version>
</parent>
<artifactId>translator</artifactId>
......@@ -55,22 +55,22 @@
<dependency>
<groupId>org.ow2.paasage</groupId>
<artifactId>melodic-commons</artifactId>
<version>3.0.0-SNAPSHOT</version>
<version>${melodic.version}</version>
</dependency>
<dependency>
<groupId>org.ow2.paasage</groupId>
<artifactId>upperware-metamodel</artifactId>
<version>3.0.0-SNAPSHOT</version>
<version>${melodic.version}</version>
</dependency>
<dependency>
<groupId>camel</groupId>
<artifactId>camel</artifactId>
<version>3.0.0-SNAPSHOT</version>
<version>${melodic.version}</version>
</dependency>
<dependency>
<groupId>camel</groupId>
<artifactId>camel.dsl</artifactId>
<version>3.0.0-SNAPSHOT</version>
<version>${melodic.version}</version>
</dependency>
<dependency>
<groupId>eu.melodic</groupId>
......
......@@ -13,7 +13,7 @@
<parent>
<groupId>eu.melodic.event</groupId>
<artifactId>event-management</artifactId>
<version>3.0.0-SNAPSHOT</version>
<version>3.1.0-SNAPSHOT</version>
</parent>
<artifactId>util</artifactId>
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>upperware</artifactId>
<groupId>org.ow2.paasage</groupId>
<version>3.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>eu.functionizer</groupId>
<artifactId>functionizer-testing-tool</artifactId>
<name>Upperware - Functionizer testing tool</name>
<properties>
<java.version>1.8</java.version>
<cdo.version>3.1.0-SNAPSHOT</cdo.version>
<upperware.version>3.1.0-SNAPSHOT</upperware.version>
<!--DOCKER plugin properties-->
<docker.imageName>functionizer-testing-tool</docker.imageName>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.23</version>
</dependency>
<dependency>
<groupId>org.ow2.paasage</groupId>
<artifactId>melodic-commons</artifactId>
</dependency>
<dependency>
<groupId>org.ow2.paasage</groupId>
<artifactId>jwt-commons</artifactId>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-core</artifactId>
<version>1.11.327</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-lambda</artifactId>
<version>1.11.327</version>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-mgmt-resources</artifactId>
<version>1.33.1</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure</artifactId>
<version>1.33.1</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure.functions</groupId>
<artifactId>azure-functions-java-library</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-cloudfunctions</artifactId>
<version>v1-rev20200219-1.30.9</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.13.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.5.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-reporting</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>io.github.cloudiator.client</groupId>
<artifactId>java-rest</artifactId>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!--docker image building plugins start-->
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.groovy.maven</groupId>
<artifactId>gmaven-plugin</artifactId>
</plugin>
<!--docker image building plugins end-->
</plugins>
</build>
</project>
FROM java:8-alpine
VOLUME /tmp
ADD functionizer-testing-tool.jar functionizer-testing-tool.jar
RUN /bin/sh -c "apk add --no-cache bash"
RUN bash -c 'touch /functionizer-testing-tool.jar'
COPY ./run.sh .
RUN bash -c 'chmod +rx run.sh'
ENTRYPOINT ["./run.sh"]
#!/bin/sh
/config/wait-for-cdo.sh && java \
-Duser.timezone=Europe/Warsaw \
-Djava.security.egd=file:/dev/./urandom \
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 \
-jar functionizer-testing-tool.jar
package eu.functionizer.functionizertestingtool;
import eu.paasage.upperware.security.authapi.properties.MelodicSecurityProperties;
import eu.passage.upperware.commons.cloudiator.CloudiatorProperties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
@SpringBootApplication
@EnableConfigurationProperties({CloudiatorProperties.class, MelodicSecurityProperties.class})
public class FunctionizerTestingToolApplication {
public static void main(String[] args) {
SpringApplication.run(FunctionizerTestingToolApplication.class, args);
}
}
package eu.functionizer.functionizertestingtool;
import eu.passage.upperware.commons.model.testing.FunctionizerTestResult;
import eu.functionizer.functionizertestingtool.service.TestRunner;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
@RestController
@Slf4j
@AllArgsConstructor(onConstructor = @__(@Autowired))
public class FunctionizerTestingToolController {
private final TestRunner testRunner;
@RequestMapping("/")
@ResponseStatus(HttpStatus.OK)
public String index() {
return "Welcome to the Functionizer testing tool!";
}
@GetMapping(value = "/health")
@ResponseStatus(HttpStatus.OK)
public void health() {
}
@PostMapping("/test")
@ResponseStatus(HttpStatus.OK)
public FunctionizerTestResult runTests() {
return testRunner.runTests();
}
}
package eu.functionizer.functionizertestingtool;
import eu.paasage.upperware.security.authapi.properties.MelodicSecurityProperties;
import eu.paasage.upperware.security.authapi.token.JWTService;
import eu.paasage.upperware.security.authapi.token.JWTServiceImpl;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class TestingToolContext {
@Bean
public JWTService jWTService(MelodicSecurityProperties melodicSecurityProperties) {
return new JWTServiceImpl(melodicSecurityProperties);
}
}
package eu.functionizer.functionizertestingtool;
import eu.paasage.upperware.security.authapi.JWTAuthorizationFilter;
import eu.paasage.upperware.security.authapi.token.JWTService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
@Slf4j
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class WebSecurity extends WebSecurityConfigurerAdapter {
private final JWTService jwtService;
@Value("${melodic.security.enabled:true}")
private boolean securityEnabled;
@Override
protected void configure(HttpSecurity http) throws Exception {
if (securityEnabled) {
log.info("Running WITH security");
http.cors().and().csrf().disable().authorizeRequests()
.anyRequest().authenticated()
.and()
.addFilter(new JWTAuthorizationFilter(authenticationManager(), jwtService))
// this disables session creation on Spring Security
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
} else {
log.info("Running WITHOUT security");
http.csrf().disable()
.authorizeRequests()
.antMatchers("/**").permitAll()
.anyRequest().authenticated();
}
}
}
package eu.functionizer.functionizertestingtool.model;
import io.github.cloudiator.rest.model.Function;
import io.github.cloudiator.rest.model.NodeCandidate;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import java.util.Map;
@AllArgsConstructor
@Getter
@Setter
public class CloudiatorData {
private Map<String, Function> deployedFunctions;
private Map<String, String> functionDeployNames;
private Map<String, NodeCandidate> nodeCandidates;
private Map<String, String> userSecrets;
}
package eu.functionizer.functionizertestingtool.model;
public class ReportEntryKey {
public final static String EVENT = "event";
public final static String EXPECTED_VALUE = "expectedValue";
public final static String CONDITION = "condition";
public final static String ACTUAL_OUTPUT = "actualOutput";
public final static String IGNORED = "ignored";
public final static String ROOT = "root";
public final static String STAGE = "stage";
public final static String FAILURE_CAUSE = "failureCause";
}