Search in sources :

Example 6 with AutoreleasePool

use of com.google.j2objc.annotations.AutoreleasePool in project j2objc by google.

the class RetainedWithTest method createMapChildren.

@AutoreleasePool
private void createMapChildren(MapFactory factory, List<Integer> objectCodes) {
    // Use separate maps for each of the views to ensure that each view type is strengthening its
    // reference to the map.
    Map m1 = factory.newMap();
    Map m2 = factory.newMap();
    Map m3 = factory.newMap();
    ValueType v = new ValueType();
    m1.put(factory.getKey(), v);
    m2.put(factory.getKey(), v);
    m3.put(factory.getKey(), v);
    keys = m1.keySet();
    values = m2.values();
    entrySet = m3.entrySet();
    objectCodes.add(System.identityHashCode(v));
}
Also used : IdentityHashMap(java.util.IdentityHashMap) EnumMap(java.util.EnumMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) TreeMap(java.util.TreeMap) Map(java.util.Map) WeakHashMap(java.util.WeakHashMap) AutoreleasePool(com.google.j2objc.annotations.AutoreleasePool)

Example 7 with AutoreleasePool

use of com.google.j2objc.annotations.AutoreleasePool in project j2objc by google.

the class MapsTest method testParseFromByteArray.

@AutoreleasePool
public void testParseFromByteArray() throws Exception {
    ExtensionRegistry registry = ExtensionRegistry.newInstance();
    MapMsg msg = MapMsg.parseFrom(ALL_MAPS_BYTES, registry);
    checkFields(msg);
}
Also used : MapMsg(protos.MapMsg) ExtensionRegistry(com.google.protobuf.ExtensionRegistry) AutoreleasePool(com.google.j2objc.annotations.AutoreleasePool)

Example 8 with AutoreleasePool

use of com.google.j2objc.annotations.AutoreleasePool in project j2objc by google.

the class JUnitTestRunner method run.

/**
 * Runs the test classes given in {@param classes}.
 * @returns Zero if all tests pass, non-zero otherwise.
 */
public static int run(Class<?>[] classes, RunListener listener) {
    JUnitCore junitCore = new JUnitCore();
    junitCore.addListener(listener);
    boolean hasError = false;
    for (@AutoreleasePool Class<?> c : classes) {
        Result result = junitCore.run(c);
        hasError = hasError || !result.wasSuccessful();
    }
    return hasError ? 1 : 0;
}
Also used : JUnitCore(org.junit.runner.JUnitCore) AutoreleasePool(com.google.j2objc.annotations.AutoreleasePool) Result(org.junit.runner.Result)

Example 9 with AutoreleasePool

use of com.google.j2objc.annotations.AutoreleasePool in project squidb by yahoo.

the class SquidbTestRunner method run.

/**
 * Runs the test classes given in {@param classes}.
 *
 * @returns Zero if all tests pass, non-zero otherwise.
 */
public static int run(Class[] classes, RunListener listener, PrintStream out) {
    JUnitCore junitCore = new JUnitCore();
    junitCore.addListener(listener);
    boolean hasError = false;
    int numTests = 0;
    int numFailures = 0;
    long start = System.currentTimeMillis();
    for (@AutoreleasePool Class c : classes) {
        out.println("Running " + c.getName());
        Result result = junitCore.run(c);
        numTests += result.getRunCount();
        numFailures += result.getFailureCount();
        hasError = hasError || !result.wasSuccessful();
    }
    long end = System.currentTimeMillis();
    out.println(String.format("Ran %d tests, %d failures. Total time: %s seconds", numTests, numFailures, NumberFormat.getInstance().format((double) (end - start) / 1000)));
    return hasError ? 1 : 0;
}
Also used : JUnitCore(org.junit.runner.JUnitCore) AutoreleasePool(com.google.j2objc.annotations.AutoreleasePool) Result(org.junit.runner.Result)

Aggregations

AutoreleasePool (com.google.j2objc.annotations.AutoreleasePool)9 ListEngineRecord (im.actor.runtime.storage.ListEngineRecord)4 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)2 JUnitCore (org.junit.runner.JUnitCore)2 Result (org.junit.runner.Result)2 ExtensionRegistry (com.google.protobuf.ExtensionRegistry)1 EncryptedCBCPackage (im.actor.core.network.mtp.entity.EncryptedCBCPackage)1 EncryptedPackage (im.actor.core.network.mtp.entity.EncryptedPackage)1 ProtoMessage (im.actor.core.network.mtp.entity.ProtoMessage)1 DataInput (im.actor.runtime.bser.DataInput)1 EnumMap (java.util.EnumMap)1 HashMap (java.util.HashMap)1 IdentityHashMap (java.util.IdentityHashMap)1 List (java.util.List)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 WeakHashMap (java.util.WeakHashMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 MapMsg (protos.MapMsg)1