Search in sources :

Example 6 with ApplicationPath

use of il.ac.technion.cs.smarthouse.system.applications.installer.ApplicationPath in project Smartcity-Smarthouse by TechnionYP5777.

the class ApplicationsCoreTest method stupidApplicationManagerTest.

@Test
public void stupidApplicationManagerTest() {
    ApplicationManager m1 = new ApplicationManager(null, new ApplicationPath(PathType.CLASS_NAME, APP1_CLASSPATH));
    ApplicationManager m2 = new ApplicationManager(null, new ApplicationPath(PathType.CLASS_NAME, APP1_CLASSPATH));
    ApplicationManager m3 = new ApplicationManager("XXX", new ApplicationPath(PathType.CLASS_NAME, APP1_CLASSPATH));
    assert m1.equals(m2);
    assert m2.equals(m1);
    assert !m1.equals(m3);
    assert !m3.equals(m1);
    assert !m2.equals(m3);
    assert !m3.equals(m2);
    assert !m1.equals(null);
    assert !m1.equals("Bla");
    Assert.assertEquals(m1.hashCode(), m2.hashCode());
    Assert.assertNotEquals(m1.hashCode(), m3.hashCode());
    Assert.assertNotEquals(m2.hashCode(), m3.hashCode());
    Assert.assertNull(m1.getApplicationName());
}
Also used : ApplicationPath(il.ac.technion.cs.smarthouse.system.applications.installer.ApplicationPath) Test(org.junit.Test)

Example 7 with ApplicationPath

use of il.ac.technion.cs.smarthouse.system.applications.installer.ApplicationPath in project Smartcity-Smarthouse by TechnionYP5777.

the class ApplicationsCoreTest method savebleTest.

@Test
public void savebleTest() throws Exception {
    Assert.assertNotNull(appCore.addApplication(new ApplicationPath(PathType.CLASS_NAME, APP1_CLASSPATH)));
    ApplicationsCore appCoreNew = new SystemCore().getSystemApplicationsHandler();
    appCoreNew.populate(appCore.toJsonString());
    assert !appCoreNew.getApplicationManagers().isEmpty();
    Assert.assertEquals(appCoreNew.getInstalledApplicationNames().stream().filter(n -> n.equals(APP1_CLASS.getName())).count(), 1);
}
Also used : SystemCore(il.ac.technion.cs.smarthouse.system.SystemCore) ApplicationPath(il.ac.technion.cs.smarthouse.system.applications.installer.ApplicationPath) Test(org.junit.Test)

Aggregations

ApplicationPath (il.ac.technion.cs.smarthouse.system.applications.installer.ApplicationPath)7 Test (org.junit.Test)4 SystemCore (il.ac.technion.cs.smarthouse.system.SystemCore)1 MainSystemGui (il.ac.technion.cs.smarthouse.system.gui.main_system.MainSystemGui)1 BoolLatch (il.ac.technion.cs.smarthouse.utils.BoolLatch)1