Skip to content

Commit

Permalink
Fixes #236 - Rework to use containers to simulate various cloud services
Browse files Browse the repository at this point in the history
  • Loading branch information
mnriem committed Aug 22, 2023
1 parent 37d0b19 commit eb5aeca
Show file tree
Hide file tree
Showing 28 changed files with 979 additions and 340 deletions.
24 changes: 3 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,6 @@
# Manorrock Ocelot

_Note this project has gone into passive mode. See below for an explanation_
Ever wondered if you can develop locally for the Cloud? Sure, you can! Give
Manorrock Ocelot a try.

As a developer you have so many Cloud technologies that you have to use or
you have to interact with but what you really want to do is to develop.

Manorrock Ocelot delivers you with the tools to make your cloud journey
straightforward. With our tooling you will be able to quickly get up and running
so you can get back to developing your applications.

## What is passive mode?

A project can go into passive mode for either of two reasons. Either the project
is feature complete and no active development is needed. Or the project is no
longer considered a priority. Whatever the reason the end result is the same.

This means:

1. No more scheduled monthly releases.
2. If a bug is filed it is addressed on a best effort basis.
3. No new features are anticipated.
4. Releases are only cut on a needs basis and not more than once a month.
5. If you want your bug or feature to receive attention sponsoring is your best bet.
We welcome feedback!
138 changes: 138 additions & 0 deletions azure-keyvault/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
<?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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.manorrock.ocelot</groupId>
<artifactId>project</artifactId>
<version>23.8.0-SNAPSHOT</version>
</parent>
<artifactId>ocelot-azure-keyvault</artifactId>
<packaging>war</packaging>
<name>Manorrock Ocelot - Azure Key Vault</name>
<properties>
<!-- other -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- plugins -->
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-sdk-bom</artifactId>
<version>${azure-sdk-bom.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>${jakarta.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-security-keyvault-secrets</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>ROOT</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<release>${java.version}</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven-war-plugin.version}</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${docker-maven-plugin.version}</version>
<configuration>
<images>
<image>
<alias>ocelot-azure-keyvault</alias>
<name>manorrock/ocelot-azure-keyvault:latest</name>
<build>
<contextDir>${basedir}</contextDir>
<dockerFile>src/main/docker/Dockerfile</dockerFile>
</build>
<run>
<ports>
<port>8080:8080</port>
</ports>
<wait>
<http>
<url>http://localhost:8080/</url>
</http>
<time>20000</time>
</wait>
</run>
</image>
</images>
</configuration>
<executions>
<execution>
<id>start</id>
<phase>pre-integration-test</phase>
<goals>
<goal>build</goal>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
3 changes: 3 additions & 0 deletions azure-keyvault/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM ghcr.io/piranhacloud/webprofile:23.8.0
ADD target/ROOT.war /home/piranha
CMD ["java", "-jar", "piranha-dist-webprofile.jar", "--war-file", "ROOT.war"]
13 changes: 13 additions & 0 deletions azure-keyvault/src/main/java/keyvault/KeyVaultApplication.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package keyvault;

import jakarta.ws.rs.ApplicationPath;
import jakarta.ws.rs.core.Application;

/**
* The Azure Key Vault application.
*
* @author Manfred Riem ([email protected])
*/
@ApplicationPath("api")
public class KeyVaultApplication extends Application {
}
33 changes: 33 additions & 0 deletions azure-keyvault/src/main/java/keyvault/KeyVaultResource.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package keyvault;

import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;

/**
* REST API for Azure KeyVault.
*
* @author Manfred Riem ([email protected])
*/
@Path("keyvault")
public class KeyVaultResource {

/**
* Get the secret.
*
* <p>
* For more information, see https://learn.microsoft.com/en-us/rest/api/keyvault/secrets/get-secret/get-secret?tabs=HTTP
* </p>
*
* @param keyVault the key vault.
* @param secretName the secret name.
* @return the secret value.
*/
@Path("{name}/secrets/{secretName}")
@GET
public KeyVaultSecret get(
@PathParam("name") String keyVault,
@PathParam("secretName") String secretName) {
return new KeyVaultSecret("secretValue");
}
}
70 changes: 70 additions & 0 deletions azure-keyvault/src/main/java/keyvault/KeyVaultSecret.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package keyvault;

/**
* The object backing a KeyVault secret.
*
* @author Manfred Riem ([email protected])
*/
public class KeyVaultSecret {

/**
* Stores the id.
*/
private String id;

/**
* Stores the value.
*/
private String value;

/**
* Constructor.
*/
public KeyVaultSecret() {
}

/**
* Constructor.
*
* @param value the secret value.
*/
public KeyVaultSecret(String value) {
this.value = value;
}

/**
* Get the id.
*
* @return the id.
*/
public String getId() {
return id;
}

/**
* Get the value.
*
* @return the value.
*/
public String getValue() {
return value;
}

/**
* Set the id.
*
* @param id the id.
*/
public void setId(String id) {
this.id = id;
}

/**
* Set the value.
*
* @param value the value.
*/
public void setValue(String value) {
this.value = value;
}
}
27 changes: 27 additions & 0 deletions azure-keyvault/src/main/java/keyvault/PingResource.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package keyvault;


import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;

/**
* Ping resource.
*
* @author Manfred Riem ([email protected])
*/
@Path("ping")
public class PingResource {

/**
* Ping.
*
* @return "OK"
*/
@Path("")
@GET
@Produces("text/plain")
public String ping() {
return "OK";
}
}
7 changes: 7 additions & 0 deletions azure-keyvault/src/main/webapp/WEB-INF/beans.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd"
bean-discovery-mode="all">
</beans>
10 changes: 10 additions & 0 deletions azure-keyvault/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd"
version="6.0">
<session-config>
<session-timeout>30</session-timeout>
</session-config>
</web-app>
12 changes: 12 additions & 0 deletions azure-keyvault/src/main/webapp/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>

<html>
<head>
<title>Azure Key Vault simulator</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<h1>Azure Key Vault simulator</h1>
</body>
</html>
Loading

0 comments on commit eb5aeca

Please sign in to comment.