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

Enable the commented unit tests in the repository #171

Merged
merged 3 commits into from
Apr 17, 2024
Merged
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
3 changes: 0 additions & 3 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ codecov:
wait_for_ci: yes

coverage:
precision: 2
round: down

status:
# Learn more at http://docs.codecov.io/docs/codecov-yaml
project:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,46 +93,46 @@ public void testBasicTest0001() throws Exception {
}
}

// public void testBasicTest0002() throws Exception {

// String reqResNo;
// Set<String> policies = new HashSet<String>();
// policies.add("TestPolicy_0020.xml");
// PDP pdp = getPDPNewInstance(policies);
// log.info("Basic Test 0020 is started");

// for(int i = 1; i < 4 ; i++){

// if(i < 10){
// reqResNo = "0" + i;
// } else {
// reqResNo = Integer.toString(i);
// }

// String request = TestUtil.createRequest(ROOT_DIRECTORY, VERSION_DIRECTORY,
// "request_0020_" + reqResNo + ".xml");
// if(request != null){
// log.info("Request that is sent to the PDP : " + request);
// ResponseCtx response = TestUtil.evaluate(getPDPNewInstance(policies), request);
// if(response != null){
// log.info("Response that is received from the PDP : " + response.encode());
// ResponseCtx expectedResponseCtx = TestUtil.createResponse(ROOT_DIRECTORY,
// VERSION_DIRECTORY, "response_0020_" + reqResNo + ".xml");
// if(expectedResponseCtx != null){
// assertTrue(TestUtil.isMatching(response, expectedResponseCtx));
// } else {
// assertTrue("Response read from file is Null",false);
// }
// } else {
// assertFalse("Response received PDP is Null",false);
// }
// } else {
// assertTrue("Request read from file is Null", false);
// }

// log.info("Basic Test 0020 is finished");
// }
// }
public void testBasicTest0002() throws Exception {

String reqResNo;
Set<String> policies = new HashSet<String>();
policies.add("TestPolicy_0020.xml");
PDP pdp = getPDPNewInstance(policies);
log.info("Basic Test 0020 is started");

for(int i = 1; i < 4 ; i++){

if(i < 10){
reqResNo = "0" + i;
} else {
reqResNo = Integer.toString(i);
}

String request = TestUtil.createRequest(ROOT_DIRECTORY, VERSION_DIRECTORY,
"request_0020_" + reqResNo + ".xml");
if(request != null){
log.info("Request that is sent to the PDP : " + request);
ResponseCtx response = TestUtil.evaluate(getPDPNewInstance(policies), request);
if(response != null){
log.info("Response that is received from the PDP : " + response.encode());
ResponseCtx expectedResponseCtx = TestUtil.createResponse(ROOT_DIRECTORY,
VERSION_DIRECTORY, "response_0020_" + reqResNo + ".xml");
if(expectedResponseCtx != null){
assertTrue(TestUtil.isMatching(response, expectedResponseCtx));
} else {
assertTrue("Response read from file is Null",false);
}
} else {
assertFalse("Response received PDP is Null",false);
}
} else {
assertTrue("Request read from file is Null", false);
}

log.info("Basic Test 0020 is finished");
}
}

/**
* Returns a new PDP instance with new XACML policies
Expand Down
Loading