Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/nta restapi #68

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ target
.project
.settings
.classpath
*.orig
10 changes: 5 additions & 5 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,11 @@
</build>
<dependencies>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-arquillian-container-remote</artifactId>
<version>8.0.0.Final</version>
<scope>test</scope>
</dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-arquillian-container-remote</artifactId>
<version>8.0.0.Final</version>
<scope>test</scope>
</dependency>
</dependencies>
</profile>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
package io.narayana.nta.persistence;

import io.narayana.nta.interceptors.LoggingInterceptor;
import io.narayana.nta.persistence.entities.Event;
import io.narayana.nta.persistence.entities.ParticipantRecord;
import io.narayana.nta.persistence.entities.ResourceManager;
import io.narayana.nta.persistence.entities.Transaction;
Expand Down Expand Up @@ -195,6 +196,32 @@ public Collection<ResourceManager> findAllResourceManagers() {
return em.createNamedQuery("ResourceManager.findAll", ResourceManager.class).getResultList();
}

public ResourceManager findResourceManagerByBranchId(String branchId)
{
try
{
return em.createNamedQuery("ResourceManager.findByBranchId", ResourceManager.class)
.setParameter("branchId", branchId).getSingleResult();
}
catch(NoResultException nre)
{
return null;
}
}

/*
* Method for retrieving objects of type Events
*/

public Event findEvent(Long id) {

return em.find(Event.class, id);
}

public Collection<Event> findAllEvents(){

return em.createNamedQuery("Event.findAll", Event.class).getResultList();
}

/*
@AroundInvoke
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,7 @@

import io.narayana.nta.persistence.enums.EventType;

import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;

Expand All @@ -40,6 +34,10 @@
* Time: 22:57
*/
@Entity
@NamedQueries({
@NamedQuery(name = "Event.findAll",
query = "FROM Event e ORDER BY e.timestamp"
)})
public class Event implements Serializable, Comparable {

@Id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
@NamedQueries({
@NamedQuery(name = "ResourceManager.findAll",
query = "FROM ResourceManager r"
),
@NamedQuery(name = "ResourceManager.findByBranchId",
query = "FROM ResourceManager r WHERE r.branchId=:branchId"
)
})
public class ResourceManager implements Serializable {
Expand Down
10 changes: 10 additions & 0 deletions nta-dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@
<artifactId>webapp</artifactId>
<type>war</type>
</dependency>
<dependency>
<groupId>io.narayana.nta</groupId>
<artifactId>restapi</artifactId>
<type>war</type>
</dependency>
<dependency>
<groupId>io.narayana.nta</groupId>
<artifactId>core</artifactId>
Expand Down Expand Up @@ -93,6 +98,11 @@
<artifactId>webapp</artifactId>
<contextRoot>/nta</contextRoot>
</webModule>
<webModule>
<groupId>io.narayana.nta</groupId>
<artifactId>restapi</artifactId>
<contextRoot>/nta/rest</contextRoot>
</webModule>
</modules>
<fileNameMapping>no-version</fileNameMapping>
</configuration>
Expand Down
10 changes: 10 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
<module>core</module>
<module>plugins</module>
<module>webapp</module>
<module>restapi</module>
<module>nta-dist</module>
<module>nta-remote-dist</module>
<module>demo</module>
Expand Down Expand Up @@ -164,6 +165,15 @@
<scope>compile</scope>
</dependency>

<dependency>
<groupId>io.narayana.nta</groupId>
<artifactId>restapi</artifactId>
<version>${project.version}</version>
<type>war</type>
<scope>compile</scope>
</dependency>


<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
Expand Down
233 changes: 233 additions & 0 deletions restapi/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
<?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">
<parent>
<artifactId>nta-all</artifactId>
<groupId>io.narayana.nta</groupId>
<version>1.0.0.Alpha3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>restapi</artifactId>
<name>Narayana Transaction Analyser REST API</name>
<description>Contains the REST API component of the tool</description>
<packaging>war</packaging>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-7.0</artifactId>
<version>1.0.0.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-warp-bom</artifactId>
<version>1.0.0.Alpha7</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.1.5.Final</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>


<dependencies>
<dependency>
<groupId>io.narayana.nta</groupId>
<artifactId>core</artifactId>
<version>1.0.0.Alpha3-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.jboss.spec.javax.servlet</groupId>
<artifactId>jboss-servlet-api_3.1_spec</artifactId>
<version>1.0.0.Final</version>
</dependency>

<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>3.0.2.Final</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-cdi</artifactId>
<version>3.0.2.Final</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<version>1.0-SP4</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.0.3.Final</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-controller-client</artifactId>
<version>8.0.0.Final</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>3.0.2.Final</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-impl-maven</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-arquillian-container-remote</artifactId>
<version>8.0.0.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>3.0.2.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-warp</artifactId>
<version>1.0.0.Alpha7</version>
<scope>test</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-rest-warp-impl-jaxrs-2.0</artifactId>
<version>1.0.0.Alpha3</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>${version.war.plugin}</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>

<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${version.compiler.plugin}</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>

<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${version.maven.surefire}</version>
<configuration>
<skip>false</skip>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>wildfly-8-snapshot</id>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${version.maven.surefire}</version>
<configuration>
<skip>false</skip>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-impl-maven</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-arquillian-container-remote</artifactId>
<version>8.0.0.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>3.0.2.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-warp</artifactId>
<version>1.0.0.Alpha7</version>
<scope>test</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-rest-warp-impl-jaxrs-2.0</artifactId>
<version>1.0.0.Alpha3</version>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
Loading