Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Commit

Permalink
add project for testing connector in studio
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Dunworth - OIT committed Sep 6, 2018
1 parent c54adcf commit e591b26
Show file tree
Hide file tree
Showing 12 changed files with 462 additions and 0 deletions.
48 changes: 48 additions & 0 deletions test-mule4-cps-connector/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# ------------------------------------------------------------------------------ #
# Java defaults (https://github.com/github/gitignore/blob/master/Java.gitignore) #
# ------------------------------------------------------------------------------ #
*.class

# Package Files #
*.jar
*.war
*.ear

# ------------------------------------------------------------------------------------------- #
# Eclipse-specific (https://github.com/github/gitignore/blob/master/Global/Eclipse.gitignore) #
# ------------------------------------------------------------------------------------------- #
*.pydevproject
.metadata
bin/**
tmp/**
tmp/**/*
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.project
.classpath

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# CDT-specific
.cproject

# PDT-specific
.buildpath

# --------------- #
# Studio-specific #
# --------------- #
target/
.mule/**
.mule/**/*
.DS_Store
velocity.log
33 changes: 33 additions & 0 deletions test-mule4-cps-connector/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# mule4-skeleton-cps-project
The skeleton-cps-project is an example application that can be used as a template for building a Mule application.

Note, the scope features of minimal-logging are not displayed correctly by Studio 7.1 or 7.2. Support for displaying SDK connector scopes is expected in Studio 7.3.

## Uses

The project contains examples using:

* The minimal-logging connector,
* The cps (configuration property service) connector,
* Maven deployment using the mule-maven-plugin descriptor.

## Purpose
This project is an example only. It contains a scheduling component to periodically (every ten minutes), use the minimal-logging operations to generate a new transaction id, display three (enter, warning and exit) log messages.


## Runtime properties

The properties mule.env and mule.key need to be set in the Mule runtime in order for the property configurations to be located.
For Studio, add the following VM command line values when running the API:

-Dmule.env=local -Dmule.key=Mulesoft12345678

## Maven Settingss

The Mule deployment assumes that certain deployment properties will come from profiles specified when the mvn command is executed. An example-settings.xml is provided as a reference
for creating your own settings.xml file. This is a standard feature of Maven and is described in its online documentation. Once the settings.xml file has been created, export a u and a p shell environment variables containing your Anypoint user name and password. Then use this maven command to deploy the API project:

```
mvn clean install deploy -Denv=xxx -DmuleDeploy
```
Replacing the xxx's with the appropriate values.
3 changes: 3 additions & 0 deletions test-mule4-cps-connector/mule-artifact.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"minMuleVersion": "4.1.1"
}
92 changes: 92 additions & 0 deletions test-mule4-cps-connector/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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>com.mycompany</groupId>
<artifactId>test-mule4-cps-connector</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>mule-application</packaging>

<name>test-mule4-cps-connector</name>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<app.runtime>4.1.1</app.runtime>
<maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version>
<mule.maven.plugin.version>3.1.7</mule.maven.plugin.version>

<!-- <attachMuleSources>true</attachMuleSources> -->

<project.name>mule4-skeleton-project</project.name>
<type>example</type>
</properties>

