Examples of Pilot


Examples of com.mobixess.jodb.tests.testobjects.Pilot

        testFile.delete();
        JODBSessionContainer sessionContainer = getContainerForFile(testFile);
        Random random = new Random(19287);
        for (int i = 0; i < 1000; i++) {
            int next = random.nextInt(1000);
            Pilot pilot = new Pilot(next, "Name"+i);
            sessionContainer.set(pilot);
        }
       
        sessionContainer.commit();
       
        if(reopen){
            sessionContainer.close();
            sessionContainer = getContainerForFile(testFile);
        }
       
        Predicate<Pilot> predicate= new Predicate<Pilot>() {
            public boolean match(Pilot pilot) {
                return pilot.getPoints() > 100 && pilot.getPoints() < 500 && pilot.getName().startsWith("Nam");
            }
        };
       
        if(_checkOptimization && !sessionContainer.isOptimizedQuery(predicate, null)){
            throw new RuntimeException();
        }
       
        ObjectSet<Pilot> pilots = sessionContainer.query(predicate);
       
        if(pilots.size() == 0){
            throw new RuntimeException();
        }
       
        while (pilots.hasNext()) {
            if(pilots.next().getPoints()<=100){
                throw new RuntimeException();
            }
        }
        if(reopen){
            sessionContainer.close();
            sessionContainer = getContainerForFile(testFile);
        }
       
        predicate= new Predicate<Pilot>() {
            public boolean match(Pilot pilot) {
                return pilot.getPoints() > 100 && pilot.getPoints() < 500 && pilot._name.startsWith("Nam");
            }
        };
       
        if(_checkOptimization && !sessionContainer.isOptimizedQuery(predicate, null)){
            throw new RuntimeException();
View Full Code Here

Examples of de.linwave.tutorial.Pilot

    assertNotNull(db);
    db.deleteClass(Pilot.class);
  }
 
  public void testStoreFirstPilot() {
    Pilot pilot1 = new Pilot("Michael Schumacher", 100);
    Long oid1 = db.store(pilot1);
    Pilot pilot2 = new Pilot("Rubens Barrichello", 99);
    Long oid2 = db.store(pilot2);

    assertTrue(oid1 != 0);
    assertTrue(oid2 != 0);
    assertTrue(oid2 > oid1);
View Full Code Here

Examples of de.linwave.tutorial.Pilot

    Long diff = new Long(oid2)-1;
    assertEquals(oid1, diff);
  }

  public void testRetrieveAllPilotQBE() {
    Pilot proto = new Pilot(null, 0);
    ObjectSet<Pilot> result = db.queryByExample(proto);
    assertEquals(2, result.size());
  }
View Full Code Here

Examples of de.linwave.tutorial.Pilot

    ObjectSet<Pilot> result = db.queryByExample(Pilot.class);
    assertEquals(2, result.size());
  }

  public void testRetrievePilotByName() {
    Pilot proto = new Pilot("Michael Schumacher", 0);
    ObjectSet<Pilot> result = db.queryByExample(proto);
    assertEquals(1, result.size());
  }
View Full Code Here

Examples of de.linwave.tutorial.Pilot

    ObjectSet<Pilot> result = db.queryByExample(proto);
    assertEquals(1, result.size());
  }

  public void testRetrievePilotByExactPoints() {
    Pilot proto = new Pilot(null, 100);
    ObjectSet<Pilot> result = db.queryByExample(proto);
    assertEquals(1, result.size());
  }
View Full Code Here

Examples of de.linwave.tutorial.Pilot

    ObjectSet<Pilot> result = db.queryByExample(proto);
    assertEquals(1, result.size());
  }

  public void testUpdatePilot() {
    ObjectSet<Pilot> result = db.queryByExample(new Pilot("Michael Schumacher", 0));
    Pilot found = (Pilot) result.next();
    found.addPoints(11);
    int newPoints = found.getPoints();
    db.store(found);
    System.out.println("Added 11 points for " + found);
    testRetrieveAllPilots();
   
    result = db.queryByExample(new Pilot("Michael Schumacher", newPoints));
    found = (Pilot) result.next();
    assertNotNull(found);
    assertEquals(newPoints, found.getPoints());
  }
View Full Code Here

Examples of de.linwave.tutorial.Pilot

    assertNotNull(found);
    assertEquals(newPoints, found.getPoints());
  }

  public void testDeleteFirstPilotByName() {
    ObjectSet<Pilot> result = db.queryByExample(new Pilot("Michael Schumacher", 0));
    Pilot found = (Pilot) result.next();
    db.delete(found);
    System.out.println("Deleted " + found);
    result = db.queryByExample(Pilot.class);
    assertEquals(1, result.size());
  }
View Full Code Here

Examples of de.linwave.tutorial.Pilot

    result = db.queryByExample(Pilot.class);
    assertEquals(1, result.size());
  }

  public void testDeleteSecondPilotByName() {
    ObjectSet<Pilot> result = db.queryByExample(new Pilot("Rubens Barrichello", 0));
    Pilot found = (Pilot) result.next();
    db.delete(found);
    System.out.println("Deleted " + found);
    result = db.queryByExample(Pilot.class);
    assertEquals(0, result.size());
  }
View Full Code Here

Examples of lejos.navigation.Pilot

  PilotPositionTracker tracker;
  private Pilot p;
  protected void setUp() throws Exception {
    tracker = new PilotPositionTracker(5f,10f,0,2);
    p=new Pilot(5f,10f,Motor.A,Motor.C);
  }
View Full Code Here

Examples of lejos.navigation.Pilot

public class TestPilot extends TestCase {
  Pilot p;
  @Override
  protected void setUp() throws Exception {
    p=new Pilot(5f,10f,Motor.A,Motor.C);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.