diff --git a/samples/HelloWorldService/deployment/deployment.toml b/samples/HelloWorldService/deployment/deployment.toml new file mode 100644 index 0000000000..34785fe930 --- /dev/null +++ b/samples/HelloWorldService/deployment/deployment.toml @@ -0,0 +1,111 @@ +[server] +hostname = "localhost" +hot_deployment = false +# offset = 10 + +[user_store] +type = "read_only_ldap" + +[keystore.primary] +file_name = "repository/resources/security/wso2carbon.jks" +password = "wso2carbon" +alias = "wso2carbon" +key_password = "wso2carbon" + +[truststore] +file_name = "repository/resources/security/client-truststore.jks" +password = "wso2carbon" +alias = "symmetric.key.value" +algorithm = "AES" + +## Following are set of example configs. Please refer docs for complete set of configurations. + +# [transport.http] +# socket_timeout = 180000 # timeout in milliseconds +# disable_connection_keepalive = false +# connection_timeout = 90000 # in milliseconds + +# [transport.jms] +# sender_enable = true +# listener_enable = true + +# [[transport.jms.sender]] +# name = "myQueueSender" +# parameter.initial_naming_factory = "org.apache.activemq.jndi.ActiveMQInitialContextFactory" +# parameter.provider_url = "tcp://localhost:61616" +# parameter.connection_factory_name = "QueueConnectionFactory" +# parameter.connection_factory_type = "queue" +# parameter.cache_level = "producer" + + +#[[transport.jms.listener]] +# name = "myQueueConnectionFactory" +# parameter.initial_naming_factory = "org.apache.activemq.jndi.ActiveMQInitialContextFactory" +# parameter.provider_url = "tcp://localhost:61616" +# parameter.connection_factory_name = "QueueConnectionFactory" +# parameter.connection_factory_type = "queue" + +# [transport.jndi.connection_factories] +# 'connectionfactory.QueueConnectionFactory' = "amqp://admin:admin@clientID/carbon?brokerlist='tcp://localhost:5675'" +# 'connectionfactory.TopicConnectionFactory' = "amqp://admin:admin@clientID/carbon?brokerlist='tcp://localhost:5675'" + +# [transport.jndi.queue] +# jndiNameOfQueue = "physicalNameOfQueue" + +# [transport.jndi.topic] +# jndiNameOfTopic = "physicalNameOfTopic" + +# [transport.rabbitmq] +# sender_enable = true +# listener_enable = true + +# [[transport.rabbitmq.sender]] +# name = "AMQPConnectionFactory" +# parameter.hostname = "localhost" +# parameter.port = 5672 +# parameter.username = "guest" +# parameter.password = "guest" + +# [[transport.rabbitmq.listener]] +# name = "AMQPConnectionFactory" +# parameter.hostname = "localhost" +# parameter.port = 5672 +# parameter.username = "guest" +# parameter.password = "guest" + +# [system.parameter] +# 'key' = "value" + +# [[datasource]] +# id = "WSO2CarbonDB" # "WSO2_COORDINATION_DB" +# url = "jdbc:mysql://localhost:3306/integratordb" +# username = "root" +# password = "root" +# driver = "com.mysql.jdbc.Driver" + +# [management_api] +# protocols = "http" + +# [[internal_apis.users]] +# user.name = "user-1" +# user.password = "pwd-1" + +# [transaction_counter] +# enable = true +# data_source = "WSO2CarbonDB" +# update_interval = 2 + +# [mediation] +# synapse.global_timeout_interval = "120000" # interval in milliseconds + +# [secrets] +# secret_key = "[secret value]" + +# [[service_catalog]] +# apim_host = "https://localhost:9443" +# enable = true +# username = "admin" +# password = "admin" + +# [dashboard_config] +# dashboard_url = "https://localhost:9743/dashboard/api/" diff --git a/samples/HelloWorldService/deployment/docker/Dockerfile b/samples/HelloWorldService/deployment/docker/Dockerfile new file mode 100644 index 0000000000..562263f9b2 --- /dev/null +++ b/samples/HelloWorldService/deployment/docker/Dockerfile @@ -0,0 +1,6 @@ +ARG BASE_IMAGE +FROM ${BASE_IMAGE} +COPY CompositeApps/*.car ${WSO2_SERVER_HOME}/repository/deployment/server/carbonapps/ +COPY resources/wso2carbon.jks ${WSO2_SERVER_HOME}/repository/resources/security/wso2carbon.jks +COPY resources/client-truststore.jks ${WSO2_SERVER_HOME}/repository/resources/security/client-truststore.jks +# COPY libs/*.jar ${WSO2_SERVER_HOME}/lib/ \ No newline at end of file diff --git a/samples/HelloWorldService/deployment/docker/resources/client-truststore.jks b/samples/HelloWorldService/deployment/docker/resources/client-truststore.jks new file mode 100644 index 0000000000..621d2b34d2 Binary files /dev/null and b/samples/HelloWorldService/deployment/docker/resources/client-truststore.jks differ diff --git a/samples/HelloWorldService/deployment/docker/resources/wso2carbon.jks b/samples/HelloWorldService/deployment/docker/resources/wso2carbon.jks new file mode 100644 index 0000000000..969575f3f0 Binary files /dev/null and b/samples/HelloWorldService/deployment/docker/resources/wso2carbon.jks differ diff --git a/samples/HelloWorldService/pom.xml b/samples/HelloWorldService/pom.xml new file mode 100644 index 0000000000..090db980c7 --- /dev/null +++ b/samples/HelloWorldService/pom.xml @@ -0,0 +1,356 @@ + + + 4.0.0 + wso2.sampleHelloWorld + HelloWorldService + 1.0.0-SNAPSHOT + pom + HelloWorldService + HelloWorldService + + + wso2-nexus + WSO2 internal Repository + https://maven.wso2.org/nexus/content/groups/wso2-public/ + + true + daily + ignore + + + + wso2.releases + WSO2 internal Repository + https://maven.wso2.org/nexus/content/repositories/releases/ + + true + daily + ignore + + + + wso2.snapshots + Apache Snapshot Repository + https://maven.wso2.org/nexus/content/repositories/snapshots/ + + true + daily + + + false + + + + + + wso2.snapshots + Apache Snapshot Repository + https://maven.wso2.org/nexus/content/repositories/snapshots/ + + true + daily + + + false + + + + + true + daily + ignore + + wso2-nexus + https://maven.wso2.org/nexus/content/groups/wso2-public/ + + + + + default + + true + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.5.0 + + + process-resources + + copy-dependencies + + + ${basedir}/deployment/libs + true + + org.apache.synapse,org.apache.axis2 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + org.wso2.maven + vscode-car-plugin + 5.2.60 + true + + + + car + + + + + + + org.apache.maven.plugins + maven-install-plugin + 2.5.2 + + + install-car + install + + install-file + + + car + ${project.artifactId} + ${project.groupId} + ${project.version} + ${project.build.directory}/${project.artifactId}_${project.version}.car + + + + + + + + + + + test + + + + org.wso2.maven + synapse-unit-test-maven-plugin + 5.2.60 + + + synapse-unit-test + test + + synapse-unit-test + + + + + + ${testServerType} + ${testServerHost} + ${testServerPort} + ${testServerPath} + + ${project.basedir}/src/test/wso2mi/${testFile} + ${maven.test.skip} + + + + + + + docker + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + default-compile + generate-sources + + compile + + + + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-jar-plugin + + + default-jar + generate-sources + + jar + + + + + + + org.wso2.maven + vscode-car-plugin + 5.2.60 + true + + + generate-sources + + car + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.5.0 + + + process-resources + + copy-dependencies + + + ${basedir}/deployment/libs + true + + org.apache.synapse,org.apache.axis2 + + + + + + + org.wso2.maven + mi-container-config-mapper + 5.2.60 + true + + + config-mapper-parser + generate-resources + + config-mapper-parser + + + 4.2.0 + ${ciphertool.enable} + ${keystore.name} + ${keystore.alias} + ${keystore.type} + ${keystore.password} + ${project.basedir} + + + + + + + maven-antrun-plugin + 3.0.0 + true + + + antrun-edit + process-resources + + run + + + + + + + + + + + + + + + + + + + + + + + + io.fabric8 + docker-maven-plugin + 0.43.4 + true + + + docker-build + package + + build + + + + + ${project.artifactId}:${project.version} + + ${dockerfile.base.image} + ${basedir}/target/tmp_docker/Dockerfile + + ${dockerfile.base.image} + + + + + + ${dockerfile.pull.username} + ${dockerfile.pull.password} + + true + + + + + + + + + + + integration-project + bd826712-5d3a-4c4a-8ba8-3343bd5d0cf3 + + JKS + wso2carbon.jks + wso2carbon + wso2carbon + true + wso2/wso2mi:4.2.0 + 1.8 + 1.8 + + \ No newline at end of file diff --git a/samples/HelloWorldService/src/main/wso2mi/artifacts/apis/HelloWorld.xml b/samples/HelloWorldService/src/main/wso2mi/artifacts/apis/HelloWorld.xml new file mode 100644 index 0000000000..02edb84f47 --- /dev/null +++ b/samples/HelloWorldService/src/main/wso2mi/artifacts/apis/HelloWorld.xml @@ -0,0 +1,14 @@ + + + + + + {"Hello":"World"} + + + + + + + + diff --git a/samples/HelloWorldService/src/main/wso2mi/resources/metadata/HelloWorld_metadata.yaml b/samples/HelloWorldService/src/main/wso2mi/resources/metadata/HelloWorld_metadata.yaml new file mode 100644 index 0000000000..a03775a8f2 --- /dev/null +++ b/samples/HelloWorldService/src/main/wso2mi/resources/metadata/HelloWorld_metadata.yaml @@ -0,0 +1,11 @@ +--- +key: "HelloWorld-1.0.0" +name : "HelloWorld" +displayName : "HelloWorld" +description: "Sample API" +version: "1.0.0" +serviceUrl: "https://{MI_HOST}:{MI_PORT}/HelloWorld" +definitionType: "OAS3" +securityType: "BASIC" +mutualSSLEnabled: false +apiId : "null" diff --git a/samples/HelloWorldService/src/main/wso2mi/resources/metadata/HelloWorld_swagger.yaml b/samples/HelloWorldService/src/main/wso2mi/resources/metadata/HelloWorld_swagger.yaml new file mode 100644 index 0000000000..9c7ce03364 --- /dev/null +++ b/samples/HelloWorldService/src/main/wso2mi/resources/metadata/HelloWorld_swagger.yaml @@ -0,0 +1,13 @@ +openapi: 3.0.1 +info: + title: HelloWorld + description: API Definition of HelloWorld + version: 1.0.0 +servers: +- url: http://localhost:8290/HelloWorld +paths: + /: + get: + responses: + default: + description: Default response diff --git a/samples/HelloWorldService/src/test/wso2mi/HelloWorldTest.xml b/samples/HelloWorldService/src/test/wso2mi/HelloWorldTest.xml new file mode 100644 index 0000000000..c5c40cf529 --- /dev/null +++ b/samples/HelloWorldService/src/test/wso2mi/HelloWorldTest.xml @@ -0,0 +1,26 @@ + + + + src/main/wso2mi/artifacts/apis/HelloWorld.xml + + + + + + + + + / + GET + + + + $body + {"Hello":"World"} + Actual payload is not equals to the expected value + + + + + +