Package net.floodlightcontroller.devicemanager.internal.DeviceSyncRepresentation

Examples of net.floodlightcontroller.devicemanager.internal.DeviceSyncRepresentation.SyncEntity


    public void testSyncEntity() {
        Date d1 = new Date();
        Date d2 = new Date(0);
        Entity e1 = new Entity(1L, (short)2, 3, 4L, 5, d1);
        e1.setActiveSince(d2);
        SyncEntity se1 = new SyncEntity(e1);
        assertEntityEquals(e1, se1);
        assertEquals(1L, se1.macAddress);
        assertEquals(Short.valueOf((short)2), se1.vlan);
        assertEquals(Integer.valueOf(3), se1.ipv4Address);
        assertEquals(Long.valueOf(4L), se1.switchDPID);
        assertEquals(Integer.valueOf(5), se1.switchPort);
        assertEquals(d1, se1.lastSeenTimestamp);
        assertEquals(d2, se1.activeSince);
        assertNotSame(d1, se1.lastSeenTimestamp);
        assertNotSame(d2, se1.activeSince);

        Entity e2 = new Entity(42L, null, null, null, null, null);
        SyncEntity se2 = new SyncEntity(e2);
        assertEntityEquals(e2, se2);

        SyncEntity se3 = new SyncEntity();
        SyncEntity se4 = new SyncEntity();
        se3.lastSeenTimestamp = new Date(1000);
        se4.lastSeenTimestamp = new Date(2000);
        assertTrue("", se3.compareTo(se4) < 0);
        assertTrue("", se4.compareTo(se3) > 0);
        se4.lastSeenTimestamp = new Date(1000);
        assertTrue("", se3.compareTo(se4) == 0);
        assertTrue("", se4.compareTo(se3) == 0);
        se4.lastSeenTimestamp = new Date(500);
        assertTrue("", se3.compareTo(se4) > 0);
        assertTrue("", se4.compareTo(se3) < 0);
    }
View Full Code Here


        assertEquals("MyKey", dsr.toString());

        List<SyncEntity> entities = new ArrayList<SyncEntity>();
        Entity e1a = new Entity(1L, (short)2, 3, 4L, 5, new Date(1000));
        Entity e1b = new Entity(1L, (short)2, null, 4L, 5, new Date(0));
        entities.add(new SyncEntity(e1a));
        entities.add(new SyncEntity(e1b));
        // e1b comes before e1 (lastSeen) but we add it after it to test
        // sorting
        dsr.setEntities(entities);

        assertEquals(2, dsr.getEntities().size());
View Full Code Here

        // already master we won't read this device and it should be
        // removed from the store by the consolidate task
        Entity e3 = new Entity(3L, null, null, 1L, 1, null);
        dsr = new DeviceSyncRepresentation();
        dsr.setKey("Device3");
        dsr.setEntities(Collections.singletonList(new SyncEntity(e3)));
        storeClient.put(dsr.getKey(), dsr);

        // make sure it's in the store
        List<DeviceSyncRepresentation> entries = getEntriesFromStore();
        boolean found = false;
View Full Code Here

        // Now write a device to the store that doesn't have any switch-port
        // it should be removed
        Entity e3 = new Entity(3L, null, null, null, null, null);
        dsr.setKey("Device3");
        dsr.setEntities(Collections.singletonList(new SyncEntity(e3)));
        storeClient.put(dsr.getKey(), dsr);

        // Run consolitate again. This time we check that tombstones in
        // the store are handled correctly
        deviceManager.scheduleConsolidateStoreNow();
View Full Code Here

TOP

Related Classes of net.floodlightcontroller.devicemanager.internal.DeviceSyncRepresentation.SyncEntity

Copyright © 2018 www.massapicom. 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.