@Test public void testKProjectModified() { KProject kproj = new KProjectImpl(); KProjectChangeLog dirtyLog = new KProjectChangeLog(); kproj.setListener(dirtyLog); assertFalse(dirtyLog.isKProjectDirty()); kproj.setKProjectPath("src/main/resources/"); kproj.setKBasesPath("src/kbases"); assertTrue(dirtyLog.isKProjectDirty()); }
@Test public void testKSessionModified() { KProject kproj = new KProjectImpl(); KProjectChangeLog dirtyLog = new KProjectChangeLog(); kproj.setListener(dirtyLog); assertFalse(dirtyLog.isKProjectDirty()); KBase kbase1 = kproj.newKBase("org.test1", "KBase1"); KSession kSession = kbase1.newKSession("org.test1", "KSession1"); kSession.setClockType(ClockTypeOption.get("pseudo")); kSession.setType("stateless"); kSession.setClockType(ClockTypeOption.get("realtime")); assertTrue(dirtyLog.getAddedKSessions().contains("org.test1.KSession1")); dirtyLog.reset(); kSession.setType("stateful"); assertTrue(dirtyLog.getAddedKSessions().contains("org.test1.KSession1")); kbase1.removeKSession(kSession.getQName()); assertFalse(dirtyLog.getAddedKSessions().contains("org.test1.KSession1")); assertTrue(dirtyLog.getRemovedKSessions().contains("org.test1.KSession1")); }
@Test public void testKSessioExistsnQNameModified() { KProject kproj = new KProjectImpl(); KProjectChangeLog dirtyLog = new KProjectChangeLog(); kproj.setListener(dirtyLog); assertFalse(dirtyLog.isKProjectDirty()); KBase kbase1 = kproj.newKBase("org.test1", "KBase1"); KSession kSession = kbase1.newKSession("org.test1", "KSession1"); dirtyLog.reset(); kSession.setNamespace("org.test2"); assertTrue(dirtyLog.getAddedKSessions().contains("org.test2.KSession1")); assertTrue(dirtyLog.getRemovedKSessions().contains("org.test1.KSession1")); kSession.setName("KSession2"); assertTrue(dirtyLog.getRemovedKSessions().contains("org.test2.KSession1")); assertTrue(dirtyLog.getRemovedKSessions().contains("org.test1.KSession1")); assertTrue(dirtyLog.getAddedKSessions().contains("org.test2.KSession2")); }