diff --git a/YACOSTest/.classpath b/YACOSTest/.classpath new file mode 100644 index 0000000..50ad62b --- /dev/null +++ b/YACOSTest/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/YACOSTest/.project b/YACOSTest/.project new file mode 100644 index 0000000..5fc9d0d --- /dev/null +++ b/YACOSTest/.project @@ -0,0 +1,17 @@ + + + YACOSTest + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/YACOSTest/src/org/yacos/tests/core/TestConferenceManager.java b/YACOSTest/src/org/yacos/tests/core/TestConferenceManager.java new file mode 100644 index 0000000..03c2925 --- /dev/null +++ b/YACOSTest/src/org/yacos/tests/core/TestConferenceManager.java @@ -0,0 +1,24 @@ +package org.yacos.tests.core; + +import org.junit.Before; +import org.junit.BeforeClass; +import org.yacos.core.conferences.Conference; +import org.yacos.core.conferences.ConferenceManagerBean; +import org.yacos.core.conferences.IConferenceManager; + + +public class TestConferenceManager { + IConferenceManager conferenceManager; + + @BeforeClass + public void setUpManager() { + conferenceManager = new ConferenceManagerBean(); + } + + @Before + public void setUpConferences() { + conferenceManager.getConferences(); + Conference conf = new Conference(); + conferenceManager.addConference(conf); + } +} diff --git a/YACOSTest/src/org/yacos/tests/core/TestRole.java b/YACOSTest/src/org/yacos/tests/core/TestRole.java new file mode 100644 index 0000000..01c157e --- /dev/null +++ b/YACOSTest/src/org/yacos/tests/core/TestRole.java @@ -0,0 +1,15 @@ +/** + * + */ +package org.yacos.tests.core; + + +/** + * @author christiancorsano + * + */ +public class TestRole { + public void aRoleShouldBeUnique(){ + // TODO : look for roles of the same type, same user and same conference + } +} diff --git a/YACOSTest/src/org/yacos/tests/core/TestUser.java b/YACOSTest/src/org/yacos/tests/core/TestUser.java new file mode 100644 index 0000000..61cfd89 --- /dev/null +++ b/YACOSTest/src/org/yacos/tests/core/TestUser.java @@ -0,0 +1,44 @@ +package org.yacos.tests.core; + +import static org.junit.Assert.*; + +import javax.naming.Context; +import javax.naming.InitialContext; + +import org.junit.Before; +import org.junit.Test; +import org.yacos.core.users.IUsersManager; +import org.yacos.core.users.User; + +public class TestUser { + private IUsersManager manager; + + @Before + public void setUp() throws Exception { + Context context = new InitialContext(); + manager = (IUsersManager) context.lookup("UsersManagerBean/remote"); + + manager.removeUser(manager.getUser("toto")); + + User toto = new User(); + toto.setLogin("toto"); + toto.setFirstName("Toto"); + toto.setLastName("John"); + manager.addUser(toto); + } + + @Test + public void testManagerPresence(){ + assertNotNull(manager); + } + + @Test + public void testUserWritingReading(){ + + User user = manager.getUser("toto"); + assertNotNull(user); + assertEquals("toto", user.getLogin()); + assertEquals("Toto", user.getLastName()); + assertEquals("John", user.getFirstName()); + } +}