Lopera Mendizabal
1 month ago
68 changed files with 12044 additions and 109 deletions
@ -1,4 +0,0 @@ |
|||
# docker-Java-kubernetes-project |
|||
Deploying Java Applications with Docker and Kubernetes |
|||
|
|||
Credit: https://github.com/danielbryantuk/oreilly-docker-java-shopping/ |
@ -0,0 +1,56 @@ |
|||
<?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/maven-v4_0_0.xsd"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
<groupId>uk.co.danielbryant.djshopping</groupId> |
|||
<artifactId>productcatalogue</artifactId> |
|||
<version>0.0.1-SNAPSHOT</version> |
|||
<build> |
|||
<plugins> |
|||
<plugin> |
|||
<artifactId>maven-compiler-plugin</artifactId> |
|||
<configuration> |
|||
<source>1.8</source> |
|||
<target>1.8</target> |
|||
</configuration> |
|||
</plugin> |
|||
<plugin> |
|||
<artifactId>maven-shade-plugin</artifactId> |
|||
<executions> |
|||
<execution> |
|||
<phase>package</phase> |
|||
<goals> |
|||
<goal>shade</goal> |
|||
</goals> |
|||
<configuration> |
|||
<transformers> |
|||
<transformer /> |
|||
<transformer> |
|||
<mainClass>uk.co.danielbryant.djshopping.productcatalogue.ProductServiceApplication</mainClass> |
|||
</transformer> |
|||
</transformers> |
|||
</configuration> |
|||
</execution> |
|||
</executions> |
|||
<configuration> |
|||
<version>1.6</version> |
|||
<createDependencyReducedPom>true</createDependencyReducedPom> |
|||
<filters> |
|||
<filter> |
|||
<artifact>*:*</artifact> |
|||
<excludes> |
|||
<exclude>META-INF/*.SF</exclude> |
|||
<exclude>META-INF/*.DSA</exclude> |
|||
<exclude>META-INF/*.RSA</exclude> |
|||
</excludes> |
|||
</filter> |
|||
</filters> |
|||
</configuration> |
|||
</plugin> |
|||
</plugins> |
|||
</build> |
|||
<properties> |
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
|||
<dropwizard.version>1.3.27</dropwizard.version> |
|||
<guice.version>4.2.3</guice.version> |
|||
</properties> |
|||
</project> |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,3 @@ |
|||
artifactId=productcatalogue |
|||
groupId=uk.co.danielbryant.djshopping |
|||
version=0.0.1-SNAPSHOT |
@ -0,0 +1,6 @@ |
|||
uk\co\danielbryant\djshopping\productcatalogue\healthchecks\BasicHealthCheck.class |
|||
uk\co\danielbryant\djshopping\productcatalogue\resources\ProductResource.class |
|||
uk\co\danielbryant\djshopping\productcatalogue\services\ProductService.class |
|||
uk\co\danielbryant\djshopping\productcatalogue\model\Product.class |
|||
uk\co\danielbryant\djshopping\productcatalogue\ProductServiceApplication.class |
|||
uk\co\danielbryant\djshopping\productcatalogue\configuration\ProductServiceConfiguration.class |
@ -0,0 +1,6 @@ |
|||
D:\Proyectos\assigment2-CloudTech\docker-Java-kubernetes-project\productcatalogue\src\main\java\uk\co\danielbryant\djshopping\productcatalogue\model\Product.java |
|||
D:\Proyectos\assigment2-CloudTech\docker-Java-kubernetes-project\productcatalogue\src\main\java\uk\co\danielbryant\djshopping\productcatalogue\healthchecks\BasicHealthCheck.java |
|||
D:\Proyectos\assigment2-CloudTech\docker-Java-kubernetes-project\productcatalogue\src\main\java\uk\co\danielbryant\djshopping\productcatalogue\ProductServiceApplication.java |
|||
D:\Proyectos\assigment2-CloudTech\docker-Java-kubernetes-project\productcatalogue\src\main\java\uk\co\danielbryant\djshopping\productcatalogue\resources\ProductResource.java |
|||
D:\Proyectos\assigment2-CloudTech\docker-Java-kubernetes-project\productcatalogue\src\main\java\uk\co\danielbryant\djshopping\productcatalogue\services\ProductService.java |
|||
D:\Proyectos\assigment2-CloudTech\docker-Java-kubernetes-project\productcatalogue\src\main\java\uk\co\danielbryant\djshopping\productcatalogue\configuration\ProductServiceConfiguration.java |
Binary file not shown.
Binary file not shown.
@ -0,0 +1,7 @@ |
|||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
<groupId>uk.co.danielbryant.djshopping</groupId> |
|||
<artifactId>productcatalogue</artifactId> |
|||
<version>0.0.1-SNAPSHOT</version> |
|||
</project> |
Binary file not shown.
@ -0,0 +1,56 @@ |
|||
<?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/maven-v4_0_0.xsd"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
<groupId>uk.co.danielbryant.djshopping</groupId> |
|||
<artifactId>productcatalogue</artifactId> |
|||
<version>0.0.1-SNAPSHOT</version> |
|||
<build> |
|||
<plugins> |
|||
<plugin> |
|||
<artifactId>maven-compiler-plugin</artifactId> |
|||
<configuration> |
|||
<source>1.8</source> |
|||
<target>1.8</target> |
|||
</configuration> |
|||
</plugin> |
|||
<plugin> |
|||
<artifactId>maven-shade-plugin</artifactId> |
|||
<executions> |
|||
<execution> |
|||
<phase>package</phase> |
|||
<goals> |
|||
<goal>shade</goal> |
|||
</goals> |
|||
<configuration> |
|||
<transformers> |
|||
<transformer /> |
|||
<transformer> |
|||
<mainClass>uk.co.danielbryant.djshopping.productcatalogue.ProductServiceApplication</mainClass> |
|||
</transformer> |
|||
</transformers> |
|||
</configuration> |
|||
</execution> |
|||
</executions> |
|||
<configuration> |
|||
<version>1.6</version> |
|||
<createDependencyReducedPom>true</createDependencyReducedPom> |
|||
<filters> |
|||
<filter> |
|||
<artifact>*:*</artifact> |
|||
<excludes> |
|||
<exclude>META-INF/*.SF</exclude> |
|||
<exclude>META-INF/*.DSA</exclude> |
|||
<exclude>META-INF/*.RSA</exclude> |
|||
</excludes> |
|||
</filter> |
|||
</filters> |
|||
</configuration> |
|||
</plugin> |
|||
</plugins> |
|||
</build> |
|||
<properties> |
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
|||
<dropwizard.version>1.3.27</dropwizard.version> |
|||
<guice.version>4.2.3</guice.version> |
|||
</properties> |
|||
</project> |
@ -1,16 +0,0 @@ |
|||
package uk.co.danielbryant.djshopping.shopfront; |
|||
|
|||
import org.junit.Test; |
|||
import org.junit.runner.RunWith; |
|||
import org.springframework.boot.test.context.SpringBootTest; |
|||
import org.springframework.test.context.junit4.SpringRunner; |
|||
|
|||
@RunWith(SpringRunner.class) |
|||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = ShopfrontApplication.class) |
|||
public class ShopfrontApplicationTests { |
|||
|
|||
@Test |
|||
public void contextLoads() { |
|||
} |
|||
|
|||
} |
@ -0,0 +1,3 @@ |
|||
server.port = 8010 |
|||
productCatalogueUri = http://productcatalogue:8020 |
|||
stockManagerUri = http://stockmanager:8030 |
@ -0,0 +1,90 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" |
|||
xmlns="http://www.w3.org/1999/xhtml" |
|||
xmlns:th="http://www.thymeleaf.org"> |
|||
<head> |
|||
<meta charset="utf-8"/> |
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge"/> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"/> |
|||
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> |
|||
|
|||
<title>Welcome to the Docker Java Shopfront!</title> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> |
|||
<!-- Latest compiled and minified CSS --> |
|||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" |
|||
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"/> |
|||
|
|||
<!-- Optional theme --> |
|||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" |
|||
integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous"/> |
|||
|
|||
<!-- Latest compiled and minified JavaScript --> |
|||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" |
|||
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" |
|||
crossorigin="anonymous"></script> |
|||
</head> |
|||
<body> |
|||
<nav class="navbar navbar-inverse navbar-fixed-top"> |
|||
<div class="container-fluid" style="background-color: #ff203b"> |
|||
<div class="navbar-header"> |
|||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" |
|||
aria-expanded="false" aria-controls="navbar"> |
|||
<span class="sr-only">Toggle navigation</span> |
|||
<span class="icon-bar"></span> |
|||
<span class="icon-bar"></span> |
|||
<span class="icon-bar"></span> |
|||
</button> |
|||
<a class="navbar-brand" href="#">Docker Java Shopfront</a> |
|||
</div> |
|||
<div id="navbar" class="navbar-collapse collapse"> |
|||
<ul class="nav navbar-nav navbar-right"> |
|||
<li><a href="#">Help</a></li> |
|||
</ul> |
|||
</div> |
|||
</div> |
|||
</nav> |
|||
|
|||
<div class="container-fluid"> |
|||
<div class="row"> |
|||
<div class="col-sm-3 col-md-2 sidebar"> |
|||
<ul class="nav nav-sidebar"> |
|||
<li class="active"><a href="#">Overview <span class="sr-only">(current)</span></a></li> |
|||
</ul> |
|||
</div> |
|||
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main"> |
|||
<h1 class="page-header">Welcome to the Docker Java Shopfront!</h1> |
|||
<h2 class="sub-header">Please select a product!</h2> |
|||
<div class="table-responsive"> |
|||
|
|||
<table class="table table-striped" id="product-table"> |
|||
<thead> |
|||
<tr> |
|||
<th>Product Num</th> |
|||
<th>SKU</th> |
|||
<th>Name</th> |
|||
<th>Description</th> |
|||
<th>Price £</th> |
|||
<th>Qty Available</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr th:each="product : ${products}"> |
|||
<td th:text="${product.id}">1</td> |
|||
<td th:text="${product.sku}">12345678</td> |
|||
<td th:text="${product.name}">Widget</td> |
|||
<td th:text="${product.description}">Widget</td> |
|||
<td th:text="${#numbers.formatDecimal(product.price, 0, 'COMMA', 2, 'POINT')}">1.19</td> |
|||
<td th:text="${product.amountAvailable}">2</td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> |
|||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> |
|||
<!-- Include all compiled plugins (below), or include individual files as needed --> |
|||
<script src="js/bootstrap.min.js"></script> |
|||
</body> |
|||
</html> |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,5 @@ |
|||
#Generated by Apache Maven |
|||
#Tue Apr 16 16:49:44 CEST 2024 |
|||
artifactId=shopfront |
|||
groupId=uk.co.danielbryant.djshopping |
|||
version=0.0.1-SNAPSHOT |
@ -0,0 +1,11 @@ |
|||
uk\co\danielbryant\djshopping\shopfront\repo\StockRepo$1.class |
|||
uk\co\danielbryant\djshopping\shopfront\services\dto\StockDTO.class |
|||
uk\co\danielbryant\djshopping\shopfront\model\Product.class |
|||
uk\co\danielbryant\djshopping\shopfront\repo\ProductRepo$1.class |
|||
uk\co\danielbryant\djshopping\shopfront\resources\ProductResource.class |
|||
uk\co\danielbryant\djshopping\shopfront\ShopfrontApplication.class |
|||
uk\co\danielbryant\djshopping\shopfront\controllers\HomeController.class |
|||
uk\co\danielbryant\djshopping\shopfront\services\ProductService.class |
|||
uk\co\danielbryant\djshopping\shopfront\repo\ProductRepo.class |
|||
uk\co\danielbryant\djshopping\shopfront\repo\StockRepo.class |
|||
uk\co\danielbryant\djshopping\shopfront\services\dto\ProductDTO.class |
@ -0,0 +1,9 @@ |
|||
D:\Proyectos\assigment2-CloudTech\docker-Java-kubernetes-project\shopfront\src\main\java\uk\co\danielbryant\djshopping\shopfront\repo\StockRepo.java |
|||
D:\Proyectos\assigment2-CloudTech\docker-Java-kubernetes-project\shopfront\src\main\java\uk\co\danielbryant\djshopping\shopfront\resources\ProductResource.java |
|||
D:\Proyectos\assigment2-CloudTech\docker-Java-kubernetes-project\shopfront\src\main\java\uk\co\danielbryant\djshopping\shopfront\services\dto\ProductDTO.java |
|||
D:\Proyectos\assigment2-CloudTech\docker-Java-kubernetes-project\shopfront\src\main\java\uk\co\danielbryant\djshopping\shopfront\ShopfrontApplication.java |
|||
D:\Proyectos\assigment2-CloudTech\docker-Java-kubernetes-project\shopfront\src\main\java\uk\co\danielbryant\djshopping\shopfront\repo\ProductRepo.java |
|||
D:\Proyectos\assigment2-CloudTech\docker-Java-kubernetes-project\shopfront\src\main\java\uk\co\danielbryant\djshopping\shopfront\services\ProductService.java |
|||
D:\Proyectos\assigment2-CloudTech\docker-Java-kubernetes-project\shopfront\src\main\java\uk\co\danielbryant\djshopping\shopfront\model\Product.java |
|||
D:\Proyectos\assigment2-CloudTech\docker-Java-kubernetes-project\shopfront\src\main\java\uk\co\danielbryant\djshopping\shopfront\controllers\HomeController.java |
|||
D:\Proyectos\assigment2-CloudTech\docker-Java-kubernetes-project\shopfront\src\main\java\uk\co\danielbryant\djshopping\shopfront\services\dto\StockDTO.java |
File diff suppressed because it is too large
Binary file not shown.
@ -0,0 +1,76 @@ |
|||
<?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> |
|||
|
|||
<groupId>uk.co.danielbryant.djshopping</groupId> |
|||
<artifactId>shopfront</artifactId> |
|||
<version>0.0.1-SNAPSHOT</version> |
|||
<packaging>jar</packaging> |
|||
|
|||
<name>shopfront</name> |
|||
<description>Docker Java application Shopfront</description> |
|||
|
|||
<parent> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-parent</artifactId> |
|||
<version>1.5.22.RELEASE</version> |
|||
</parent> |
|||
|
|||
<properties> |
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
|||
<java.version>1.8</java.version> |
|||
</properties> |
|||
|
|||
<dependencyManagement> |
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>org.springframework.cloud</groupId> |
|||
<artifactId>spring-cloud-dependencies</artifactId> |
|||
<version>Dalston.SR5</version> |
|||
<type>pom</type> |
|||
<scope>import</scope> |
|||
</dependency> |
|||
</dependencies> |
|||
</dependencyManagement> |
|||
|
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-thymeleaf</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-actuator</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.springframework.cloud</groupId> |
|||
<artifactId>spring-cloud-starter-hystrix</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.springframework.cloud</groupId> |
|||
<artifactId>spring-cloud-starter-eureka</artifactId> |
|||
</dependency> |
|||
<!-- Test --> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-test</artifactId> |
|||
<scope>test</scope> |
|||
</dependency> |
|||
</dependencies> |
|||
|
|||
<build> |
|||
<plugins> |
|||
<plugin> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-maven-plugin</artifactId> |
|||
</plugin> |
|||
|
|||
<plugin> |
|||
<groupId>org.codehaus.mojo</groupId> |
|||
<artifactId>versions-maven-plugin</artifactId> |
|||
</plugin> |
|||
</plugins> |
|||
|
|||
</build> |
|||
</project> |
Binary file not shown.
Binary file not shown.
@ -0,0 +1,228 @@ |
|||
var CucumberHTML = {}; |
|||
|
|||
CucumberHTML.DOMFormatter = function(rootNode) { |
|||
var currentUri; |
|||
var currentFeature; |
|||
var currentElement; |
|||
var currentSteps; |
|||
|
|||
var currentStepIndex; |
|||
var currentStep; |
|||
var $templates = $(CucumberHTML.templates); |
|||
|
|||
this.uri = function(uri) { |
|||
currentUri = uri; |
|||
}; |
|||
|
|||
this.feature = function(feature) { |
|||
currentFeature = blockElement(rootNode, feature, 'feature'); |
|||
}; |
|||
|
|||
this.background = function(background) { |
|||
currentElement = featureElement(background, 'background'); |
|||
currentStepIndex = 1; |
|||
}; |
|||
|
|||
this.scenario = function(scenario) { |
|||
currentElement = featureElement(scenario, 'scenario'); |
|||
currentStepIndex = 1; |
|||
}; |
|||
|
|||
this.scenarioOutline = function(scenarioOutline) { |
|||
currentElement = featureElement(scenarioOutline, 'scenario_outline'); |
|||
currentStepIndex = 1; |
|||
}; |
|||
|
|||
this.step = function(step) { |
|||
var stepElement = $('.step', $templates).clone(); |
|||
stepElement.appendTo(currentSteps); |
|||
populate(stepElement, step, 'step'); |
|||
|
|||
if (step.doc_string) { |
|||
docString = $('.doc_string', $templates).clone(); |
|||
docString.appendTo(stepElement); |
|||
// TODO: use a syntax highlighter based on the content_type
|
|||
docString.text(step.doc_string.value); |
|||
} |
|||
if (step.rows) { |
|||
dataTable = $('.data_table', $templates).clone(); |
|||
dataTable.appendTo(stepElement); |
|||
var tBody = dataTable.find('tbody'); |
|||
$.each(step.rows, function(index, row) { |
|||
var tr = $('<tr></tr>').appendTo(tBody); |
|||
$.each(row.cells, function(index, cell) { |
|||
var td = $('<td>' + cell + '</td>').appendTo(tBody); |
|||
}); |
|||
}); |
|||
} |
|||
}; |
|||
|
|||
this.examples = function(examples) { |
|||
var examplesElement = blockElement(currentElement.children('details'), examples, 'examples'); |
|||
var examplesTable = $('.examples_table', $templates).clone(); |
|||
examplesTable.appendTo(examplesElement.children('details')); |
|||
|
|||
$.each(examples.rows, function(index, row) { |
|||
var parent = index == 0 ? examplesTable.find('thead') : examplesTable.find('tbody'); |
|||
var tr = $('<tr></tr>').appendTo(parent); |
|||
$.each(row.cells, function(index, cell) { |
|||
var td = $('<td>' + cell + '</td>').appendTo(tr); |
|||
}); |
|||
}); |
|||
}; |
|||
|
|||
this.match = function(match) { |
|||
currentStep = currentSteps.find('li:nth-child(' + currentStepIndex + ')'); |
|||
currentStepIndex++; |
|||
}; |
|||
|
|||
this.result = function(result) { |
|||
currentStep.addClass(result.status); |
|||
if (result.status == 'failed') { |
|||
populateStepError(currentStep, result.error_message); |
|||
} |
|||
currentElement.addClass(result.status); |
|||
var isLastStep = currentSteps.find('li:nth-child(' + currentStepIndex + ')').length == 0; |
|||
if (isLastStep) { |
|||
if (currentSteps.find('.failed').length == 0) { |
|||
// No failed steps. Collapse it.
|
|||
currentElement.find('details').removeAttr('open'); |
|||
} else { |
|||
currentElement.find('details').attr('open', 'open'); |
|||
} |
|||
} |
|||
}; |
|||
|
|||
this.embedding = function(mimeType, data) { |
|||
if (mimeType.match(/^image\//)) |
|||
{ |
|||
currentStep.append('<img src="' + data + '">'); |
|||
} |
|||
else if (mimeType.match(/^video\//)) |
|||
{ |
|||
currentStep.append('<video src="' + data + '" type="' + mimeType + '" autobuffer controls>Your browser doesn\'t support video.</video>'); |
|||
} |
|||
else if (mimeType.match(/^text\//)) |
|||
{ |
|||
this.write(data); |
|||
} |
|||
}; |
|||
|
|||
this.write = function(text) { |
|||
currentStep.append('<pre class="embedded-text">' + text + '</pre>'); |
|||
}; |
|||
|
|||
this.before = function(before) { |
|||
if(before.status != 'passed') { |
|||
currentElement = featureElement({keyword: 'Before', name: '', description: ''}, 'before'); |
|||
currentStepIndex = 1; |
|||
populateStepError($('details', currentElement), before.error_message); |
|||
} |
|||
}; |
|||
|
|||
this.after = function(after) { |
|||
if(after.status != 'passed') { |
|||
currentElement = featureElement({keyword: 'After', name: '', description: ''}, 'after'); |
|||
currentStepIndex++; |
|||
populateStepError($('details', currentElement), after.error_message); |
|||
} |
|||
}; |
|||
|
|||
function featureElement(statement, itemtype) { |
|||
var e = blockElement(currentFeature.children('details'), statement, itemtype); |
|||
|
|||
currentSteps = $('.steps', $templates).clone(); |
|||
currentSteps.appendTo(e.children('details')); |
|||
|
|||
return e; |
|||
} |
|||
|
|||
function blockElement(parent, statement, itemtype) { |
|||
var e = $('.blockelement', $templates).clone(); |
|||
e.appendTo(parent); |
|||
return populate(e, statement, itemtype); |
|||
} |
|||
|
|||
function populate(e, statement, itemtype) { |
|||
populateTags(e, statement.tags); |
|||
populateComments(e, statement.comments); |
|||
e.find('.keyword').text(statement.keyword); |
|||
e.find('.name').text(statement.name); |
|||
e.find('.description').text(statement.description); |
|||
e.attr('itemtype', 'http://cukes.info/microformat/' + itemtype); |
|||
e.addClass(itemtype); |
|||
return e; |
|||
} |
|||
|
|||
function populateComments(e, comments) { |
|||
if (comments !== undefined) { |
|||
var commentsNode = $('.comments', $templates).clone().prependTo(e.find('.header')); |
|||
$.each(comments, function(index, comment) { |
|||
var commentNode = $('.comment', $templates).clone().appendTo(commentsNode); |
|||
commentNode.text(comment.value); |
|||
}); |
|||
} |
|||
} |
|||
|
|||
function populateTags(e, tags) { |
|||
if (tags !== undefined) { |
|||
var tagsNode = $('.tags', $templates).clone().prependTo(e.find('.header')); |
|||
$.each(tags, function(index, tag) { |
|||
var tagNode = $('.tag', $templates).clone().appendTo(tagsNode); |
|||
tagNode.text(tag.name); |
|||
}); |
|||
} |
|||
} |
|||
|
|||
function populateStepError(e, error) { |
|||
if (error !== undefined) { |
|||
errorNode = $('.error', $templates).clone().appendTo(e); |
|||
errorNode.text(error); |
|||
} |
|||
} |
|||
}; |
|||
|
|||
CucumberHTML.templates = '<div>\ |
|||
<section class="blockelement" itemscope>\ |
|||
<details open>\ |
|||
<summary class="header">\ |
|||
<span class="keyword" itemprop="keyword">Keyword</span>: <span itemprop="name" class="name">This is the block name</span>\ |
|||
</summary>\ |
|||
<div itemprop="description" class="description">The description goes here</div>\ |
|||
</details>\ |
|||
</section>\ |
|||
\ |
|||
<ol class="steps"></ol>\ |
|||
\ |
|||
<ol>\ |
|||
<li class="step"><span class="keyword" itemprop="keyword">Keyword</span><span class="name" itemprop="name">Name</span></li>\ |
|||
</ol>\ |
|||
\ |
|||
<pre class="doc_string"></pre>\ |
|||
\ |
|||
<pre class="error"></pre>\ |
|||
\ |
|||
<table class="data_table">\ |
|||
<tbody>\ |
|||
</tbody>\ |
|||
</table>\ |
|||
\ |
|||
<table class="examples_table">\ |
|||
<thead></thead>\ |
|||
<tbody></tbody>\ |
|||
</table>\ |
|||
\ |
|||
<section class="embed">\ |
|||
<img itemprop="screenshot" class="screenshot" />\ |
|||
</section>\ |
|||
<div class="tags"></div>\ |
|||
<span class="tag"></span>\ |
|||
<div class="comments"></div>\ |
|||
<div class="comment"></div>\ |
|||
<div>'; |
|||
|
|||
if (typeof module !== 'undefined') { |
|||
module.exports = CucumberHTML; |
|||
} else if (typeof define !== 'undefined') { |
|||
define([], function() { return CucumberHTML; }); |
|||
} |
@ -0,0 +1,14 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta charset="utf-8"> |
|||
<title>Cucumber Features</title> |
|||
<link href="style.css" rel="stylesheet"> |
|||
<script src="jquery-1.8.2.min.js"></script> |
|||
<script src="formatter.js"></script> |
|||
<script src="report.js"></script> |
|||
</head> |
|||
<body> |
|||
<div class="cucumber-report"></div> |
|||
</body> |
|||
</html> |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,96 @@ |
|||
.cucumber-report .body { |
|||
font-family: Helvetica,Arial,sans-serif; |
|||
} |
|||
|
|||
.cucumber-report .keyword { |
|||
font-weight: bold; |
|||
} |
|||
|
|||
.cucumber-report .description { |
|||
font-style: italic; |
|||
margin-left: 20px; |
|||
} |
|||
|
|||
.cucumber-report details > section { |
|||
margin-left: 20px; |
|||
} |
|||
|
|||
.cucumber-report ol.steps { |
|||
list-style-type: none; |
|||
margin-top: 0; |
|||
margin-bottom: 0; |
|||
} |
|||
|
|||
.cucumber-report .step .embedded-text { |
|||
background: #dddddd; |
|||
} |
|||
|
|||
.cucumber-report .doc_string { |
|||
margin: 0 0 0 20px; |
|||
} |
|||
|
|||
.cucumber-report table { |
|||
border-collapse: collapse; |
|||
border: 1px; |
|||
border-style: solid; |
|||
} |
|||
|
|||
.cucumber-report td, .cucumber-report th { |
|||
border: 1px; |
|||
border-style: solid; |
|||
padding-left: 4px; |
|||
padding-right: 4px; |
|||
} |
|||
|
|||
.cucumber-report table { |
|||
margin-left: 20px; |
|||
} |
|||
|
|||
.cucumber-report thead { |
|||
background-color: #C0C0C0; |
|||
} |
|||
|
|||
.cucumber-report .passed { |
|||
background-color: #C5D88A; |
|||
} |
|||
|
|||
.cucumber-report .undefined, .cucumber-report .pending { |
|||
background-color: #EAEC2D; |
|||
} |
|||
|
|||
.cucumber-report .skipped { |
|||
background-color: #2DEAEC; |
|||
} |
|||
|
|||
.cucumber-report .failed { |
|||
background-color: #D88A8A; |
|||
} |
|||
|
|||
.cucumber-report .tags { |
|||
display: inline; |
|||
} |
|||
|
|||
.cucumber-report .tag { |
|||
margin-right: 0.25em; |
|||
color: #246ac1; |
|||
} |
|||
|
|||
.cucumber-report .comments { |
|||
display: inline; |
|||
} |
|||
|
|||
.cucumber-report .comment { |
|||
margin 0; |
|||
padding 0; |
|||
} |
|||
|
|||
.cucumber-report .error { |
|||
margin: .2em .75em; |
|||
padding: .2em; |
|||
border: 1px solid #900; |
|||
background-color: #EDBBBB; |
|||
} |
|||
|
|||
#cucumber-templates { |
|||
display: none; |
|||
} |
@ -1,15 +0,0 @@ |
|||
package functional; |
|||
|
|||
import cucumber.api.CucumberOptions; |
|||
import cucumber.api.junit.Cucumber; |
|||
import org.junit.runner.RunWith; |
|||
|
|||
@RunWith(Cucumber.class) |
|||
@CucumberOptions(monochrome = true, |
|||
features = "classpath:features/", |
|||
plugin = "html:build/reports/cucumber", |
|||
glue = "functional", |
|||
strict = true) |
|||
public class FunctionalTests { |
|||
|
|||
} |
@ -1,52 +0,0 @@ |
|||
package functional; |
|||
|
|||
import cucumber.api.java.en.Given; |
|||
import cucumber.api.java.en.Then; |
|||
import cucumber.api.java.en.When; |
|||
import org.junit.runner.RunWith; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.boot.test.context.SpringBootTest; |
|||
import org.springframework.boot.test.web.client.TestRestTemplate; |
|||
import org.springframework.test.context.ContextConfiguration; |
|||
import org.springframework.test.context.junit4.SpringRunner; |
|||
import uk.co.danielbryant.djshopping.stockmanager.StockManagerApplication; |
|||
import uk.co.danielbryant.djshopping.stockmanager.model.Stock; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
|
|||
import static org.hamcrest.MatcherAssert.assertThat; |
|||
import static org.hamcrest.collection.IsCollectionWithSize.hasSize; |
|||
import static org.hamcrest.core.Is.is; |
|||
|
|||
@ContextConfiguration |
|||
@RunWith(SpringRunner.class) |
|||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = StockManagerApplication.class) |
|||
public class RestStepDefs { |
|||
|
|||
@Autowired |
|||
private TestRestTemplate restTemplate; |
|||
|
|||
private List<Stock> stocks; |
|||
|
|||
@Given("^the application has been initialised with test data$") |
|||
public void init() { |
|||
//the default profile loads synthetic stocks
|
|||
} |
|||
|
|||
@When("^the client gets all stocks$") |
|||
public void getAllStocks() { |
|||
Stock[] stockArray = restTemplate.getForObject("/stocks", Stock[].class); |
|||
stocks = Arrays.asList(stockArray); |
|||
} |
|||
|
|||
@Then("^a list of (.*) stocks will be returned$") |
|||
public void assertListOfStocksLength(int length) { |
|||
assertThat(stocks, hasSize(length)); |
|||
} |
|||
|
|||
@Then("^the stock at index (.*) will have the sku (.*)$") |
|||
public void assertStockHasSku(int stockIndex, String sku) { |
|||
assertThat(stocks.get(stockIndex).getSku(), is(sku)); |
|||
} |
|||
} |
@ -1,20 +0,0 @@ |
|||
package uk.co.danielbryant.djshopping.stockmanager; |
|||
|
|||
import org.junit.Test; |
|||
import org.junit.runner.RunWith; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.boot.test.context.SpringBootTest; |
|||
import org.springframework.boot.test.web.client.TestRestTemplate; |
|||
import org.springframework.test.context.junit4.SpringRunner; |
|||
|
|||
@RunWith(SpringRunner.class) |
|||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = StockManagerApplication.class) |
|||
public class ShopfrontApplicationTests { |
|||
|
|||
@Autowired |
|||
private TestRestTemplate testRestTemplate; |
|||
|
|||
@Test |
|||
public void contextLoads() { |
|||
} |
|||
} |
@ -0,0 +1 @@ |
|||
server.port = 8030 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,3 @@ |
|||
artifactId=stockmanager |
|||
groupId=uk.co.danielbryant.djshopping |
|||
version=0.0.1-SNAPSHOT |
@ -0,0 +1,7 @@ |
|||
uk\co\danielbryant\djshopping\stockmanager\config\DataGenerator.class |
|||
uk\co\danielbryant\djshopping\stockmanager\StockManagerApplication.class |
|||
uk\co\danielbryant\djshopping\stockmanager\exceptions\StockNotFoundException.class |
|||
uk\co\danielbryant\djshopping\stockmanager\resources\StockResource.class |
|||
uk\co\danielbryant\djshopping\stockmanager\services\StockService.class |
|||
uk\co\danielbryant\djshopping\stockmanager\model\Stock.class |
|||
uk\co\danielbryant\djshopping\stockmanager\repositories\StockRepository.class |
@ -0,0 +1,7 @@ |
|||
D:\Proyectos\assigment2-CloudTech\docker-Java-kubernetes-project\stockmanager\src\main\java\uk\co\danielbryant\djshopping\stockmanager\services\StockService.java |
|||
D:\Proyectos\assigment2-CloudTech\docker-Java-kubernetes-project\stockmanager\src\main\java\uk\co\danielbryant\djshopping\stockmanager\config\DataGenerator.java |
|||
D:\Proyectos\assigment2-CloudTech\docker-Java-kubernetes-project\stockmanager\src\main\java\uk\co\danielbryant\djshopping\stockmanager\StockManagerApplication.java |
|||
D:\Proyectos\assigment2-CloudTech\docker-Java-kubernetes-project\stockmanager\src\main\java\uk\co\danielbryant\djshopping\stockmanager\repositories\StockRepository.java |
|||
D:\Proyectos\assigment2-CloudTech\docker-Java-kubernetes-project\stockmanager\src\main\java\uk\co\danielbryant\djshopping\stockmanager\exceptions\StockNotFoundException.java |
|||
D:\Proyectos\assigment2-CloudTech\docker-Java-kubernetes-project\stockmanager\src\main\java\uk\co\danielbryant\djshopping\stockmanager\resources\StockResource.java |
|||
D:\Proyectos\assigment2-CloudTech\docker-Java-kubernetes-project\stockmanager\src\main\java\uk\co\danielbryant\djshopping\stockmanager\model\Stock.java |
File diff suppressed because it is too large
Binary file not shown.
@ -0,0 +1,85 @@ |
|||
<?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> |
|||
|
|||
<groupId>uk.co.danielbryant.djshopping</groupId> |
|||
<artifactId>stockmanager</artifactId> |
|||
<version>0.0.1-SNAPSHOT</version> |
|||
<packaging>jar</packaging> |
|||
|
|||
<name>stockmanager</name> |
|||
<description>Docker Java application stock manager</description> |
|||
|
|||
<parent> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-parent</artifactId> |
|||
<version>2.3.7.RELEASE</version> |
|||
</parent> |
|||
|
|||
<properties> |
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
|||
<java.version>1.8</java.version> |
|||
<cucumber.version>1.2.6</cucumber.version> |
|||
<hamcrest-core.version>2.2</hamcrest-core.version> |
|||
</properties> |
|||
|
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-web</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-data-jpa</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.h2database</groupId> |
|||
<artifactId>h2</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-actuator</artifactId> |
|||
</dependency> |
|||
<!-- Test --> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-test</artifactId> |
|||
<scope>test</scope> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.hamcrest</groupId> |
|||
<artifactId>hamcrest-core</artifactId> |
|||
<version>${hamcrest-core.version}</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>info.cukes</groupId> |
|||
<artifactId>cucumber-java</artifactId> |
|||
<version>${cucumber.version}</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>info.cukes</groupId> |
|||
<artifactId>cucumber-junit</artifactId> |
|||
<version>${cucumber.version}</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>info.cukes</groupId> |
|||
<artifactId>cucumber-spring</artifactId> |
|||
<version>${cucumber.version}</version> |
|||
</dependency> |
|||
</dependencies> |
|||
|
|||
<build> |
|||
<plugins> |
|||
<plugin> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-maven-plugin</artifactId> |
|||
</plugin> |
|||
<plugin> |
|||
<groupId>org.codehaus.mojo</groupId> |
|||
<artifactId>versions-maven-plugin</artifactId> |
|||
<version>2.7</version> |
|||
</plugin> |
|||
</plugins> |
|||
</build> |
|||
</project> |
Binary file not shown.
Binary file not shown.
@ -0,0 +1,11 @@ |
|||
Feature: Retrieving Stocks |
|||
|
|||
Scenario: Should be able to get a list of all stocks |
|||
Given the application has been initialised with test data |
|||
When the client gets all stocks |
|||
Then a list of 5 stocks will be returned |
|||
|
|||
Scenario: Should be able to get the correct SKU for the first stock |
|||
Given the application has been initialised with test data |
|||
When the client gets all stocks |
|||
Then the stock at index 0 will have the sku 12345678 |
Loading…
Reference in new issue