<build>
<resources>
<resource>
<directory>src/main/resources-filtered/</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/resources/</directory>
<filtering>false</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.mule.tools.maven</groupId>
<artifactId>mule-maven-plugin</artifactId>
<version>${mule.maven.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<armDeployment>
<uri>https://anypoint.mulesoft.com</uri>
<server>anypoint-platform</server>
<target>${deploy.target}</target>
<targetType>${deploy.targetType}</targetType>
<environment>${deploy.environment}</environment>
<muleVersion>${app.runtime}</muleVersion>
<businessGroup>${deploy.businessGroup}</businessGroup>
<applicationName>${artifactId}-${instance.id}-${deploy.app.suffix}</applicationName>
</armDeployment>
</configuration>
<executions>
<execution>
<id>deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<classifier>mule-application</classifier>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.mule.connectors</groupId>
<artifactId>mule-http-connector</artifactId>
<version>1.2.0</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>org.mule.cps</groupId>
<artifactId>cps-connector</artifactId>
<classifier>mule-plugin</classifier>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.mule.consulting.logging</groupId>
<artifactId>minimal-logging</artifactId>
<version>1.0.1</version>
<classifier>mule-plugin</classifier>
</dependency>
</dependencies>

</project>
25 changes: 25 additions & 0 deletions test-mule4-cps-connector/src/main/mule/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:cps="http://www.mulesoft.org/schema/mule/cps"
xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/cps http://www.mulesoft.org/schema/mule/cps/current/mule-cps.xsd">

<cps:config name="Configuration_properties_service_Config"
doc:name="Configuration-properties-service Config" doc:id="b994fefb-59ee-48f9-aa88-c9cc40b4c0b8"
configServerBaseUrl="http://localhost:9184/configuration-property-service/v1/config"
insecure="true" projectName="test-mule4-cps-connector" branchName="base"
instanceId="base" envName="${mule.env}" keyId="key1" clientId="x"
clientSecret="x" configId="cps-config" />

<http:listener-config name="api-httpListenerConfig"
doc:description="This is not used if a shared domain is configured in the listener..in that case remove this config to prevent this port from showing in the server's port scan."
doc:name="HTTP Listener config">
<http:listener-connection host="0.0.0.0"
port="${http.port:8081}" />
</http:listener-config>

</mule>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">

<flow name="test-mule4-cps-connectorFlow" doc:id="72a74211-241c-4354-8974-ae0d8ce0dca5" >
<http:listener doc:name="Listener" doc:id="71dddb64-c6e8-4327-8039-4e0a4a567680" config-ref="api-httpListenerConfig"
path="/test-mule4-cps-connector/v1">
<ee:repeatable-file-store-stream />
</http:listener>
<logger level="INFO" doc:name="Logger" doc:id="8c507c38-5123-421c-88e8-1063d3351155"
message='#["\nI am ${my.second.property} of ${parentage} globally: ${global.one} and defaulted ${myStdDefault:Is Default:)} ${example.project.property32:default}"]'/>
</flow>
<flow name="test-mule4-cps-connectorFlow1" doc:id="837207cd-f9e9-4804-aa9d-ea49f68611df" >
<scheduler doc:name="Scheduler" doc:id="032f342e-217a-47db-bcc1-efe574f77311" >
<scheduling-strategy >
<fixed-frequency frequency="10" timeUnit="SECONDS"/>
</scheduling-strategy>
</scheduler>
<logger level="INFO" doc:name="Logger" doc:id="8c507c38-5123-421c-88e8-1063d3351155"
message='#["\nFrom my config: ${my.second.property}\nImported from Shared: ${parentage}\nImported From Shared/Global: ${global.one}\nUse default value: ${myStdDefault:this is a default value, smiley:)} and this was not a default value: ${example.project.property32:oops used default}"]'/>
</flow>

</mule>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#project.properties is equivalent to the same name with .yaml extension
# This file must include properties that are common for different instances of the application installation.
example.project.property32=exampleProjectProperty32Value
40 changes: 40 additions & 0 deletions test-mule4-cps-connector/src/main/resources-filtered/log4j2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<Configuration>

<!--These are some of the loggers you can enable.
There are several more you can find in the documentation.
Besides this log4j configuration, you can also use Java VM environment variables
to enable other logs like network (-Djavax.net.debug=ssl or all) and
Garbage Collector (-XX:+PrintGC). These will be append to the console, so you will
see them in the mule_ee.log file. -->

<Appenders>
<RollingFile name="file" fileName="${sys:mule.home}${sys:file.separator}logs${sys:file.separator}${project.artifactId}-${instance.id}-${deploy.app.suffix}.log"
filePattern="${sys:mule.home}${sys:file.separator}logs${sys:file.separator}${project.artifactId}-${instance.id}-${deploy.app.suffix}%i.log">
<PatternLayout pattern="%d [%t] %-5p %c - %m%n" />
<SizeBasedTriggeringPolicy size="10 MB" />
<DefaultRolloverStrategy max="10"/>
</RollingFile>
</Appenders>
<Loggers>
<!-- Http Logger shows wire traffic on DEBUG. -->
<!--AsyncLogger name="org.mule.service.http.impl.service.HttpMessageLogger" level="DEBUG" /-->
<AsyncLogger name="org.mule.service.http" level="WARN"/>
<AsyncLogger name="org.mule.extension.http" level="WARN"/>

<!-- Mule classes -->
<AsyncLogger name="org.mule" level="INFO"/>
<AsyncLogger name="com.mulesoft" level="INFO"/>

<AsyncLogger name="applicationDebug" level="OFF"/>
<AsyncLogger name="applicationInfo" level="INFO"/>

<AsyncLogger name="org.apache.cxf" level="INFO" />
<AsyncLogger name="com.ning" level="INFO" />
<AsyncLogger name="org.glassfish.grizzly" level="INFO" />

<AsyncRoot level="INFO">
<AppenderRef ref="file" />
</AsyncRoot>
</Loggers>
</Configuration>
Loading

0 comments on commit e591b26

Please sign in to comment.