Skip to content

Commit

Permalink
Merge tfc into gradle
Browse files Browse the repository at this point in the history
Conflicts:
	build.xml
	workspace/popjava/src/junit/localtests/LocalTests.java
	workspace/popjava/src/junit/localtests/annotations/AnnotationsTest.java
	workspace/popjava/src/junit/localtests/annotations/objects/Parent.java
	workspace/popjava/src/junit/localtests/jobmanager/POPJavaJobManagerLiveConfigurationTest.java
	workspace/popjava/src/junit/localtests/security/CreateKeyStoreTest.java
	workspace/popjava/src/popjava/combox/Combox.java
	workspace/popjava/src/testsuite/arg/ComplexType3.java
  • Loading branch information
MDosky committed Jan 8, 2018
2 parents f45f4fd + 078cc1a commit a6b0c89
Show file tree
Hide file tree
Showing 92 changed files with 2,030 additions and 430 deletions.
9 changes: 5 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,17 @@ dependencies {
testCompile group: 'com.carrotsearch', name: 'junit-benchmarks', version: '0.7.2'
}

test {
test {
useJUnit()

testLogging.showStandardStreams = true

// use only define suite
include '**/AllTests.class'
scanForTestClasses false

beforeTest { descriptor ->
logger.lifecycle(descriptor.toString())
beforeTest {
descriptor -> logger.lifecycle(descriptor.toString())
}
}

Expand Down Expand Up @@ -104,7 +105,7 @@ task jarTestsuite(type: Jar, dependsOn: [ testClasses ], group: 'build', descrip
}
}

task makeRelease(dependsOn: [ fatJar, jarTestsuite, javadoc ], group: 'help', description: 'Make the release folder for the installation script.') {
task prepareRelease(dependsOn: [ fatJar, jarTestsuite, javadoc ], group: 'help', description: 'Make the release folder for the installation script.') {
doLast {
mkdir releaseDirectory
mkdir releaseDirectory + '/bin'
Expand Down
6 changes: 3 additions & 3 deletions workspace/ObjectMapGen/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#Thu Jul 22 09:14:32 ICT 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.compiler.source=1.8
66 changes: 66 additions & 0 deletions workspace/popjava/src/junit/localtests/LocalTests.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package junit.localtests;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;

import junit.localtests.annotations.AnnotationsTest;
import junit.localtests.annotations.POPObjectDefaultMethodTest;
import junit.localtests.arrays.ArraysTest;
import junit.localtests.bigData.BigDataTests;
import junit.localtests.callback.CallBackTest;
import junit.localtests.concurrency.TestConcurrency;
import junit.localtests.creation.NestedPOPCreation;
import junit.localtests.deamontest.DeamonTest;
import junit.localtests.enums.EnumTests;
import junit.localtests.integer.IntegerTest;
import junit.localtests.jobmanager.POPJavaJobManagerConfigurationTest;
import junit.localtests.jobmanager.POPJavaJobManagerLiveConfigurationTest;
import junit.localtests.jvmObject.JVMObjectTest;
import junit.localtests.parameters.ParameterTests;
import junit.localtests.readerWriter.ReaderWriterTest;
import junit.localtests.referencePassing.ReferenceTest;
import junit.localtests.security.CreateKeyStoreTest;
import junit.localtests.security.MethodAccessTest;
import junit.localtests.subclasses.SubclassingTest;
import junit.localtests.subclasses.CallFromSubClassTest;
import junit.localtests.protocols.ProtocolsTests;
import junit.localtests.protocols.IncompatibleConnectionsTest;
import junit.localtests.protocols.WhiteBlacklistTest;
import junit.localtests.serializable.JavaSerializableTest;
import junit.localtests.accounting.AccountingTest;
import junit.localtests.accounting.AccountingAPITest;
import junit.localtests.priority.MethodAnnotationPriority;

@RunWith(Suite.class)
@Suite.SuiteClasses({
CallBackTest.class,
IntegerTest.class,
AnnotationsTest.class,
POPObjectDefaultMethodTest.class,
ReaderWriterTest.class,
TestConcurrency.class,
DeamonTest.class,
EnumTests.class,
ArraysTest.class,
ParameterTests.class,
BigDataTests.class,
SubclassingTest.class,
CallFromSubClassTest.class,
ReferenceTest.class,
JVMObjectTest.class,
NestedPOPCreation.class,
CreateKeyStoreTest.class,
MethodAccessTest.class,
POPJavaJobManagerConfigurationTest.class,
POPJavaJobManagerLiveConfigurationTest.class,
ProtocolsTests.class,
IncompatibleConnectionsTest.class,
WhiteBlacklistTest.class,
JavaSerializableTest.class,
AccountingTest.class,
AccountingAPITest.class,
MethodAnnotationPriority.class
})
public class LocalTests {

}
55 changes: 55 additions & 0 deletions workspace/popjava/src/junit/localtests/accounting/A.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package junit.localtests.accounting;

import popjava.annotation.POPAsyncConc;
import popjava.annotation.POPAsyncSeq;
import popjava.annotation.POPClass;
import popjava.annotation.POPObjectDescription;
import popjava.annotation.POPSyncConc;
import popjava.annotation.POPSyncMutex;
import popjava.annotation.POPSyncSeq;
import popjava.base.POPObject;

/**
*
* @author dosky
*/
@POPClass
public class A extends POPObject {

@POPObjectDescription(url = "localhost", tracking = true)
public A() {
}

@POPSyncSeq
public void seq() {
job();
}

@POPSyncConc
public void conc() {
job();
}

@POPAsyncSeq
public void aseq() {
job();
}

@POPAsyncConc
public void aconc() {
job();
}

@POPSyncMutex
public void sync() {

}

private double job() {
double sum = 0d;
for (int n = 0; n < 1_000_000; n++) {
sum = Math.sqrt(n);
}
return sum;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package junit.localtests.accounting;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import popjava.PopJava;
import popjava.system.POPSystem;

import static org.junit.Assert.*;
import popjava.POPAccounting;
import popjava.util.POPRemoteCaller;

/**
* Testing accounting API
* @author dosky
*/
public class AccountingAPITest {
@Before
public void b() {
POPSystem.initialize();
}

@After
public void a() {
POPSystem.end();
}

@Test
public void apiEnabledTest() {
A a = PopJava.newActive(A.class);
Object ao = a;
assertTrue(POPAccounting.isEnabledFor(ao));
}

@Test
public void apiUsers() {
A a = PopJava.newActive(A.class);
Object ao = a;
assertEquals(1, POPAccounting.getUsers(ao).length);
}

@Test
public void apiRetrieveSpecific() {
A a = PopJava.newActive(A.class);
Object ao = a;
POPRemoteCaller user = POPAccounting.getUsers(ao)[0];
assertTrue(POPAccounting.getInformation(ao, user) != null);
}

@Test
public void apiRetrieveMyself() {
A a = PopJava.newActive(A.class);
Object ao = a;
POPRemoteCaller user = POPAccounting.getUsers(ao)[0];
assertTrue(POPAccounting.getMyInformation(ao) != null);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
package junit.localtests.accounting;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import popjava.system.POPSystem;
import popjava.PopJava;
import popjava.baseobject.POPTrackingMethod;

import static org.junit.Assert.*;

/**
*
* @author dosky
*/
public class AccountingTest {

@Before
public void b() {
POPSystem.initialize();
}

@After
public void a() {
POPSystem.end();
}

public static final long ITERATIONS = 50;

@Test
public void syncSeqTest() {
A a = PopJava.newActive(A.class);
for (int i = 0; i < ITERATIONS; i++) {
a.seq();
}
asserts(a, ".seq()");
}

@Test
public void syncConcTest() {
A a = PopJava.newActive(A.class);
for (int i = 0; i < ITERATIONS; i++) {
a.conc();
}
asserts(a, ".conc()");
}

@Test
public void asyncSeqTest() {
A a = PopJava.newActive(A.class);
for (int i = 0; i < ITERATIONS; i++) {
a.aseq();
}
a.sync();
asserts(a, ".aseq()");
}

@Test
public void asyncConcTest() {
A a = PopJava.newActive(A.class);
for (int i = 0; i < ITERATIONS; i++) {
a.aconc();
}
a.sync();
asserts(a, ".aconc()");
}

@Test
public void mixedTest() {
A a = PopJava.newActive(A.class);
for (int i = 0; i < ITERATIONS; i++) {
a.aconc();
}
for (int i = 0; i < ITERATIONS; i++) {
a.aseq();
}
for (int i = 0; i < ITERATIONS; i++) {
a.conc();
}
a.sync();
asserts(a, ".aseq()");
asserts(a, ".aconc()");
asserts(a, ".conc()");
}

private void asserts(A a, String methodName) {
assertTrue("Tracking should be enabled", a.isTracking());
assertEquals("There should be one user", 1, a.getTrackedUsers().length);
POPTrackingMethod method = a.getTracked().getCalls().stream()
.filter(m -> m.getMethod().contains(methodName))
.findFirst().get();
assertEquals("Iterations don't match", ITERATIONS, method.getNumCalls());
assertTrue("Time used should be positive", method.getTimeUsed() >= 0);
}

}
Loading

0 comments on commit a6b0c89

Please sign in to comment.