commit f7210f59f7b3a2438ccafa76aa3893e87549c484 Author: Peter Nagy Date: Fri Apr 21 16:10:48 2017 +0200 reset diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2f7896d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +target/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..862e76d --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# wercker-springboot diff --git a/assembly.xml b/assembly.xml new file mode 100644 index 0000000..d7ab1c6 --- /dev/null +++ b/assembly.xml @@ -0,0 +1,24 @@ + + bin + / + + zip + + + + / + target + + *.war + + + + / + src/resources + + manifest.json + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..89913eb --- /dev/null +++ b/pom.xml @@ -0,0 +1,82 @@ + + + 4.0.0 + + com.example.springboot + springbootdemo + 0.0.1 + war + + demo + Demo project for Spring Boot + + + org.springframework.boot + spring-boot-starter-parent + 1.3.3.RELEASE + + + + + + UTF-8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.apache.tomcat.embed + tomcat-embed-jasper + provided + + + org.springframework.boot + spring-boot-starter-tomcat + provided + + + javax.servlet + jstl + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + maven-assembly-plugin + + + assembly.xml + + false + + + + make-assembly + package + + single + + + + + + + + + diff --git a/src/main/java/com/example/springboot/DemoApplication.java b/src/main/java/com/example/springboot/DemoApplication.java new file mode 100644 index 0000000..2322d04 --- /dev/null +++ b/src/main/java/com/example/springboot/DemoApplication.java @@ -0,0 +1,34 @@ +package com.example.springboot; + +import java.util.Arrays; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.context.web.SpringBootServletInitializer; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.ComponentScan; + +@SpringBootApplication +@ComponentScan +@EnableAutoConfiguration +public class DemoApplication extends SpringBootServletInitializer { + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + return application.sources(DemoApplication.class); + } + + public static void main(String[] args) { + ApplicationContext ctx = SpringApplication.run(DemoApplication.class, args); + + System.out.println("Beans provided by Spring Boot:"); + + String[] beanNames = ctx.getBeanDefinitionNames(); + Arrays.sort(beanNames); + for (String beanName : beanNames) { + System.out.println(beanName); + } + } +} diff --git a/src/main/java/com/example/springboot/config/WebConfig.java b/src/main/java/com/example/springboot/config/WebConfig.java new file mode 100644 index 0000000..582a869 --- /dev/null +++ b/src/main/java/com/example/springboot/config/WebConfig.java @@ -0,0 +1,40 @@ +package com.example.springboot.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.DispatcherServlet; +import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; +import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.view.InternalResourceViewResolver; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; + +@ComponentScan +@Configuration +public class WebConfig extends WebMvcConfigurerAdapter { + + private static final String[] CLASSPATH_RESOURCE_LOCATIONS = { + "classpath:/META-INF/resources/", "classpath:/resources/", + "classpath:/static/", "classpath:/public/" }; + + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + registry.addResourceHandler("/**").addResourceLocations(CLASSPATH_RESOURCE_LOCATIONS); + } + + @Override + public void addViewControllers(ViewControllerRegistry registry) { + registry.addViewController("/").setViewName("welcome"); + registry.addViewController("/env").setViewName("environment"); + } + + @Bean + public InternalResourceViewResolver viewResolver() { + InternalResourceViewResolver viewResolver = new InternalResourceViewResolver(); + viewResolver.setPrefix("/WEB-INF/views/"); + viewResolver.setSuffix(".jsp"); + return viewResolver; + } + +} \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..b83ae9d --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1 @@ +#server.contextPath=/springboot \ No newline at end of file diff --git a/src/main/resources/static/css/cloud3.css b/src/main/resources/static/css/cloud3.css new file mode 100644 index 0000000..1f205e8 --- /dev/null +++ b/src/main/resources/static/css/cloud3.css @@ -0,0 +1,223 @@ +/* This css will be used by cloud website */ +body { + font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; + font-size: 13px; + line-height: 18px; + color: #333333; + margin: 0 auto; +} + +header,nav,footer,section { + display: block; +} + +p,div,span { + padding: 0; + margin: 0; +} + +a { + text-decoration: none; + color: #1466B2; +} + +img { + max-width: 100%; + vertical-align: middle; +} + +ol,ul { + list-style: none; + margin: 0; + padding: 0; +} + +.container { + position: relative; + padding: 0 10px 0 10px; + margin: 0 auto; + /* 960px width with 10px padding on each side = 940px */ + width: 940px; +} + +.container .columns { + float: left; + display: inline; + /*margin-left: 10px;*/ + /*margin-right: 10px;*/ +} + +.container:after { + content: "\0020"; + display: block; + height: 0; + clear: both; + visibility: hidden; +} + +/* Header CSS */ +header { + /* background: url("../images/header-tile.gif"); */ + /* height: 34px; */ + /* height is 35px but 1px is the border-bottom = 34px */ + height: 34px; + width: 100%; + background-color: #f5f5f5; + border-bottom: 1px solid #ffffff; + box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.1); + /*padding-left: 10px;*/ + /*padding-right: 10px;*/ +} + +header hgroup { + position: relative; +} + +header .cloudLogo { + width: 220px; + margin-top: 7px; +} + +header .cloudLogo a { + display: inline-block; +} + +.navbar-fixed-top { + top: 0px; + left: 0; + margin-bottom: 0; + position: fixed; + right: 0; + z-index: 1030; +} + +/* This section is for footer */ +footer div.opcGlobalFooter { + position: relative; + bottom: 0; + height: 50px; + /* Height of the footer */ + border-top: 1px solid #d9dfe3; + z-index: 1030; + left: 0; + right: 0; + background: #f5f5f5; +} + +footer .opcGlobalFooter .footerLeft { + width: 760px; + padding-top: 6px; +} + +footer .opcGlobalFooter .footerLeft a:hover { + text-decoration: underline; +} + +footer .opcGlobalFooter .footerLeft a:active { + text-decoration: underline; +} + +footer .opcGlobalFooter .footerLeft a:visited { + color: #72007c; +} + +footer .opcGlobalFooter p { + font-size: 11px; + color: #454545; +} + +footer .opcGlobalFooter ul { + padding: 0; + margin: 0; +} + +footer .opcGlobalFooter ul li { + font-size: 12px; + display: inline; + border-left: 1px solid #d6dfe6; + padding: 0 10px 0 10px; +} + +footer .opcGlobalFooter ul li:first-child { + padding-left: 0; + border-left: none; +} + +footer .opcGlobalFooter a { + color: #145c9e; + line-height: 22px; +} + +.blueBanner { + /*background: url("../images/banner-tile-100.png");*/ + background-image: -moz-linear-gradient(top, #67cbf0, #0572ce); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#67cbf0), to(#0572ce)); + background-image: -webkit-linear-gradient(top, #67cbf0, #0572ce); + background-image: -o-linear-gradient(top, #67cbf0, #0572ce); + background-image: linear-gradient(to bottom, #67cbf0, #0572ce); + filter: progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#67cbf0', EndColorStr='#0572ce', GradientType=0); + display: block; + position: fixed; + height: 115px; + top: 34px; + /* height of the header */ + left: 0; + right: 0; + z-index: 100; +} + +.blueBanner>div.container { + height: 115px; +} + +.blueBannerHeading { + float: left; + margin-top: 24px; +} + +.blueBannerTitleWithSubtitle { + /*text-shadow: rgba(0,0,0,0.347656) 0px 2px 2px;*/ + font-size: 26px; + font-weight: normal; + color: #FFFFFF; + display: inline; + margin: 0px 0px 0px 90px; + padding-bottom: 8px; + line-height: 24px; +} + +.blueBannerSubTitle { + /*text-shadow: rgba(0,0,0,0.347656) 0px 2px 2px;*/ + font-size: 16px; + font-weight: bold; + color: #FFFFFF; + margin: 0px 0px 0px 90px; + padding-top: 8px; + line-height: 16px; +} + +.blueBannerLogo { + width: 80px; + height: 70px; + position: absolute; +} + +.blueBannerButton { + float: right; + right: 150px; + position: relative; + top: 29px; +} + +.img-center-align { + top: 0; + bottom: 0; + margin: auto; + float: left; +} + +.serviceContainer { + margin-top: 30px; + /*margin-bottom: 30px;*/ +} + diff --git a/src/main/resources/static/css/samples.css b/src/main/resources/static/css/samples.css new file mode 100644 index 0000000..04c5d2e --- /dev/null +++ b/src/main/resources/static/css/samples.css @@ -0,0 +1,242 @@ +/* The styles most likely to be used are: + - h1, h2, h3, h4: Title, second, third, and fourth-level headings within the body of a topic + - relatedTopics: Related Topics + - procTitle: Within How Do I:... topics, for headings within the body of a topic that are followed by + bulleted procedures ("To do this"). + - pre: For code blocks + - langinline: For code fragments within a (non-code) regular section. + - notepara: Notes +*/ +h1, +h2, +h3, +h4, +h5, +p { + font-family: Verdana, Arial, Helvetica, sans-serif; + color: #000000; +} +.smaller {font-size:80%; margin-top:0px; margin-bottom:5px;} + + +/* Use h1 for the topic title */ +h1 { + font-weight: bold; + font-style: normal; + font-family: Verdana, sans-serif; + font-size: 175%; + background-color: #FFFFFF; + color: #000000; + + +} + +/* Use h2 for all second-level headings. */ +h2 { + font-weight: bold; + font-size: 150%; + margin-top: .5em; + margin-bottom: .5em; +} + +/* Use h3 for all third-level headings. */ +h3 { + font-size: 120%; + margin-top: 1em; + margin-bottom: .6em; +} + +/* Use h4 for all fourth-level headings. + Note: this style looks identical to the relatedtopics and proctitle styles. */ +h4 { + font-size: 100%; + font-weight: bold; + margin-top: 1em; + margin-bottom: .6em; +} + +/* Use h5 for all fifth-level heading. + Currently, there are no h5s in use in the document.*/ +h5 { + font-size: 105%; + margin-top: 1em; + margin-bottom: .6em; +} + +/* Used for figure captions.*/ +p.arttitle { + font-weight: Bold; +} + + +/* Standard HTML tag. */ +body { + padding: 0px 0px 0px 15px; + background: #ffffff; + color: #000000; + font-size: 80%; + font-family: Verdana, Arial, Helvetica, sans-serif; +} + +/* Standard HTML tag. */ +span.bold { + font-weight: Bold; +} + +/* Standard HTML tag. */ +blockquote { + margin: 0em 0em 0em 2em; + padding: 0px; +} + +/* Use the filepath style to designate file paths. It is currently a monospace file. */ +span.filepath { + font: 100% Courier New Courier mono; + font-family: "Courier New", monospace; +} + +/* The langinline style, like userinput and filepath, also renders text monospace. Use this + to denote any individual instance of code in the context of non-coded text. For example, + you would use this to denote the name of a class when you're describing it in the paragraph that + precedes a code sample. To denote a code sample, however, use the
 tag. */
+span.langinline {
+	font: 100% Courier New Courier mono;
+	font-family: "Courier New", monospace;
+}
+
+/* The notepara style indents your text to the tab stop for note
+   text. You should always begin Note text with the word "Note:" in
+   boldface. */
+p.notepara {
+	margin-left: 2em;
+	margin-right: 2em;
+	margin-bottom: 1.5em;
+}
+
+/* The background of header cells is grey, and the text is bottom-aligned. */
+  th {
+  	padding-left: 8px;
+  	padding-right: 8px;
+  	background: #cccccc;
+  	text-align: left;
+  	vertical-align: top;
+  }
+
+
+/* Standard HTML tags. */
+ul,
+ol {
+	font-family: Verdana, Arial, Helvetica, sans-serif;
+	list-style-position: outside;
+	list-style-image: none;
+	margin-top: 0em;
+	margin-bottom: 0em;
+}
+
+/* Standard HTML tag. */
+ol {
+	list-style-type: 1;
+	margin-left: 1em;
+}
+
+/* Standard HTML tag. */
+ul {
+	list-style-type: disc;
+	margin-left: 1em;
+}
+
+/* Standard HTML tag. */
+li {
+	margin-top: .2em; 
+	margin-bottom: .7em;
+}
+
+
+
+BODY {padding:0; font-family: Tahoma,Arial, Helvetica, sans-serif;  font-size: 90%; scrollbar-face-color:#EEEEEE;
+scrollbar-base-color:#EEEEEE;
+scrollbar-shadow-color:#999999;
+scrollbar-highlight-color:#CCCCCC;
+scrollbar-3dlight-color:#EEEEEE;
+scrollbar-darkshadow-color:#EEEEEE;
+scrollbar-arrow-color:#666666;}
+
+A:link, A:active, A:visited {
+		COLOR: #0000aa; 
+		FONT-FAMILY:Tahoma,Arial,Helvetica,Verdana,sans-serif;
+		text-decoration:none;
+		}
+
+A:hover {COLOR: #000000; 
+		FONT-FAMILY:Tahoma,Arial,Helvetica,Verdana,sans-serif; 
+		text-decoration: underline; 
+		background-color: #E7EFFC;}
+
+textarea, select, option {background-color: #E7EFFC;
+		border: 1px solid #19355E; padding: 4px;}
+
+.textinput{background-color: #E7EFFC; border: 1px solid #19355E; padding: 2px}
+
+.button, .button:ACTIVE {
+	font-family: Tahoma, Arial, Helvetica, sans-serif;
+	text-decoration: none;
+	text-align: center;
+	color:#000000;
+	background-color: #8EA8C6;
+	background-image: url(core/images/button_bg.gif);
+	background-repeat: repeat-x;
+	border: 1px solid #4A637B;
+	background-position: top;
+	padding: 0px;
+	margin: 0px;
+	font-size:75%;
+
+}
+.navbutton, navbutton:ACTIVE{
+	font-family: Tahoma, Arial, Helvetica, sans-serif;
+	font-size:75%;
+	text-decoration: none;
+	text-align: center;
+	color:#000000;
+	background-color: #8EA8C6;
+	background-image: url(../core/images/button_bg.gif);
+	background-repeat: repeat-x;
+	border: 1px solid #4A637B;
+	background-position: top;
+	padding: 0px;
+	margin: 0px;
+
+}
+.navbutton:HOVER {
+	font-family: Tahoma, Arial, Helvetica, sans-serif;
+	text-decoration: none;
+	text-align: center;
+	color:#FFffff;
+	background-color: #19355E;
+	background-image: url(../core/images/button_bg_hover.gif);
+	background-repeat: repeat-x;
+	border: 1px solid #19355E;
+	background-position: bottom;
+	margin: 0px;
+	padding: 0px;
+}
+
+
+.button:HOVER {
+	font-family: Tahoma, Arial, Helvetica, sans-serif;
+	text-decoration: none;
+	text-align: center;
+	color:#FFFFFF;
+	background-color: #19355E;
+	background-image: url(../core/images/button_bg_hover.gif);
+	background-repeat: repeat-x;
+	border: 1px solid #19355E;
+	background-position: bottom;
+	margin: 0px;
+	padding: 0px;
+}
+p {margin-left:10px;}
+
+code{font-family:"Courier New", Courier, mono;font-size:100%;}
+
+
diff --git a/src/main/resources/static/images/cloudgs_occs.png b/src/main/resources/static/images/cloudgs_occs.png
new file mode 100644
index 0000000..a5304c2
Binary files /dev/null and b/src/main/resources/static/images/cloudgs_occs.png differ
diff --git a/src/main/resources/static/images/occs.png b/src/main/resources/static/images/occs.png
new file mode 100644
index 0000000..7da5ae7
Binary files /dev/null and b/src/main/resources/static/images/occs.png differ
diff --git a/src/main/resources/static/images/occs.wercker.png b/src/main/resources/static/images/occs.wercker.png
new file mode 100644
index 0000000..ee5e929
Binary files /dev/null and b/src/main/resources/static/images/occs.wercker.png differ
diff --git a/src/main/resources/static/images/oracle-cloud-logo.png b/src/main/resources/static/images/oracle-cloud-logo.png
new file mode 100644
index 0000000..4a3a22d
Binary files /dev/null and b/src/main/resources/static/images/oracle-cloud-logo.png differ
diff --git a/src/main/resources/text.txt b/src/main/resources/text.txt
new file mode 100644
index 0000000..75d410a
--- /dev/null
+++ b/src/main/resources/text.txt
@@ -0,0 +1 @@
+springUrl=Sample resource
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/views/environment.jsp b/src/main/webapp/WEB-INF/views/environment.jsp
new file mode 100644
index 0000000..d0588c7
--- /dev/null
+++ b/src/main/webapp/WEB-INF/views/environment.jsp
@@ -0,0 +1,149 @@
+
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+  pageEncoding="UTF-8"%>
+<%@page import="java.util.TreeMap"%>
+<%@page import="java.util.Collections"%>
+<%@page import="java.util.Set"%>
+<%@page import="java.util.Map"%>
+<%@page import="java.util.List"%>
+<%@page import="java.lang.management.ManagementFactory"%>
+<%@page import="java.lang.management.RuntimeMXBean"%>
+<%@page import="java.lang.ClassLoader"%>
+
+
+
+
+
+
+
+Oracle Public Cloud Demo - Runtime Environment Details
+
+
+
+  
+
+
+  
+
+ + + + + +
+ +
+
+ + + + +
+
+
+
+
+
+

+ Environment Variables +

+ + + + + + <% + TreeMap sortedMap = new TreeMap(); + sortedMap.putAll(System.getenv()); + for (Map.Entry f : sortedMap.entrySet()) { + out.println(""); + } + RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean(); + List arguments = runtimeMxBean.getInputArguments(); + String sJavaagentArg = "-javaagent option was not defined."; + for (String argument : arguments) { + if (argument.startsWith("-javaagent:")) { + sJavaagentArg = argument; + break; + } + } + out.println(""); + try { + java.lang.reflect.Method m = ClassLoader.class.getDeclaredMethod("findLoadedClass", + new Class[] { String.class }); + m.setAccessible(true); + ClassLoader cl = ClassLoader.getSystemClassLoader(); + Object oAgent = m.invoke(cl, "oracle.apmaas.agent.instrumentation.Agent"); + out.println(""); + } catch (Exception e) { + e.printStackTrace(); + } + %> + +
NameValue
"); + out.println(f.getKey()); + out.println(""); + out.println(f.getValue()); + out.println("
Java Agent (RuntimeMXBean)" + sJavaagentArg + "
oracle.apmaas.agent.instrumentation.AgentAgent is " + (oAgent != null ? "" : "not") + " loaded.
+
+
+
+
+ + +
+
+ + + +
+ + + + + diff --git a/src/main/webapp/WEB-INF/views/welcome.jsp b/src/main/webapp/WEB-INF/views/welcome.jsp new file mode 100644 index 0000000..a015ea0 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/welcome.jsp @@ -0,0 +1,105 @@ + +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> +<%@ page import="java.util.*"%> +<%@ page import="java.io.*"%> + + + + + + + +Oracle Public Cloud Demo + + + + + + +
+
+ + + + + +
+
+
+ + + +
+
+
+
SpringBoot application demo. Current server time: <%= new java.util.Date() %>
+
+

+ Build faster and release often with Wercker's Docker-Native + continuous integration platform for developing, building and delivering your applications. +

+

+ Configure, deploy, administer, monitor, + and orchestrate services (or stacks of services) as Docker containers + across multiple hosts and scale them as needed with Oracle Container Cloud Service. +

+
+

+
+ +
+
+
+ + + + + diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..86cd436 --- /dev/null +++ b/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/src/resources/manifest.json b/src/resources/manifest.json new file mode 100644 index 0000000..ce3e930 --- /dev/null +++ b/src/resources/manifest.json @@ -0,0 +1,8 @@ +{ + "runtime": { + "majorVersion": "8" + }, + "command": "java -Dserver.port=$PORT -jar springbootdemo-0.0.1.war", + "startupTime": "300", + "notes": "SpringBoot demo application" +} diff --git a/src/test/java/com/example/springboot/DemoApplicationTests.java b/src/test/java/com/example/springboot/DemoApplicationTests.java new file mode 100644 index 0000000..448722d --- /dev/null +++ b/src/test/java/com/example/springboot/DemoApplicationTests.java @@ -0,0 +1,18 @@ +package com.example.springboot; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.SpringApplicationConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +@RunWith(SpringJUnit4ClassRunner.class) +@SpringApplicationConfiguration(classes = DemoApplication.class) +@WebAppConfiguration +public class DemoApplicationTests { + + @Test + public void contextLoads() { + } + +} diff --git a/wercker.yml b/wercker.yml new file mode 100644 index 0000000..7fdb402 --- /dev/null +++ b/wercker.yml @@ -0,0 +1,17 @@ +box: combient/java-mvn +build: + steps: + # Build Spring Boot Sample application + - script: + name: Maven install + code: mvn install +push: + steps: + # Push to public docker repo + - internal/docker-push: + username: $DOCKER_USERNAME + password: $DOCKER_PASSWORD + tag: latest + repository: $DOCKER_REPOSITORY + registry: https://index.docker.io/v1/ + cmd: java -jar /pipeline/source/target/springbootdemo-0.0.1.war \ No newline at end of file