Commit b1f461e9 authored by Stefan Funk's avatar Stefan Funk 🐧
Browse files

SOme last changes to deprecated methods.

parent 4923daf2
......@@ -12,9 +12,9 @@ variables:
# File for storing the POM project.version
VARIABLES_FILE: ./variables.txt
##################
### TEMPLATES ###
##################
###################
### TEMPLATES ###
###################
.webapp: &webapp
image: alpine:3.14
stage: deploy_deb
......@@ -25,7 +25,7 @@ variables:
- export PLOC="$(ls ./${PPATH}/*.deb)"
- DEB_NAME=$PNAME-$PVERSION.deb
- 'if [[ $PVERSION =~ .*${PKEY}$ ]]; then'
- echo "---A ${PKEY} RELEASE BUILD IS BEING PERFORMED---"
- echo "---A ${PKEY} BUILD IS BEING PERFORMED---"
- 'curl -u ${APTLY_USER}:${APTLY_PASSWORD} -X POST --header "Content-Type:multipart/form-data" -F file=@${PLOC} ${APTLY_URL}/files/${DEB_NAME}'
- 'curl -u ${APTLY_USER}:${APTLY_PASSWORD} -X POST ${APTLY_URL}/repos/${APTLY_TARGET}/file/${DEB_NAME}'
- 'curl -u ${APTLY_USER}:${APTLY_PASSWORD} -X PUT -H "Content-Type: application/json" --data "{}" ${APTLY_URL}/publish/:./indy'
......
/*******************************************************************************
* This software is copyright (c) 2015 by
/**
* This software is copyright (c) 2021 by
*
* - TextGrid Consortium (http://www.textgrid.de)
* - DAASI International GmbH (http://www.daasi.de)
* TextGrid Consortium (https://textgrid.de)
*
* DAASI International GmbH (https://daasi.de)
*
* This is free software. You can redistribute it and/or modify it under the
* terms described in the GNU Lesser General Public License v3 of which you
* should have received a copy. Otherwise you can download it from
* This is free software. You can redistribute it and/or modify it under the terms described in the
* GNU Lesser General Public License v3 of which you should have received a copy. Otherwise you can
* download it from
*
* http://www.gnu.org/licenses/lgpl-3.0.txt
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* @copyright TextGrid Consortium (http://www.textgrid.de)
* @copyright DAASI International GmbH (http://www.daasi.de)
* @license http://www.gnu.org/licenses/lgpl-3.0.txt GNU Lesser General Public
* License v3
* @copyright TextGrid Consortium (https://textgrid.de)
* @copyright DAASI International GmbH (https://daasi.de)
* @license GNU Lesser General Public License v3 (http://www.gnu.org/licenses/lgpl-3.0.txt)
* @author Stefan E. Funk (stefan.funk@daasi.de)
******************************************************************************/
*/
package info.textgrid.namespaces.middleware.tgcrud.services.tgcrudservice.test;
......@@ -25,302 +25,296 @@ import info.textgrid.namespaces.middleware.tgcrud.services.tgcrudservice.CrudSer
import info.textgrid.namespaces.middleware.tgcrud.services.tgcrudservice.CrudServiceIdentifier;
import info.textgrid.namespaces.middleware.tgcrud.services.tgcrudservice.TGCrudServiceIdentifierNoidHazelcastLockingImpl;
import info.textgrid.namespaces.middleware.tgcrud.services.tgcrudservice.TGCrudServiceUtilities;
import java.net.URI;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
/*******************************************************************************
/**
* TODOLOG
*
*******************************************************************************
**
* CHANGELOG
*
* 2015-05-13 Funk Copied this test file from another test class.
******************************************************************************/
* 2015-05-13 - Funk - Copied this test file from another test class.
*/
/*******************************************************************************
/**
* <p>
* JUnit class for testing the TG-crud Identifier Hazelcast Locking.
* </p>
*
* @author Stefan E. Funk, DAASI International GmbH
* @version 2015-05-13
* @version 2021-11-23
* @since 2015-05-13
******************************************************************************/
* @deprecated
*/
@Deprecated
public class TestTGCrudServiceIdentifierNoidHazelcastLockingImpl {
// **
// FINALS
// **
private static final String USER1 = "MarianneMargel@dariah.eu";
private static final String USER2 = "PaulPokemon@dariah.eu";
// **
// STATICS
// **
private static CrudServiceConfigurator conf;
private static CrudServiceIdentifier lockingService;
// **
// SET UPS
// **
/**
* @throws Exception
*/
@BeforeClass
public static void setUpBeforeClass() throws Exception {
// Get config file.
String configFile = TGCrudServiceUtilities
.getResource("tgcrud-junit.localfile.properties").toString();
// Load the TG-crud configuration.
conf = CrudServiceConfigurator.getInstance(configFile);
// Create UUID URI instance.
lockingService = new TGCrudServiceIdentifierNoidHazelcastLockingImpl();
lockingService.setConfiguration(conf);
}
/**
* @throws java.lang.Exception
*/
@AfterClass
public static void tearDownAfterClass() throws Exception {
//
}
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
//
}
/**
* @throws java.lang.Exception
*/
@After
public void tearDown() throws Exception {
//
}
// **
// TESTS
// **
/**
* @throws IoFault
*/
@Test
public void testHazelcastLockingAndUnlocking() throws IoFault {
URI uri = URI.create("textgrid:123456.7");
System.out.println();
// Lock with user1.
if (lockingService.lock(uri, USER1)) {
System.out.println(uri + " locked by " + USER1);
} else {
assertTrue(false);
}
// Unlock with user1.
if (lockingService.unlock(uri, USER1)) {
System.out.println(uri + " unlocked by " + USER1);
} else {
assertTrue(false);
}
}
/**
* @throws IoFault
*/
@Test
public void testHazelcastLockingAndUnlockingWithConflict() throws IoFault {
URI uri = URI.create("textgrid:abcdefg.1");
System.out.println();
// Lock with user1.
if (lockingService.lock(uri, USER1)) {
System.out.println(uri + " locked by " + USER1);
} else {
assertTrue(false);
}
// Lock with user2.
if (!lockingService.lock(uri, USER2)) {
System.out.println(uri + " can not be locked by " + USER2
+ ", it is already locked by "
+ lockingService.isLockedBy(uri));
} else {
assertTrue(false);
}
// Unlock with user1.
if (lockingService.unlock(uri, USER1)) {
System.out.println(uri + " unlocked by " + USER1);
} else {
assertTrue(false);
}
// Lock with user2.
if (lockingService.lock(uri, USER2)) {
System.out.println(uri + " locked by " + USER2);
} else {
assertTrue(false);
}
// Unlock with user2.
if (lockingService.lock(uri, USER2)) {
System.out.println(uri + " unlocked by " + USER2);
} else {
assertTrue(false);
}
}
/**
* @throws IoFault
*/
@Test
public void testHazelcastInternalLockingAndUnlocking() throws IoFault {
URI uri = URI.create("textgrid:1hjnm.0");
System.out.println();
// Lock.
if (lockingService.lockInternal(uri)) {
System.out.println(uri + " locked internally");
} else {
assertTrue(false);
}
// Unlock.
if (lockingService.unlockInternal(uri)) {
System.out.println(uri + " unlocked internally");
} else {
assertTrue(false);
}
}
/**
* @throws IoFault
*/
@Test
public void testHazelcastInternalLockingAndUnlockingWithConflict()
throws IoFault {
URI uri = URI.create("textgrid:57en1.3");
System.out.println();
// Lock.
if (lockingService.lockInternal(uri)) {
System.out.println(uri + " locked internally");
} else {
assertTrue(false);
}
// Lock again.
if (!lockingService.lockInternal(uri)) {
System.out.println(uri + " already has been locked internally");
} else {
assertTrue(false);
}
// Unlock.
if (lockingService.unlockInternal(uri)) {
System.out.println(uri + " unlocked internally");
} else {
assertTrue(false);
}
// Lock.
if (lockingService.lockInternal(uri)) {
System.out.println(uri + " locked internally");
} else {
assertTrue(false);
}
// Unlock.
if (lockingService.unlockInternal(uri)) {
System.out.println(uri + " unlocked internally");
} else {
assertTrue(false);
}
}
/**
* @throws IoFault
* @throws InterruptedException
*/
@Test
public void testHazelcastAutomagicLocking()
throws IoFault, InterruptedException {
URI uri = URI.create("textgrid:zzdf7.0");
System.out.println();
// Lock with user1.
if (lockingService.lock(uri, USER1)) {
System.out.println(uri + " locked by " + USER1);
} else {
assertTrue(false);
}
// Lock with user2.
if (!lockingService.lock(uri, USER2)) {
System.out.println(uri + " can not be locked by " + USER2
+ ", it is already locked by "
+ lockingService.isLockedBy(uri));
} else {
assertTrue(false);
}
// Wait for automagic unlocking time.
Long time2wait = conf.getIDaUTOMAGICuNLOCKINGtIME() + 1000;
System.out.println(
"waiting for automagic unlocking time plus one second: "
+ time2wait);
Thread.sleep(time2wait);
// Lock again with user2.
if (lockingService.lock(uri, USER2)) {
System.out.println(uri + " locked by " + USER2);
} else {
assertTrue(false);
}
// Unlock with user1.
if (!lockingService.lock(uri, USER1)) {
System.out.println(uri + " can not be unlocked by " + USER1
+ ", it is now locked by "
+ lockingService.isLockedBy(uri));
} else {
assertTrue(false);
}
// Unlock with user2.
if (lockingService.lock(uri, USER2)) {
System.out.println(uri + " unlocked by " + USER2);
} else {
assertTrue(false);
}
}
// **
// FINALS
// **
private static final String USER1 = "MarianneMargel@dariah.eu";
private static final String USER2 = "PaulPokemon@dariah.eu";
// **
// STATICS
// **
private static CrudServiceConfigurator conf;
private static CrudServiceIdentifier lockingService;
// **
// SET UPS
// **
/**
* @throws Exception
*/
@BeforeClass
public static void setUpBeforeClass() throws Exception {
// Get config file.
String configFile =
TGCrudServiceUtilities.getResource("tgcrud-junit.localfile.properties").toString();
// Load the TG-crud configuration.
conf = CrudServiceConfigurator.getInstance(configFile);
// Create UUID URI instance.
lockingService = new TGCrudServiceIdentifierNoidHazelcastLockingImpl();
lockingService.setConfiguration(conf);
}
/**
* @throws java.lang.Exception
*/
@AfterClass
public static void tearDownAfterClass() throws Exception {
//
}
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
//
}
/**
* @throws java.lang.Exception
*/
@After
public void tearDown() throws Exception {
//
}
// **
// TESTS
// **
/**
* @throws IoFault
*/
@Test
public void testHazelcastLockingAndUnlocking() throws IoFault {
URI uri = URI.create("textgrid:123456.7");
System.out.println();
// Lock with user1.
if (lockingService.lock(uri, USER1)) {
System.out.println(uri + " locked by " + USER1);
} else {
assertTrue(false);
}
// Unlock with user1.
if (lockingService.unlock(uri, USER1)) {
System.out.println(uri + " unlocked by " + USER1);
} else {
assertTrue(false);
}
}
/**
* @throws IoFault
*/
@Test
public void testHazelcastLockingAndUnlockingWithConflict() throws IoFault {
URI uri = URI.create("textgrid:abcdefg.1");
System.out.println();
// Lock with user1.
if (lockingService.lock(uri, USER1)) {
System.out.println(uri + " locked by " + USER1);
} else {
assertTrue(false);
}
// Lock with user2.
if (!lockingService.lock(uri, USER2)) {
System.out.println(uri + " can not be locked by " + USER2 + ", it is already locked by "
+ lockingService.isLockedBy(uri));
} else {
assertTrue(false);
}
// Unlock with user1.
if (lockingService.unlock(uri, USER1)) {
System.out.println(uri + " unlocked by " + USER1);
} else {
assertTrue(false);
}
// Lock with user2.
if (lockingService.lock(uri, USER2)) {
System.out.println(uri + " locked by " + USER2);
} else {
assertTrue(false);
}
// Unlock with user2.
if (lockingService.lock(uri, USER2)) {
System.out.println(uri + " unlocked by " + USER2);
} else {
assertTrue(false);
}
}
/**
* @throws IoFault
*/
@Test
public void testHazelcastInternalLockingAndUnlocking() throws IoFault {
URI uri = URI.create("textgrid:1hjnm.0");
System.out.println();
// Lock.
if (lockingService.lockInternal(uri)) {
System.out.println(uri + " locked internally");
} else {
assertTrue(false);
}
// Unlock.
if (lockingService.unlockInternal(uri)) {
System.out.println(uri + " unlocked internally");
} else {
assertTrue(false);
}
}
/**
* @throws IoFault
*/
@Test
public void testHazelcastInternalLockingAndUnlockingWithConflict()
throws IoFault {
URI uri = URI.create("textgrid:57en1.3");