refs #2222: Move infrastructure tests outside of components junit tests
https://support.d4science.org/issues/2222 git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/private/luca.frosini/infrastructure-tests@124069 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c8c7e1dea3
commit
ea9fb53ae7
|
@ -0,0 +1,55 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.accounting.datamodel.usagerecords;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.gcube.accounting.datamodel.basetypes.TestUsageRecord;
|
||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.documentstore.exception.InvalidValueException;
|
||||
import org.gcube.utils.TestUtility;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||
*
|
||||
*/
|
||||
public class JobUsageRecordScopedTest extends JobUsageRecordTest {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(JobUsageRecordScopedTest.class);
|
||||
|
||||
@Before
|
||||
public void before() throws Exception{
|
||||
SecurityTokenProvider.instance.set(TestUtility.TOKEN);
|
||||
}
|
||||
|
||||
@After
|
||||
public void after() throws Exception{
|
||||
SecurityTokenProvider.instance.reset();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testRequiredFieldsScoped() throws InvalidValueException{
|
||||
JobUsageRecord usageRecord = TestUsageRecord.createTestJobUsageRecord();
|
||||
|
||||
Set<String> expectedRequiredFields = getExpectedRequiredFields();
|
||||
logger.debug("Expected Required Fields : {}", expectedRequiredFields);
|
||||
|
||||
Set<String> gotRequiredFields = usageRecord.getRequiredFields();
|
||||
logger.debug("Got Required Fields : {}", gotRequiredFields);
|
||||
|
||||
Assert.assertTrue(expectedRequiredFields.containsAll(gotRequiredFields));
|
||||
Assert.assertTrue(gotRequiredFields.containsAll(expectedRequiredFields));
|
||||
|
||||
usageRecord.validate();
|
||||
logger.debug("{}", usageRecord);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,95 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.accounting.datamodel.usagerecords;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.gcube.accounting.datamodel.UsageRecord;
|
||||
import org.gcube.accounting.datamodel.basetypes.AbstractJobUsageRecord;
|
||||
import org.gcube.accounting.datamodel.basetypes.TestUsageRecord;
|
||||
import org.gcube.accounting.testutility.TestUtility;
|
||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.documentstore.exception.InvalidValueException;
|
||||
import org.gcube.documentstore.records.Record;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||
*
|
||||
*/
|
||||
public class JobUsageRecordTest {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(JobUsageRecordTest.class);
|
||||
|
||||
@Before
|
||||
public void before() throws Exception{
|
||||
SecurityTokenProvider.instance.set(TestUtility.TOKEN);
|
||||
}
|
||||
|
||||
@After
|
||||
public void after() throws Exception{
|
||||
SecurityTokenProvider.instance.reset();
|
||||
}
|
||||
|
||||
public static Set<String> getExpectedRequiredFields(){
|
||||
Set<String> expectedRequiredFields = new HashSet<String>();
|
||||
expectedRequiredFields.add(Record.ID);
|
||||
expectedRequiredFields.add(UsageRecord.CONSUMER_ID);
|
||||
expectedRequiredFields.add(UsageRecord.CREATION_TIME);
|
||||
expectedRequiredFields.add(UsageRecord.RECORD_TYPE);
|
||||
expectedRequiredFields.add(UsageRecord.SCOPE);
|
||||
expectedRequiredFields.add(UsageRecord.OPERATION_RESULT);
|
||||
expectedRequiredFields.add(AbstractJobUsageRecord.JOB_ID);
|
||||
expectedRequiredFields.add(AbstractJobUsageRecord.JOB_START_TIME);
|
||||
expectedRequiredFields.add(AbstractJobUsageRecord.JOB_END_TIME);
|
||||
|
||||
return expectedRequiredFields;
|
||||
}
|
||||
|
||||
@Test(expected=InvalidValueException.class)
|
||||
public void scopeNotSetValidationError() throws InvalidValueException {
|
||||
JobUsageRecord usageRecord = TestUsageRecord.createTestJobUsageRecordAutomaticScope();
|
||||
usageRecord.validate();
|
||||
logger.debug("{}", usageRecord);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRequiredFields() throws InvalidValueException{
|
||||
JobUsageRecord usageRecord = TestUsageRecord.createTestJobUsageRecordAutomaticScope();
|
||||
|
||||
Set<String> expectedRequiredFields = getExpectedRequiredFields();
|
||||
logger.debug("Expected Required Fields : {}", expectedRequiredFields);
|
||||
|
||||
Set<String> gotRequiredFields = usageRecord.getRequiredFields();
|
||||
logger.debug("Got Required Fields : {}", gotRequiredFields);
|
||||
|
||||
Assert.assertTrue(expectedRequiredFields.containsAll(gotRequiredFields));
|
||||
Assert.assertTrue(gotRequiredFields.containsAll(expectedRequiredFields));
|
||||
|
||||
usageRecord.validate();
|
||||
logger.debug("{}", usageRecord);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRequiredFieldsWithScopeSetExplicitely() throws InvalidValueException{
|
||||
JobUsageRecord usageRecord = TestUsageRecord.createTestJobUsageRecordAutomaticScope();
|
||||
Assert.assertTrue(usageRecord.getScope()==null);
|
||||
usageRecord.setScope(TestUsageRecord.TEST_SCOPE);
|
||||
|
||||
Set<String> expectedRequiredFields = getExpectedRequiredFields();
|
||||
Set<String> gotRequiredFields = usageRecord.getRequiredFields();
|
||||
|
||||
Assert.assertTrue(expectedRequiredFields.containsAll(gotRequiredFields));
|
||||
Assert.assertTrue(gotRequiredFields.containsAll(expectedRequiredFields));
|
||||
|
||||
usageRecord.validate();
|
||||
logger.debug("{}", usageRecord);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.accounting.datamodel.usagerecords;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.gcube.accounting.datamodel.basetypes.TestUsageRecord;
|
||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.documentstore.exception.InvalidValueException;
|
||||
import org.gcube.utils.TestUtility;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||
*
|
||||
*/
|
||||
public class ServiceUsageRecordScopedTest extends ServiceUsageRecordTest {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(ServiceUsageRecordScopedTest.class);
|
||||
|
||||
@Before
|
||||
public void before() throws Exception{
|
||||
SecurityTokenProvider.instance.set(TestUtility.TOKEN);
|
||||
}
|
||||
|
||||
@After
|
||||
public void after() throws Exception{
|
||||
SecurityTokenProvider.instance.reset();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRequiredFieldsScoped() throws InvalidValueException{
|
||||
ServiceUsageRecord usageRecord = TestUsageRecord.createTestServiceUsageRecord();
|
||||
|
||||
Set<String> expectedRequiredFields = getExpectedRequiredFields();
|
||||
logger.debug("Expected Required Fields : {}", expectedRequiredFields);
|
||||
|
||||
Set<String> gotRequiredFields = usageRecord.getRequiredFields();
|
||||
logger.debug("Got Required Fields : {}", gotRequiredFields);
|
||||
|
||||
Assert.assertTrue(expectedRequiredFields.containsAll(gotRequiredFields));
|
||||
Assert.assertTrue(gotRequiredFields.containsAll(expectedRequiredFields));
|
||||
|
||||
usageRecord.validate();
|
||||
logger.debug("{}", usageRecord);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.accounting.datamodel.usagerecords;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.gcube.accounting.datamodel.UsageRecord;
|
||||
import org.gcube.accounting.datamodel.basetypes.AbstractServiceUsageRecord;
|
||||
import org.gcube.accounting.datamodel.basetypes.TestUsageRecord;
|
||||
import org.gcube.accounting.testutility.TestUtility;
|
||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.documentstore.exception.InvalidValueException;
|
||||
import org.gcube.documentstore.records.Record;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||
*
|
||||
*/
|
||||
public class ServiceUsageRecordTest {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(ServiceUsageRecordTest.class);
|
||||
|
||||
@Before
|
||||
public void before() throws Exception{
|
||||
SecurityTokenProvider.instance.set(TestUtility.TOKEN);
|
||||
}
|
||||
|
||||
@After
|
||||
public void after() throws Exception{
|
||||
SecurityTokenProvider.instance.reset();
|
||||
}
|
||||
|
||||
public static Set<String> getExpectedRequiredFields(){
|
||||
Set<String> expectedRequiredFields = new HashSet<String>();
|
||||
expectedRequiredFields.add(Record.ID);
|
||||
expectedRequiredFields.add(UsageRecord.CONSUMER_ID);
|
||||
expectedRequiredFields.add(UsageRecord.CREATION_TIME);
|
||||
expectedRequiredFields.add(UsageRecord.RECORD_TYPE);
|
||||
expectedRequiredFields.add(UsageRecord.SCOPE);
|
||||
expectedRequiredFields.add(UsageRecord.OPERATION_RESULT);
|
||||
expectedRequiredFields.add(AbstractServiceUsageRecord.CALLER_HOST);
|
||||
expectedRequiredFields.add(AbstractServiceUsageRecord.HOST);
|
||||
expectedRequiredFields.add(AbstractServiceUsageRecord.SERVICE_CLASS);
|
||||
expectedRequiredFields.add(AbstractServiceUsageRecord.SERVICE_NAME);
|
||||
expectedRequiredFields.add(AbstractServiceUsageRecord.CALLED_METHOD);
|
||||
expectedRequiredFields.add(AbstractServiceUsageRecord.DURATION);
|
||||
return expectedRequiredFields;
|
||||
}
|
||||
|
||||
@Test(expected=InvalidValueException.class)
|
||||
public void scopeNotSetValidationError() throws InvalidValueException {
|
||||
SecurityTokenProvider.instance.reset();
|
||||
ServiceUsageRecord usageRecord = TestUsageRecord.createTestServiceUsageRecordAutomaticScope();
|
||||
usageRecord.validate();
|
||||
logger.debug("{}", usageRecord);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRequiredFields() throws InvalidValueException{
|
||||
ServiceUsageRecord usageRecord = TestUsageRecord.createTestServiceUsageRecordAutomaticScope();
|
||||
|
||||
Set<String> expectedRequiredFields = getExpectedRequiredFields();
|
||||
logger.debug("Expected Required Fields : {}", expectedRequiredFields);
|
||||
|
||||
Set<String> gotRequiredFields = usageRecord.getRequiredFields();
|
||||
logger.debug("Got Required Fields : {}", gotRequiredFields);
|
||||
|
||||
Assert.assertTrue(expectedRequiredFields.containsAll(gotRequiredFields));
|
||||
Assert.assertTrue(gotRequiredFields.containsAll(expectedRequiredFields));
|
||||
|
||||
usageRecord.validate();
|
||||
logger.debug("{}", usageRecord);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRequiredFieldsWithScopeSetExplicitely() throws InvalidValueException{
|
||||
SecurityTokenProvider.instance.reset();
|
||||
ServiceUsageRecord usageRecord = TestUsageRecord.createTestServiceUsageRecordAutomaticScope();
|
||||
Assert.assertTrue(usageRecord.getScope()==null);
|
||||
usageRecord.setScope(TestUsageRecord.TEST_SCOPE);
|
||||
|
||||
Set<String> expectedRequiredFields = getExpectedRequiredFields();
|
||||
Set<String> gotRequiredFields = usageRecord.getRequiredFields();
|
||||
|
||||
Assert.assertTrue(expectedRequiredFields.containsAll(gotRequiredFields));
|
||||
Assert.assertTrue(gotRequiredFields.containsAll(expectedRequiredFields));
|
||||
|
||||
usageRecord.validate();
|
||||
logger.debug("{}", usageRecord);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.accounting.datamodel.usagerecords;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.gcube.accounting.datamodel.basetypes.TestUsageRecord;
|
||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.documentstore.exception.InvalidValueException;
|
||||
import org.gcube.utils.TestUtility;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||
*
|
||||
*/
|
||||
public class StorageUsageRecordScopedTest extends StorageUsageRecordTest {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(StorageUsageRecordScopedTest.class);
|
||||
|
||||
@Before
|
||||
public void before() throws Exception{
|
||||
SecurityTokenProvider.instance.set(TestUtility.TOKEN);
|
||||
}
|
||||
|
||||
@After
|
||||
public void after() throws Exception{
|
||||
SecurityTokenProvider.instance.reset();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRequiredFieldsScoped() throws InvalidValueException{
|
||||
StorageUsageRecord usageRecord = TestUsageRecord.createTestStorageUsageRecord();
|
||||
|
||||
Set<String> expectedRequiredFields = getExpectedRequiredFields();
|
||||
logger.debug("Expected Required Fields : {}", expectedRequiredFields);
|
||||
|
||||
Set<String> gotRequiredFields = usageRecord.getRequiredFields();
|
||||
logger.debug("Got Required Fields : {}", gotRequiredFields);
|
||||
|
||||
Assert.assertTrue(expectedRequiredFields.containsAll(gotRequiredFields));
|
||||
Assert.assertTrue(gotRequiredFields.containsAll(expectedRequiredFields));
|
||||
|
||||
usageRecord.validate();
|
||||
logger.debug("{}", usageRecord);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,102 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.accounting.datamodel.usagerecords;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.gcube.accounting.datamodel.UsageRecord;
|
||||
import org.gcube.accounting.datamodel.basetypes.AbstractStorageUsageRecord;
|
||||
import org.gcube.accounting.datamodel.basetypes.TestUsageRecord;
|
||||
import org.gcube.accounting.testutility.TestUtility;
|
||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.documentstore.exception.InvalidValueException;
|
||||
import org.gcube.documentstore.records.Record;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||
*
|
||||
*/
|
||||
public class StorageUsageRecordTest {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(StorageUsageRecordTest.class);
|
||||
|
||||
@Before
|
||||
public void before() throws Exception{
|
||||
SecurityTokenProvider.instance.set(TestUtility.TOKEN);
|
||||
}
|
||||
|
||||
@After
|
||||
public void after() throws Exception{
|
||||
SecurityTokenProvider.instance.reset();
|
||||
}
|
||||
|
||||
public static Set<String> getExpectedRequiredFields(){
|
||||
Set<String> expectedRequiredFields = new HashSet<String>();
|
||||
expectedRequiredFields.add(Record.ID);
|
||||
expectedRequiredFields.add(UsageRecord.CONSUMER_ID);
|
||||
expectedRequiredFields.add(UsageRecord.CREATION_TIME);
|
||||
expectedRequiredFields.add(UsageRecord.RECORD_TYPE);
|
||||
expectedRequiredFields.add(UsageRecord.SCOPE);
|
||||
expectedRequiredFields.add(UsageRecord.OPERATION_RESULT);
|
||||
expectedRequiredFields.add(AbstractStorageUsageRecord.RESOURCE_OWNER);
|
||||
expectedRequiredFields.add(AbstractStorageUsageRecord.RESOURCE_SCOPE);
|
||||
expectedRequiredFields.add(AbstractStorageUsageRecord.RESOURCE_URI);
|
||||
expectedRequiredFields.add(AbstractStorageUsageRecord.PROVIDER_URI);
|
||||
expectedRequiredFields.add(AbstractStorageUsageRecord.OPERATION_TYPE);
|
||||
expectedRequiredFields.add(AbstractStorageUsageRecord.DATA_TYPE);
|
||||
expectedRequiredFields.add(AbstractStorageUsageRecord.DATA_VOLUME);
|
||||
|
||||
return expectedRequiredFields;
|
||||
}
|
||||
|
||||
@Test(expected=InvalidValueException.class)
|
||||
public void scopeNotSetValidationError() throws InvalidValueException {
|
||||
SecurityTokenProvider.instance.reset();
|
||||
StorageUsageRecord usageRecord = TestUsageRecord.createTestStorageUsageRecordAutomaticScope();
|
||||
usageRecord.validate();
|
||||
logger.debug("{}", usageRecord);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRequiredFields() throws InvalidValueException{
|
||||
StorageUsageRecord usageRecord = TestUsageRecord.createTestStorageUsageRecordAutomaticScope();
|
||||
|
||||
Set<String> expectedRequiredFields = getExpectedRequiredFields();
|
||||
logger.debug("Expected Required Fields : {}", expectedRequiredFields);
|
||||
|
||||
Set<String> gotRequiredFields = usageRecord.getRequiredFields();
|
||||
logger.debug("Got Required Fields : {}", gotRequiredFields);
|
||||
|
||||
Assert.assertTrue(expectedRequiredFields.containsAll(gotRequiredFields));
|
||||
Assert.assertTrue(gotRequiredFields.containsAll(expectedRequiredFields));
|
||||
|
||||
usageRecord.validate();
|
||||
logger.debug("{}", usageRecord);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRequiredFieldsWithScopeSetExplicitely() throws InvalidValueException{
|
||||
SecurityTokenProvider.instance.reset();
|
||||
StorageUsageRecord usageRecord = TestUsageRecord.createTestStorageUsageRecordExplicitScope();
|
||||
Assert.assertTrue(usageRecord.getScope()==null);
|
||||
usageRecord.setScope(TestUsageRecord.TEST_SCOPE);
|
||||
|
||||
Set<String> expectedRequiredFields = getExpectedRequiredFields();
|
||||
Set<String> gotRequiredFields = usageRecord.getRequiredFields();
|
||||
|
||||
Assert.assertTrue(expectedRequiredFields.containsAll(gotRequiredFields));
|
||||
Assert.assertTrue(gotRequiredFields.containsAll(expectedRequiredFields));
|
||||
|
||||
usageRecord.validate();
|
||||
logger.debug("{}", usageRecord);
|
||||
}
|
||||
|
||||
}
|
|
@ -9,10 +9,10 @@ import java.util.Set;
|
|||
import org.gcube.accounting.datamodel.UsageRecord;
|
||||
import org.gcube.accounting.datamodel.basetypes.AbstractTaskUsageRecord;
|
||||
import org.gcube.accounting.datamodel.basetypes.TestUsageRecord;
|
||||
import org.gcube.accounting.testutility.TestUtility;
|
||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.documentstore.exception.InvalidValueException;
|
||||
import org.gcube.documentstore.records.Record;
|
||||
import org.gcube.utils.TestUtility;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
|
@ -24,9 +24,9 @@ import org.slf4j.LoggerFactory;
|
|||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||
*
|
||||
*/
|
||||
public class TaskUsageRecordTest {
|
||||
public class TaskUsageRecordScopedTest extends TaskUsageRecordTest {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(TaskUsageRecordTest.class);
|
||||
private static Logger logger = LoggerFactory.getLogger(TaskUsageRecordScopedTest.class);
|
||||
|
||||
@Before
|
||||
public void before() throws Exception{
|
||||
|
@ -53,17 +53,9 @@ public class TaskUsageRecordTest {
|
|||
return expectedRequiredFields;
|
||||
}
|
||||
|
||||
@Test(expected=InvalidValueException.class)
|
||||
public void scopeNotSetValidationError() throws InvalidValueException {
|
||||
SecurityTokenProvider.instance.reset();
|
||||
TaskUsageRecord usageRecord = TestUsageRecord.createTestTaskUsageRecordAutomaticScope();
|
||||
usageRecord.validate();
|
||||
logger.debug("{}", usageRecord);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRequiredFields() throws InvalidValueException{
|
||||
TaskUsageRecord usageRecord = TestUsageRecord.createTestTaskUsageRecordAutomaticScope();
|
||||
public void testRequiredFieldsScoped() throws InvalidValueException{
|
||||
TaskUsageRecord usageRecord = TestUsageRecord.createTestTaskUsageRecord();
|
||||
|
||||
Set<String> expectedRequiredFields = getExpectedRequiredFields();
|
||||
logger.debug("Expected Required Fields : {}", expectedRequiredFields);
|
||||
|
@ -77,21 +69,5 @@ public class TaskUsageRecordTest {
|
|||
usageRecord.validate();
|
||||
logger.debug("{}", usageRecord);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRequiredFieldsWithScopeSetExplicitely() throws InvalidValueException{
|
||||
SecurityTokenProvider.instance.reset();
|
||||
TaskUsageRecord usageRecord = TestUsageRecord.createTestTaskUsageRecordExplicitScope();
|
||||
Assert.assertTrue(usageRecord.getScope()==null);
|
||||
usageRecord.setScope(TestUsageRecord.TEST_SCOPE);
|
||||
|
||||
Set<String> expectedRequiredFields = getExpectedRequiredFields();
|
||||
Set<String> gotRequiredFields = usageRecord.getRequiredFields();
|
||||
|
||||
Assert.assertTrue(expectedRequiredFields.containsAll(gotRequiredFields));
|
||||
Assert.assertTrue(gotRequiredFields.containsAll(expectedRequiredFields));
|
||||
|
||||
usageRecord.validate();
|
||||
logger.debug("{}", usageRecord);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue