Java 类com.android.volley.Request.Priority 实例源码

项目:GitHub    文件:RequestTest.java   
@Test public void compareTo() {
    int sequence = 0;
    TestRequest low = new TestRequest(Priority.LOW);
    low.setSequence(sequence++);
    TestRequest low2 = new TestRequest(Priority.LOW);
    low2.setSequence(sequence++);
    TestRequest high = new TestRequest(Priority.HIGH);
    high.setSequence(sequence++);
    TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
    immediate.setSequence(sequence++);

    // "Low" should sort higher because it's really processing order.
    assertTrue(low.compareTo(high) > 0);
    assertTrue(high.compareTo(low) < 0);
    assertTrue(low.compareTo(low2) < 0);
    assertTrue(low.compareTo(immediate) > 0);
    assertTrue(immediate.compareTo(high) < 0);
}
项目:GitHub    文件:RequestTest.java   
@Test public void compareTo() {
    int sequence = 0;
    TestRequest low = new TestRequest(Priority.LOW);
    low.setSequence(sequence++);
    TestRequest low2 = new TestRequest(Priority.LOW);
    low2.setSequence(sequence++);
    TestRequest high = new TestRequest(Priority.HIGH);
    high.setSequence(sequence++);
    TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
    immediate.setSequence(sequence++);

    // "Low" should sort higher because it's really processing order.
    assertTrue(low.compareTo(high) > 0);
    assertTrue(high.compareTo(low) < 0);
    assertTrue(low.compareTo(low2) < 0);
    assertTrue(low.compareTo(immediate) > 0);
    assertTrue(immediate.compareTo(high) < 0);
}
项目:Codeforces    文件:RequestTest.java   
@Test public void compareTo() {
    int sequence = 0;
    TestRequest low = new TestRequest(Priority.LOW);
    low.setSequence(sequence++);
    TestRequest low2 = new TestRequest(Priority.LOW);
    low2.setSequence(sequence++);
    TestRequest high = new TestRequest(Priority.HIGH);
    high.setSequence(sequence++);
    TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
    immediate.setSequence(sequence++);

    // "Low" should sort higher because it's really processing order.
    assertTrue(low.compareTo(high) > 0);
    assertTrue(high.compareTo(low) < 0);
    assertTrue(low.compareTo(low2) < 0);
    assertTrue(low.compareTo(immediate) > 0);
    assertTrue(immediate.compareTo(high) < 0);
}
项目:iosched-reader    文件:RequestQueueTest.java   
@Override
public NetworkResponse performRequest(Request<?> request) {
    Priority thisPriority = request.getPriority();
    int thisSequence = request.getSequence();

    int priorityDiff = thisPriority.compareTo(mLastPriority);

    // Should never experience a higher priority after a lower priority
    assertFalse(priorityDiff > 0);

    // If we're not transitioning to a new priority block, check sequence numbers
    if (priorityDiff == 0) {
        assertTrue(thisSequence > mLastSequence);
    }
    mLastSequence = thisSequence;
    mLastPriority = thisPriority;

    mSemaphore.release();
    return new NetworkResponse(new byte[16]);
}
项目:iosched-reader    文件:RequestTest.java   
public void testCompareTo() {
    int sequence = 0;
    TestRequest low = new TestRequest(Priority.LOW);
    low.setSequence(sequence++);
    TestRequest low2 = new TestRequest(Priority.LOW);
    low2.setSequence(sequence++);
    TestRequest high = new TestRequest(Priority.HIGH);
    high.setSequence(sequence++);
    TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
    immediate.setSequence(sequence++);

    // "Low" should sort higher because it's really processing order.
    assertTrue(low.compareTo(high) > 0);
    assertTrue(high.compareTo(low) < 0);
    assertTrue(low.compareTo(low2) < 0);
    assertTrue(low.compareTo(immediate) > 0);
    assertTrue(immediate.compareTo(high) < 0);
}
项目:VoV    文件:RequestTest.java   
@Test public void compareTo() {
    int sequence = 0;
    TestRequest low = new TestRequest(Priority.LOW);
    low.setSequence(sequence++);
    TestRequest low2 = new TestRequest(Priority.LOW);
    low2.setSequence(sequence++);
    TestRequest high = new TestRequest(Priority.HIGH);
    high.setSequence(sequence++);
    TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
    immediate.setSequence(sequence++);

    // "Low" should sort higher because it's really processing order.
    assertTrue(low.compareTo(high) > 0);
    assertTrue(high.compareTo(low) < 0);
    assertTrue(low.compareTo(low2) < 0);
    assertTrue(low.compareTo(immediate) > 0);
    assertTrue(immediate.compareTo(high) < 0);
}
项目:smconf-android    文件:RequestQueueTest.java   
@Override
public NetworkResponse performRequest(Request<?> request) {
    Priority thisPriority = request.getPriority();
    int thisSequence = request.getSequence();

    int priorityDiff = thisPriority.compareTo(mLastPriority);

    // Should never experience a higher priority after a lower priority
    assertFalse(priorityDiff > 0);

    // If we're not transitioning to a new priority block, check sequence numbers
    if (priorityDiff == 0) {
        assertTrue(thisSequence > mLastSequence);
    }
    mLastSequence = thisSequence;
    mLastPriority = thisPriority;

    mSemaphore.release();
    return new NetworkResponse(new byte[16]);
}
项目:smconf-android    文件:RequestTest.java   
public void testCompareTo() {
    int sequence = 0;
    TestRequest low = new TestRequest(Priority.LOW);
    low.setSequence(sequence++);
    TestRequest low2 = new TestRequest(Priority.LOW);
    low2.setSequence(sequence++);
    TestRequest high = new TestRequest(Priority.HIGH);
    high.setSequence(sequence++);
    TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
    immediate.setSequence(sequence++);

    // "Low" should sort higher because it's really processing order.
    assertTrue(low.compareTo(high) > 0);
    assertTrue(high.compareTo(low) < 0);
    assertTrue(low.compareTo(low2) < 0);
    assertTrue(low.compareTo(immediate) > 0);
    assertTrue(immediate.compareTo(high) < 0);
}
项目:volley    文件:RequestTest.java   
@Test public void compareTo() {
    int sequence = 0;
    TestRequest low = new TestRequest(Priority.LOW);
    low.setSequence(sequence++);
    TestRequest low2 = new TestRequest(Priority.LOW);
    low2.setSequence(sequence++);
    TestRequest high = new TestRequest(Priority.HIGH);
    high.setSequence(sequence++);
    TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
    immediate.setSequence(sequence++);

    // "Low" should sort higher because it's really processing order.
    assertTrue(low.compareTo(high) > 0);
    assertTrue(high.compareTo(low) < 0);
    assertTrue(low.compareTo(low2) < 0);
    assertTrue(low.compareTo(immediate) > 0);
    assertTrue(immediate.compareTo(high) < 0);
}
项目:InfoQ-Android-App    文件:RequestTest.java   
@Test public void compareTo() {
    int sequence = 0;
    TestRequest low = new TestRequest(Priority.LOW);
    low.setSequence(sequence++);
    TestRequest low2 = new TestRequest(Priority.LOW);
    low2.setSequence(sequence++);
    TestRequest high = new TestRequest(Priority.HIGH);
    high.setSequence(sequence++);
    TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
    immediate.setSequence(sequence++);

    // "Low" should sort higher because it's really processing order.
    assertTrue(low.compareTo(high) > 0);
    assertTrue(high.compareTo(low) < 0);
    assertTrue(low.compareTo(low2) < 0);
    assertTrue(low.compareTo(immediate) > 0);
    assertTrue(immediate.compareTo(high) < 0);
}
项目:volley-public-key-pinning    文件:RequestTest.java   
@Test public void compareTo() {
    int sequence = 0;
    TestRequest low = new TestRequest(Priority.LOW);
    low.setSequence(sequence++);
    TestRequest low2 = new TestRequest(Priority.LOW);
    low2.setSequence(sequence++);
    TestRequest high = new TestRequest(Priority.HIGH);
    high.setSequence(sequence++);
    TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
    immediate.setSequence(sequence++);

    // "Low" should sort higher because it's really processing order.
    assertTrue(low.compareTo(high) > 0);
    assertTrue(high.compareTo(low) < 0);
    assertTrue(low.compareTo(low2) < 0);
    assertTrue(low.compareTo(immediate) > 0);
    assertTrue(immediate.compareTo(high) < 0);
}
项目:device-database    文件:RequestTest.java   
@Test public void compareTo() {
    int sequence = 0;
    TestRequest low = new TestRequest(Priority.LOW);
    low.setSequence(sequence++);
    TestRequest low2 = new TestRequest(Priority.LOW);
    low2.setSequence(sequence++);
    TestRequest high = new TestRequest(Priority.HIGH);
    high.setSequence(sequence++);
    TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
    immediate.setSequence(sequence++);

    // "Low" should sort higher because it's really processing order.
    assertTrue(low.compareTo(high) > 0);
    assertTrue(high.compareTo(low) < 0);
    assertTrue(low.compareTo(low2) < 0);
    assertTrue(low.compareTo(immediate) > 0);
    assertTrue(immediate.compareTo(high) < 0);
}
项目:ShoppingApp    文件:RequestTest.java   
@Test public void compareTo() {
    int sequence = 0;
    TestRequest low = new TestRequest(Priority.LOW);
    low.setSequence(sequence++);
    TestRequest low2 = new TestRequest(Priority.LOW);
    low2.setSequence(sequence++);
    TestRequest high = new TestRequest(Priority.HIGH);
    high.setSequence(sequence++);
    TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
    immediate.setSequence(sequence++);

    // "Low" should sort higher because it's really processing order.
    assertTrue(low.compareTo(high) > 0);
    assertTrue(high.compareTo(low) < 0);
    assertTrue(low.compareTo(low2) < 0);
    assertTrue(low.compareTo(immediate) > 0);
    assertTrue(immediate.compareTo(high) < 0);
}
项目:2015-Google-I-O-app    文件:RequestQueueTest.java   
@Override
public NetworkResponse performRequest(Request<?> request) {
    Priority thisPriority = request.getPriority();
    int thisSequence = request.getSequence();

    int priorityDiff = thisPriority.compareTo(mLastPriority);

    // Should never experience a higher priority after a lower priority
    assertFalse(priorityDiff > 0);

    // If we're not transitioning to a new priority block, check sequence numbers
    if (priorityDiff == 0) {
        assertTrue(thisSequence > mLastSequence);
    }
    mLastSequence = thisSequence;
    mLastPriority = thisPriority;

    mSemaphore.release();
    return new NetworkResponse(new byte[16]);
}
项目:2015-Google-I-O-app    文件:RequestTest.java   
public void testCompareTo() {
    int sequence = 0;
    TestRequest low = new TestRequest(Priority.LOW);
    low.setSequence(sequence++);
    TestRequest low2 = new TestRequest(Priority.LOW);
    low2.setSequence(sequence++);
    TestRequest high = new TestRequest(Priority.HIGH);
    high.setSequence(sequence++);
    TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
    immediate.setSequence(sequence++);

    // "Low" should sort higher because it's really processing order.
    assertTrue(low.compareTo(high) > 0);
    assertTrue(high.compareTo(low) < 0);
    assertTrue(low.compareTo(low2) < 0);
    assertTrue(low.compareTo(immediate) > 0);
    assertTrue(immediate.compareTo(high) < 0);
}
项目:Simplified-Zhihu-Daily    文件:RequestTest.java   
@Test public void compareTo() {
    int sequence = 0;
    TestRequest low = new TestRequest(Priority.LOW);
    low.setSequence(sequence++);
    TestRequest low2 = new TestRequest(Priority.LOW);
    low2.setSequence(sequence++);
    TestRequest high = new TestRequest(Priority.HIGH);
    high.setSequence(sequence++);
    TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
    immediate.setSequence(sequence++);

    // "Low" should sort higher because it's really processing order.
    assertTrue(low.compareTo(high) > 0);
    assertTrue(high.compareTo(low) < 0);
    assertTrue(low.compareTo(low2) < 0);
    assertTrue(low.compareTo(immediate) > 0);
    assertTrue(immediate.compareTo(high) < 0);
}
项目:TastySnake    文件:RequestTest.java   
@Test public void compareTo() {
    int sequence = 0;
    TestRequest low = new TestRequest(Priority.LOW);
    low.setSequence(sequence++);
    TestRequest low2 = new TestRequest(Priority.LOW);
    low2.setSequence(sequence++);
    TestRequest high = new TestRequest(Priority.HIGH);
    high.setSequence(sequence++);
    TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
    immediate.setSequence(sequence++);

    // "Low" should sort higher because it's really processing order.
    assertTrue(low.compareTo(high) > 0);
    assertTrue(high.compareTo(low) < 0);
    assertTrue(low.compareTo(low2) < 0);
    assertTrue(low.compareTo(immediate) > 0);
    assertTrue(immediate.compareTo(high) < 0);
}
项目:SaveVolley    文件:RequestTest.java   
@Test public void compareTo() {
    int sequence = 0;
    TestRequest low = new TestRequest(Priority.LOW);
    low.setSequence(sequence++);
    TestRequest low2 = new TestRequest(Priority.LOW);
    low2.setSequence(sequence++);
    TestRequest high = new TestRequest(Priority.HIGH);
    high.setSequence(sequence++);
    TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
    immediate.setSequence(sequence++);

    // "Low" should sort higher because it's really processing order.
    assertTrue(low.compareTo(high) > 0);
    assertTrue(high.compareTo(low) < 0);
    assertTrue(low.compareTo(low2) < 0);
    assertTrue(low.compareTo(immediate) > 0);
    assertTrue(immediate.compareTo(high) < 0);
}
项目:Jacket-    文件:RequestTest.java   
@Test public void compareTo() {
    int sequence = 0;
    TestRequest low = new TestRequest(Priority.LOW);
    low.setSequence(sequence++);
    TestRequest low2 = new TestRequest(Priority.LOW);
    low2.setSequence(sequence++);
    TestRequest high = new TestRequest(Priority.HIGH);
    high.setSequence(sequence++);
    TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
    immediate.setSequence(sequence++);

    // "Low" should sort higher because it's really processing order.
    assertTrue(low.compareTo(high) > 0);
    assertTrue(high.compareTo(low) < 0);
    assertTrue(low.compareTo(low2) < 0);
    assertTrue(low.compareTo(immediate) > 0);
    assertTrue(immediate.compareTo(high) < 0);
}
项目:android-project-wo2b    文件:RequestQueueTest.java   
@Override
public NetworkResponse performRequest(Request<?> request) {
    Priority thisPriority = request.getPriority();
    int thisSequence = request.getSequence();

    int priorityDiff = thisPriority.compareTo(mLastPriority);

    // Should never experience a higher priority after a lower priority
    assertFalse(priorityDiff > 0);

    // If we're not transitioning to a new priority block, check sequence numbers
    if (priorityDiff == 0) {
        assertTrue(thisSequence > mLastSequence);
    }
    mLastSequence = thisSequence;
    mLastPriority = thisPriority;

    mSemaphore.release();
    return new NetworkResponse(new byte[16]);
}
项目:android-project-wo2b    文件:RequestTest.java   
public void testCompareTo() {
    int sequence = 0;
    TestRequest low = new TestRequest(Priority.LOW);
    low.setSequence(sequence++);
    TestRequest low2 = new TestRequest(Priority.LOW);
    low2.setSequence(sequence++);
    TestRequest high = new TestRequest(Priority.HIGH);
    high.setSequence(sequence++);
    TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
    immediate.setSequence(sequence++);

    // "Low" should sort higher because it's really processing order.
    assertTrue(low.compareTo(high) > 0);
    assertTrue(high.compareTo(low) < 0);
    assertTrue(low.compareTo(low2) < 0);
    assertTrue(low.compareTo(immediate) > 0);
    assertTrue(immediate.compareTo(high) < 0);
}
项目:FMTech    文件:RequestQueueTest.java   
@Override
public NetworkResponse performRequest(Request<?> request) {
    Priority thisPriority = request.getPriority();
    int thisSequence = request.getSequence();

    int priorityDiff = thisPriority.compareTo(mLastPriority);

    // Should never experience a higher priority after a lower priority
    assertFalse(priorityDiff > 0);

    // If we're not transitioning to a new priority block, check sequence numbers
    if (priorityDiff == 0) {
        assertTrue(thisSequence > mLastSequence);
    }
    mLastSequence = thisSequence;
    mLastPriority = thisPriority;

    mSemaphore.release();
    return new NetworkResponse(new byte[16]);
}
项目:FMTech    文件:RequestTest.java   
public void testCompareTo() {
    int sequence = 0;
    TestRequest low = new TestRequest(Priority.LOW);
    low.setSequence(sequence++);
    TestRequest low2 = new TestRequest(Priority.LOW);
    low2.setSequence(sequence++);
    TestRequest high = new TestRequest(Priority.HIGH);
    high.setSequence(sequence++);
    TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
    immediate.setSequence(sequence++);

    // "Low" should sort higher because it's really processing order.
    assertTrue(low.compareTo(high) > 0);
    assertTrue(high.compareTo(low) < 0);
    assertTrue(low.compareTo(low2) < 0);
    assertTrue(low.compareTo(immediate) > 0);
    assertTrue(immediate.compareTo(high) < 0);
}
项目:AzureML_Recommend_Android    文件:RequestTest.java   
@Test public void compareTo() {
    int sequence = 0;
    TestRequest low = new TestRequest(Priority.LOW);
    low.setSequence(sequence++);
    TestRequest low2 = new TestRequest(Priority.LOW);
    low2.setSequence(sequence++);
    TestRequest high = new TestRequest(Priority.HIGH);
    high.setSequence(sequence++);
    TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
    immediate.setSequence(sequence++);

    // "Low" should sort higher because it's really processing order.
    assertTrue(low.compareTo(high) > 0);
    assertTrue(high.compareTo(low) < 0);
    assertTrue(low.compareTo(low2) < 0);
    assertTrue(low.compareTo(immediate) > 0);
    assertTrue(immediate.compareTo(high) < 0);
}
项目:spark-android-SDK    文件:RequestTest.java   
@Test public void compareTo() {
    int sequence = 0;
    TestRequest low = new TestRequest(Priority.LOW);
    low.setSequence(sequence++);
    TestRequest low2 = new TestRequest(Priority.LOW);
    low2.setSequence(sequence++);
    TestRequest high = new TestRequest(Priority.HIGH);
    high.setSequence(sequence++);
    TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
    immediate.setSequence(sequence++);

    // "Low" should sort higher because it's really processing order.
    assertTrue(low.compareTo(high) > 0);
    assertTrue(high.compareTo(low) < 0);
    assertTrue(low.compareTo(low2) < 0);
    assertTrue(low.compareTo(immediate) > 0);
    assertTrue(immediate.compareTo(high) < 0);
}
项目:saarang-iosched    文件:RequestQueueTest.java   
@Override
public NetworkResponse performRequest(Request<?> request) {
    Priority thisPriority = request.getPriority();
    int thisSequence = request.getSequence();

    int priorityDiff = thisPriority.compareTo(mLastPriority);

    // Should never experience a higher priority after a lower priority
    assertFalse(priorityDiff > 0);

    // If we're not transitioning to a new priority block, check sequence numbers
    if (priorityDiff == 0) {
        assertTrue(thisSequence > mLastSequence);
    }
    mLastSequence = thisSequence;
    mLastPriority = thisPriority;

    mSemaphore.release();
    return new NetworkResponse(new byte[16]);
}
项目:saarang-iosched    文件:RequestTest.java   
public void testCompareTo() {
    int sequence = 0;
    TestRequest low = new TestRequest(Priority.LOW);
    low.setSequence(sequence++);
    TestRequest low2 = new TestRequest(Priority.LOW);
    low2.setSequence(sequence++);
    TestRequest high = new TestRequest(Priority.HIGH);
    high.setSequence(sequence++);
    TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
    immediate.setSequence(sequence++);

    // "Low" should sort higher because it's really processing order.
    assertTrue(low.compareTo(high) > 0);
    assertTrue(high.compareTo(low) < 0);
    assertTrue(low.compareTo(low2) < 0);
    assertTrue(low.compareTo(immediate) > 0);
    assertTrue(immediate.compareTo(high) < 0);
}
项目:proximity-manager    文件:RequestTest.java   
@Test public void compareTo() {
    int sequence = 0;
    TestRequest low = new TestRequest(Priority.LOW);
    low.setSequence(sequence++);
    TestRequest low2 = new TestRequest(Priority.LOW);
    low2.setSequence(sequence++);
    TestRequest high = new TestRequest(Priority.HIGH);
    high.setSequence(sequence++);
    TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
    immediate.setSequence(sequence++);

    // "Low" should sort higher because it's really processing order.
    assertTrue(low.compareTo(high) > 0);
    assertTrue(high.compareTo(low) < 0);
    assertTrue(low.compareTo(low2) < 0);
    assertTrue(low.compareTo(immediate) > 0);
    assertTrue(immediate.compareTo(high) < 0);
}
项目:AppDevFestSudeste2015    文件:RequestQueueTest.java   
@Override
public NetworkResponse performRequest(Request<?> request) {
    Priority thisPriority = request.getPriority();
    int thisSequence = request.getSequence();

    int priorityDiff = thisPriority.compareTo(mLastPriority);

    // Should never experience a higher priority after a lower priority
    assertFalse(priorityDiff > 0);

    // If we're not transitioning to a new priority block, check sequence numbers
    if (priorityDiff == 0) {
        assertTrue(thisSequence > mLastSequence);
    }
    mLastSequence = thisSequence;
    mLastPriority = thisPriority;

    mSemaphore.release();
    return new NetworkResponse(new byte[16]);
}
项目:AppDevFestSudeste2015    文件:RequestTest.java   
public void testCompareTo() {
    int sequence = 0;
    TestRequest low = new TestRequest(Priority.LOW);
    low.setSequence(sequence++);
    TestRequest low2 = new TestRequest(Priority.LOW);
    low2.setSequence(sequence++);
    TestRequest high = new TestRequest(Priority.HIGH);
    high.setSequence(sequence++);
    TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
    immediate.setSequence(sequence++);

    // "Low" should sort higher because it's really processing order.
    assertTrue(low.compareTo(high) > 0);
    assertTrue(high.compareTo(low) < 0);
    assertTrue(low.compareTo(low2) < 0);
    assertTrue(low.compareTo(immediate) > 0);
    assertTrue(immediate.compareTo(high) < 0);
}
项目:JJCamera    文件:RequestQueueTest.java   
@Override
public NetworkResponse performRequest(Request<?> request) {
    Priority thisPriority = request.getPriority();
    int thisSequence = request.getSequence();

    int priorityDiff = thisPriority.compareTo(mLastPriority);

    // Should never experience a higher priority after a lower priority
    assertFalse(priorityDiff > 0);

    // If we're not transitioning to a new priority block, check sequence numbers
    if (priorityDiff == 0) {
        assertTrue(thisSequence > mLastSequence);
    }
    mLastSequence = thisSequence;
    mLastPriority = thisPriority;

    mSemaphore.release();
    return new NetworkResponse(new byte[16]);
}
项目:JJCamera    文件:RequestTest.java   
public void testCompareTo() {
    int sequence = 0;
    TestRequest low = new TestRequest(Priority.LOW);
    low.setSequence(sequence++);
    TestRequest low2 = new TestRequest(Priority.LOW);
    low2.setSequence(sequence++);
    TestRequest high = new TestRequest(Priority.HIGH);
    high.setSequence(sequence++);
    TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
    immediate.setSequence(sequence++);

    // "Low" should sort higher because it's really processing order.
    assertTrue(low.compareTo(high) > 0);
    assertTrue(high.compareTo(low) < 0);
    assertTrue(low.compareTo(low2) < 0);
    assertTrue(low.compareTo(immediate) > 0);
    assertTrue(immediate.compareTo(high) < 0);
}
项目:android-discourse    文件:RequestQueueTest.java   
@Override
public NetworkResponse performRequest(Request<?> request) {
    Priority thisPriority = request.getPriority();
    int thisSequence = request.getSequence();

    int priorityDiff = thisPriority.compareTo(mLastPriority);

    // Should never experience a higher priority after a lower priority
    assertFalse(priorityDiff > 0);

    // If we're not transitioning to a new priority block, check sequence numbers
    if (priorityDiff == 0) {
        assertTrue(thisSequence > mLastSequence);
    }
    mLastSequence = thisSequence;
    mLastPriority = thisPriority;

    mSemaphore.release();
    return new NetworkResponse(new byte[16]);
}
项目:android-discourse    文件:RequestTest.java   
public void testCompareTo() {
    int sequence = 0;
    TestRequest low = new TestRequest(Priority.LOW);
    low.setSequence(sequence++);
    TestRequest low2 = new TestRequest(Priority.LOW);
    low2.setSequence(sequence++);
    TestRequest high = new TestRequest(Priority.HIGH);
    high.setSequence(sequence++);
    TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
    immediate.setSequence(sequence++);

    // "Low" should sort higher because it's really processing order.
    assertTrue(low.compareTo(high) > 0);
    assertTrue(high.compareTo(low) < 0);
    assertTrue(low.compareTo(low2) < 0);
    assertTrue(low.compareTo(immediate) > 0);
    assertTrue(immediate.compareTo(high) < 0);
}
项目:product-emm    文件:RequestTest.java   
@Test public void compareTo() {
    int sequence = 0;
    TestRequest low = new TestRequest(Priority.LOW);
    low.setSequence(sequence++);
    TestRequest low2 = new TestRequest(Priority.LOW);
    low2.setSequence(sequence++);
    TestRequest high = new TestRequest(Priority.HIGH);
    high.setSequence(sequence++);
    TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
    immediate.setSequence(sequence++);

    // "Low" should sort higher because it's really processing order.
    assertTrue(low.compareTo(high) > 0);
    assertTrue(high.compareTo(low) < 0);
    assertTrue(low.compareTo(low2) < 0);
    assertTrue(low.compareTo(immediate) > 0);
    assertTrue(immediate.compareTo(high) < 0);
}
项目:product-emm    文件:RequestTest.java   
@Test public void compareTo() {
    int sequence = 0;
    TestRequest low = new TestRequest(Priority.LOW);
    low.setSequence(sequence++);
    TestRequest low2 = new TestRequest(Priority.LOW);
    low2.setSequence(sequence++);
    TestRequest high = new TestRequest(Priority.HIGH);
    high.setSequence(sequence++);
    TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
    immediate.setSequence(sequence++);

    // "Low" should sort higher because it's really processing order.
    assertTrue(low.compareTo(high) > 0);
    assertTrue(high.compareTo(low) < 0);
    assertTrue(low.compareTo(low2) < 0);
    assertTrue(low.compareTo(immediate) > 0);
    assertTrue(immediate.compareTo(high) < 0);
}
项目:iosched    文件:RequestQueueTest.java   
@Override
public NetworkResponse performRequest(Request<?> request) {
    Priority thisPriority = request.getPriority();
    int thisSequence = request.getSequence();

    int priorityDiff = thisPriority.compareTo(mLastPriority);

    // Should never experience a higher priority after a lower priority
    assertFalse(priorityDiff > 0);

    // If we're not transitioning to a new priority block, check sequence numbers
    if (priorityDiff == 0) {
        assertTrue(thisSequence > mLastSequence);
    }
    mLastSequence = thisSequence;
    mLastPriority = thisPriority;

    mSemaphore.release();
    return new NetworkResponse(new byte[16]);
}
项目:iosched    文件:RequestTest.java   
public void testCompareTo() {
    int sequence = 0;
    TestRequest low = new TestRequest(Priority.LOW);
    low.setSequence(sequence++);
    TestRequest low2 = new TestRequest(Priority.LOW);
    low2.setSequence(sequence++);
    TestRequest high = new TestRequest(Priority.HIGH);
    high.setSequence(sequence++);
    TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
    immediate.setSequence(sequence++);

    // "Low" should sort higher because it's really processing order.
    assertTrue(low.compareTo(high) > 0);
    assertTrue(high.compareTo(low) < 0);
    assertTrue(low.compareTo(low2) < 0);
    assertTrue(low.compareTo(immediate) > 0);
    assertTrue(immediate.compareTo(high) < 0);
}
项目:devfestnorte-app    文件:RequestQueueTest.java   
@Override
public NetworkResponse performRequest(Request<?> request) {
    Priority thisPriority = request.getPriority();
    int thisSequence = request.getSequence();

    int priorityDiff = thisPriority.compareTo(mLastPriority);

    // Should never experience a higher priority after a lower priority
    assertFalse(priorityDiff > 0);

    // If we're not transitioning to a new priority block, check sequence numbers
    if (priorityDiff == 0) {
        assertTrue(thisSequence > mLastSequence);
    }
    mLastSequence = thisSequence;
    mLastPriority = thisPriority;

    mSemaphore.release();
    return new NetworkResponse(new byte[16]);
}
项目:devfestnorte-app    文件:RequestTest.java   
public void testCompareTo() {
    int sequence = 0;
    TestRequest low = new TestRequest(Priority.LOW);
    low.setSequence(sequence++);
    TestRequest low2 = new TestRequest(Priority.LOW);
    low2.setSequence(sequence++);
    TestRequest high = new TestRequest(Priority.HIGH);
    high.setSequence(sequence++);
    TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
    immediate.setSequence(sequence++);

    // "Low" should sort higher because it's really processing order.
    assertTrue(low.compareTo(high) > 0);
    assertTrue(high.compareTo(low) < 0);
    assertTrue(low.compareTo(low2) < 0);
    assertTrue(low.compareTo(immediate) > 0);
    assertTrue(immediate.compareTo(high) < 0);
}