-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
92 changed files
with
2,030 additions
and
430 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
workspace/popjava/src/junit/localtests/accounting/AccountingAPITest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
96 changes: 96 additions & 0 deletions
96
workspace/popjava/src/junit/localtests/accounting/AccountingTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
} |
Oops, something went wrong.