@@ -0,0 +1,2350 @@
+package org.hive2hive.core.test.network.data;%0A%0Aimport org.hive2hive.core.exceptions.GetFailedException;%0Aimport org.hive2hive.core.exceptions.PutFailedException;%0Aimport org.hive2hive.core.model.FileTreeNode;%0Aimport org.hive2hive.core.model.UserProfile;%0Aimport org.hive2hive.core.network.NetworkManager;%0Aimport org.hive2hive.core.network.data.UserProfileManager;%0Aimport org.hive2hive.core.security.UserCredentials;%0Aimport org.hive2hive.core.test.H2HJUnitTest;%0Aimport org.hive2hive.core.test.network.NetworkTestUtil;%0Aimport org.hive2hive.core.test.process.ProcessTestUtil;%0Aimport org.junit.After;%0Aimport org.junit.AfterClass;%0Aimport org.junit.Assert;%0Aimport org.junit.Before;%0Aimport org.junit.BeforeClass;%0Aimport org.junit.Test;%0A%0A/**%0A * Test the %7B@link UserProfileManager%7D's exception triggering (%7B@link GetFailedException%7D and%0A * %7B@link PutFailedException%7D).%0A * %0A * @author Seppi%0A */%0Apublic class UserProfileManagerExceptionHandlingTest extends H2HJUnitTest %7B%0A%0A%09private UserCredentials userCredentials;%0A%09private NetworkManager client;%0A%0A%09@BeforeClass%0A%09public static void initTest() throws Exception %7B%0A%09%09testClass = UserProfileManagerExceptionHandlingTest.class;%0A%09%09beforeClass();%0A%09%7D%0A%0A%09@Before%0A%09public void setup() %7B%0A%09%09userCredentials = NetworkTestUtil.generateRandomCredentials();%0A%09%09client = NetworkTestUtil.createNetwork(1).get(0);%0A%09%7D%0A%0A%09@Test%0A%09public void testGetException() %7B%0A%09%09UserProfileManager profileManager = new UserProfileManager(client, userCredentials);%0A%09%09try %7B%0A%09%09%09profileManager.getUserProfile(-1, false);%0A%09%09%09Assert.fail();%0A%09%09%7D catch (GetFailedException e) %7B%0A%09%09%09// has to be thrown%0A%09%09%7D%0A%09%7D%0A%0A%09@Test%0A%09public void testPutException() throws GetFailedException %7B%0A%09%09ProcessTestUtil.register(userCredentials, client);%0A%09%09UserProfileManager profileManager = new UserProfileManager(client, userCredentials);%0A%09%09UserProfile userProfile = profileManager.getUserProfile(-1, true);%0A%09%09%0A%09%09// modify the version key to trigger a version conflict (wrong based on key)%0A%09%09userProfile.generateVersionKey();%0A%0A%09%09new FileTreeNode(userProfile.getRoot(), null, NetworkTestUtil.randomString());%0A%0A%09%09try %7B%0A%09%09%09profileManager.readyToPut(userProfile, -1);%0A%09%09%09Assert.fail();%0A%09%09%7D catch (PutFailedException e) %7B%0A%09%09%09// has to be thrown%0A%09%09%7D%0A%09%7D%0A%0A%09@After%0A%09public void shutdown() %7B%0A%09%09client.disconnect();%0A%09%7D%0A%0A%09@AfterClass%0A%09public static void cleanAfterClass() %7B%0A%09%09afterClass();%0A%09%7D%0A%0A%7D%0A

Test for exception throwing of the User Profile Manager added.