diff options
Diffstat (limited to 'test/net/java/sip/communicator/slick/protocol/yahoo/TestAccountUninstallationPersistence.java')
-rw-r--r-- | test/net/java/sip/communicator/slick/protocol/yahoo/TestAccountUninstallationPersistence.java | 113 |
1 files changed, 0 insertions, 113 deletions
diff --git a/test/net/java/sip/communicator/slick/protocol/yahoo/TestAccountUninstallationPersistence.java b/test/net/java/sip/communicator/slick/protocol/yahoo/TestAccountUninstallationPersistence.java deleted file mode 100644 index d87a238..0000000 --- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestAccountUninstallationPersistence.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Jitsi, the OpenSource Java VoIP and Instant Messaging client. - * - * Copyright @ 2015 Atlassian Pty Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.java.sip.communicator.slick.protocol.yahoo; - -import junit.framework.*; -import net.java.sip.communicator.service.protocol.*; - -import org.jitsi.service.configuration.*; -import org.osgi.framework.*; - -/** - * Contains tests verifying persistence of account uninstallation. In other - * words we try to make sure that once uninstalled an account remains - * uninstalled. - * - * @author Emil Ivov - */ -public class TestAccountUninstallationPersistence - extends TestCase -{ - /** - * Creates a new test instance wrapper around the test with the specified - * name. - * @param testName the name of the test that we will be executing. - */ - public TestAccountUninstallationPersistence(String testName) - { - super(testName); - } - - /** - * Retrieves a reference to the yahoo bundle, stops it and uninstalls it and - * then reinstalls it in order to make sure that accounts are not reloaded - * once removed. - * - * @throws java.lang.Exception if something goes wrong while manipulating - * the bundles. - */ - public void testAccountUninstallationPersistence() - throws Exception - { - Bundle providerBundle = YahooSlickFixture.providerBundle; - - providerBundle.stop(); - - assertTrue("Couldn't stop the protocol provider bundle. State was " - + providerBundle.getState() - , Bundle.ACTIVE != providerBundle.getState() - && Bundle.STOPPING != providerBundle.getState()); - - providerBundle.uninstall(); - - assertEquals("Couldn't stop the protocol provider bundle." - , Bundle.UNINSTALLED, providerBundle.getState()); - - //Now reinstall the bundle and restart the provider - providerBundle - = YahooSlickFixture.bc.installBundle(providerBundle.getLocation()); - - assertEquals("Couldn't re-install protocol provider bundle." - , Bundle.INSTALLED, providerBundle.getState()); - - AccountManagerUtils.startBundleAndWaitStoredAccountsLoaded( - YahooSlickFixture.bc, providerBundle, ProtocolNames.YAHOO); - assertEquals("Couldn't re-start protocol provider bundle." - , Bundle.ACTIVE, providerBundle.getState()); - - - //verify that the provider is not reinstalled - ServiceReference[] yahooProviderRefs = null; - try - { - yahooProviderRefs = YahooSlickFixture.bc.getServiceReferences( - ProtocolProviderService.class.getName(), - "(" + ProtocolProviderFactory.PROTOCOL - + "=" +ProtocolNames.YAHOO + ")"); - } - catch (InvalidSyntaxException ex) - { - fail("We apparently got our filter wrong " + ex.getMessage()); - } - - //make sure we didn't retrieve a service - assertTrue("A yahoo Protocol Provider Service was still regged as an " - +"osgi service after it was explicitly uninstalled" - ,yahooProviderRefs == null || yahooProviderRefs.length == 0); - - //and a nasty hack at the end - delete the configuration file so that - //we get a fresh start on next run. - ServiceReference confReference - = YahooSlickFixture.bc.getServiceReference( - ConfigurationService.class.getName()); - ConfigurationService configurationService - = (ConfigurationService) YahooSlickFixture.bc.getService(confReference); - - configurationService.purgeStoredConfiguration(); - } -} |