Skip to content

Instantly share code, notes, and snippets.

@david-guzman
Created August 23, 2017 16:58
Show Gist options
  • Save david-guzman/8430159a2d6f848d93b1525ac28e233a to your computer and use it in GitHub Desktop.
Save david-guzman/8430159a2d6f848d93b1525ac28e233a to your computer and use it in GitHub Desktop.
Combine inmemdb and glassfish embedded plugins
<?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>guzman.weblog.servlet</groupId>
<artifactId>servlet-jsr375</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>servlet-basic-db</artifactId>
<packaging>war</packaging>
<properties>
<plu.glassfish.version>4.1.1</plu.glassfish.version>
<plu.inmemdb.version>1.4.3</plu.inmemdb.version>
</properties>
<name>servlet-jsr375-basicmechanism-databaseidentitystore</name>
<description>
Sample web application to demonstrate use of BasicAuthenticationMechanismDefinition and
DatabaseIdentityStoreDefinition annotations (JSR 375) in a Servlet
</description>
<dependencies>
<dependency>
<groupId>org.glassfish.soteria</groupId>
<artifactId>javax.security.enterprise</artifactId>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>com.btmatthews.maven.plugins.inmemdb</groupId>
<artifactId>inmemdb-maven-plugin</artifactId>
<version>${plu.inmemdb.version}</version>
<configuration>
<monitorKey>inmemdb</monitorKey>
<monitorPort>11527</monitorPort>
</configuration>
<executions>
<execution>
<id>start-derby</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<database>jsr375</database>
<port>21527</port>
<username>dbuser</username>
<password>dbpass</password>
<type>derby</type>
<daemon>true</daemon>
<attributes>
<CREATE>true</CREATE>
</attributes>
<sources>
<Script>
<sourceFile>${project.basedir}/src/test/resources/derby-test.sql</sourceFile>
</Script>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.glassfish.embedded</groupId>
<artifactId>maven-embedded-glassfish-plugin</artifactId>
<version>${plu.glassfish.version}</version>
<configuration>
<app>target/${project.build.finalName}.war</app>
<port>8081</port>
<contextRoot>${project.artifactId}</contextRoot>
<name>${project.artifactId}</name>
<commands>
<command>create-jdbc-connection-pool --datasourceclassname org.apache.derby.jdbc.ClientDataSource40 --restype javax.sql.DataSource --property "databaseName=jsr375:portNumber=21527:user=dbuser:password=dbpass:url=jdbc\\:derby\\:@localhost\\:21527\\:memory\\:jsr375" jsr375-derby-pool</command>
<command>create-jdbc-resource --connectionpoolid jsr375-derby-pool jdbc/jsr375Derby</command>
<command>ping-connection-pool jsr375-derby-pool</command>
</commands>
</configuration>
<executions>
<execution>
<id>start-container</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
<goal>admin</goal>
</goals>
</execution>
<execution>
<id>deploy-app</id>
<goals>
<goal>deploy</goal>
</goals>
</execution>
<execution>
<id>stop-container</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment