Skip to content
Snippets Groups Projects
Commit 4ebeb0be authored by Stefan E. Funk's avatar Stefan E. Funk
Browse files

more testing...

parent 0fbfb953
No related branches found
No related tags found
No related merge requests found
#Tue Mar 06 11:56:15 CET 2018
#Tue Mar 06 12:42:39 CET 2018
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
eclipse.preferences.version=1
encoding/src/main/java=UTF-8
......
......@@ -18,14 +18,6 @@
package info.textgrid.middleware.tgauth.tgauthclient;
import info.textgrid.namespaces.middleware.tgauth.PortTgextra;
import info.textgrid.namespaces.middleware.tgauth.Tgextra;
import java.net.URL;
import java.util.Map;
import javax.xml.ws.BindingProvider;
/*******************************************************************************
* TODOLOG
*
......@@ -45,39 +37,10 @@ import javax.xml.ws.BindingProvider;
* @since 2016-08-03
******************************************************************************/
public final class TGAuthClientUtilities {
/**
* PRIVATE CONSRUCTOR FOR STATIC CLASS
*/
private TGAuthClientUtilities() {
//
}
public final class TGAuthClientCommon {
// **
// MAIN CLASS
// **
/**
* <p>
* Creates a regular TG-extra stub.
* </p>
*
* @param theEndpoint
* @return A Tgextra service port.
*/
public static PortTgextra getTgextra(URL theEndpoint) {
// Create TG-extra service stubs.
Tgextra tgextra = new Tgextra((URL) null);
PortTgextra portTgextra = tgextra.getPort(PortTgextra.class);
BindingProvider bindingProvider = (BindingProvider) portTgextra;
Map<String, Object> requestContext = bindingProvider
.getRequestContext();
requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
theEndpoint.toString());
return portTgextra;
}
}
......@@ -16,6 +16,11 @@
<wsdl.file>tgextra-crud.wsdl</wsdl.file>
</properties>
<dependencies>
<dependency>
<groupId>info.textgrid.middleware</groupId>
<artifactId>tgauth-client-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
......
......@@ -21,10 +21,7 @@ package info.textgrid.middleware.tgauth.tgauthclient;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Properties;
......@@ -73,19 +70,6 @@ public class TestTGAuthServiceOnline {
// STATIC FINALS
// **
private final static String OPERATION_CREATE = "create";
private final static String OPERATION_DELETE = "delete";
private final static String OPERATION_WRITE = "write";
private final static String OPERATION_READ = "read";
private static String ROLE_EDITOR = "Bearbeiter";
private static String ROLE_ADMIN = "Administrator";
private static String ROLE_MANAGER = "Projektleiter";
private static String ROLE_OBSERVER = "Beobachter";
private final static String TABLINE = "\t----------------------------------------";
// private static final String propertiesFile =
// "tgauth.test.esx1.properties";
private static final String propertiesFile = "tgauth.test.devtextgridlaborg.crudjunit1.properties";
// **
......@@ -113,8 +97,7 @@ public class TestTGAuthServiceOnline {
// Load properties file.
Properties p = new Properties();
p.load(new FileInputStream(
TGCrudClientUtils.getResource(propertiesFile)));
p.load(new FileInputStream(.getResource(propertiesFile)));
// Get and create the tgextra stubs.
URL location = new URL(p.getProperty("tgextraServiceEndpointUrl"));
......@@ -451,10 +434,6 @@ public class TestTGAuthServiceOnline {
}
}
// **
// PRIVATE METHODS
// **
/**
* <p>
* Initialises the TG-extra CRUD stub.
......@@ -475,39 +454,4 @@ public class TestTGAuthServiceOnline {
}
}
/**
* <p>
* Loads a resource.
* </p>
*
* TODO Put together with the method in TGCrudServiceUtilities! Maybe create
* a first build maven module for util things.
*
* @param {@link
* String} The resource to search for.
* @return {@link File} The resource.
* @throws IOException
*/
public static File getResource(String resPart) throws IOException {
File res;
// If we have an absolute resPart, just return the file.
if (resPart.startsWith(File.separator)) {
return new File(resPart);
}
URL url = ClassLoader.getSystemClassLoader().getResource(resPart);
if (url == null) {
throw new IOException("Resource '" + resPart + "' not found");
}
try {
res = new File(url.toURI());
} catch (URISyntaxException ue) {
res = new File(url.getPath());
}
return res;
}
}
......@@ -16,6 +16,11 @@
<wsdl.file>tgextra.wsdl</wsdl.file>
</properties>
<dependencies>
<dependency>
<groupId>info.textgrid.middleware</groupId>
<artifactId>tgauth-client-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
......
......@@ -90,19 +90,6 @@ public class TestTGAuthServiceOnline {
// STATIC FINALS
// **
private final static String OPERATION_CREATE = "create";
private final static String OPERATION_DELETE = "delete";
private final static String OPERATION_WRITE = "write";
private final static String OPERATION_READ = "read";
private static String ROLE_EDITOR = "Bearbeiter";
private static String ROLE_ADMIN = "Administrator";
private static String ROLE_MANAGER = "Projektleiter";
private static String ROLE_OBSERVER = "Beobachter";
private final static String TABLINE = "\t----------------------------------------";
// private static final String propertiesFile =
// "tgauth.test.esx1.properties";
private static final String propertiesFile = "tgauth.test.devtextgridlaborg.crudjunit1.properties";
// **
......@@ -131,7 +118,7 @@ public class TestTGAuthServiceOnline {
// Load properties file.
Properties p = new Properties();
p.load(new FileInputStream(
TGCrudClientUtils.getResource(propertiesFile)));
TGAuthClientUtilities.getResource(propertiesFile)));
// Get and create the tgextra stubs.
URL location = new URL(p.getProperty("tgextraServiceEndpointUrl"));
......@@ -822,26 +809,6 @@ public class TestTGAuthServiceOnline {
// PRIVATE METHODS
// **
/**
* <p>
* Initialises a regular TG-extra stub.
* </p>
*
* @param theEndpoint
*/
private static void initTgextraService(URL theEndpoint) {
if (tgextra == null) {
// Create TG-extra service stubs.
tgextra = TGAuthClientUtilities.getTgextra(theEndpoint);
System.out.println("TG-auth stub created");
} else {
System.out.println("Using existing TG-auth stub");
}
}
/**
* <p>
* Adds a project for testing.
......@@ -944,4 +911,24 @@ public class TestTGAuthServiceOnline {
System.out.println("\tOK");
}
/**
* <p>
* Initialises a regular TG-extra stub.
* </p>
*
* @param theEndpoint
*/
private static void initTgextraService(URL theEndpoint) {
if (tgextra == null) {
// Create TG-extra service stubs.
tgextra = TGAuthClientUtilities.getTgextra(theEndpoint);
System.out.println("TG-auth stub created");
} else {
System.out.println("Using existing TG-auth stub");
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment