Implemented Authorization Request/Response

Formatting changes
cusax-fix
Damian Minkov 20 years ago
parent 6f76d8c31b
commit dc0ac8b476

@ -6,17 +6,14 @@
*/
package net.java.sip.communicator.impl.protocol.icq.message;
import java.util.List;
import java.util.*;
import net.java.sip.communicator.impl.protocol.icq.message.common.AbstractIcqCmd;
import net.java.sip.communicator.impl.protocol.icq.message.common.FromIcqCmd;
import net.java.sip.communicator.impl.protocol.icq.message.offline.OfflineMsgCmd;
import net.java.sip.communicator.util.Logger;
import net.kano.joscar.DefensiveTools;
import net.kano.joscar.flapcmd.SnacCommand;
import net.kano.joscar.flapcmd.SnacPacket;
import net.kano.joscar.snac.CmdType;
import net.kano.joscar.snac.SnacCmdFactory;
import net.java.sip.communicator.impl.protocol.icq.message.common.*;
import net.java.sip.communicator.impl.protocol.icq.message.offline.*;
import net.java.sip.communicator.util.*;
import net.kano.joscar.*;
import net.kano.joscar.flapcmd.*;
import net.kano.joscar.snac.*;
/**
* Registers the new commands implemented in this package.

@ -6,18 +6,12 @@
*/
package net.java.sip.communicator.impl.protocol.icq.message.offline;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.io.*;
import java.util.*;
import net.java.sip.communicator.impl.protocol.icq.message.common.AbstractIcqCmd;
import net.java.sip.communicator.impl.protocol.icq.message.common.FromIcqCmd;
import net.java.sip.communicator.impl.protocol.icq.message.common.LEBinaryTools;
import net.kano.joscar.ByteBlock;
import net.kano.joscar.OscarTools;
import net.kano.joscar.flapcmd.SnacCommand;
import net.java.sip.communicator.impl.protocol.icq.message.common.*;
import net.kano.joscar.*;
import net.kano.joscar.flapcmd.*;
/**
* Command received frin server. Parses incoming offline messages

@ -6,11 +6,9 @@
*/
package net.java.sip.communicator.impl.protocol.icq.message.offline;
import java.io.IOException;
import java.io.OutputStream;
import java.io.*;
import net.java.sip.communicator.impl.protocol.icq.message.common.AbstractIcqCmd;
import net.java.sip.communicator.impl.protocol.icq.message.common.IcqCommand;
import net.java.sip.communicator.impl.protocol.icq.message.common.*;
/**
* Request send to the server to delete all offline messages

@ -6,11 +6,9 @@
*/
package net.java.sip.communicator.impl.protocol.icq.message.offline;
import java.io.IOException;
import java.io.OutputStream;
import java.io.*;
import net.java.sip.communicator.impl.protocol.icq.message.common.AbstractIcqCmd;
import net.java.sip.communicator.impl.protocol.icq.message.common.IcqCommand;
import net.java.sip.communicator.impl.protocol.icq.message.common.*;
/**
* Sending Request for retreiving

@ -6,10 +6,10 @@
*/
package net.java.sip.communicator.impl.protocol.icq.message.offline;
import net.kano.joscar.snaccmd.icbm.SendImIcbm;
import java.io.IOException;
import net.kano.joscar.tlv.Tlv;
import java.io.OutputStream;
import java.io.*;
import net.kano.joscar.snaccmd.icbm.*;
import net.kano.joscar.tlv.*;
/**
* Sending InstantMessages with TLV for delivering as offline message

@ -21,6 +21,7 @@
* that have been used to test the implementations.
*
* @author Emil Ivov
* @author Damian Minkov
*/
public class TestAccountUninstallation
extends TestCase
@ -73,10 +74,12 @@ public static Test suite()
/**
* Registers listener who will wait for Inregistered event.
* Than log in The tester with uin that is already logged in
* So we must get event that the account is unregistered due to
* multiple logins
* Before we uninstall the current account which is registered to the server
* we add a registration change listener and wait for unregistered event
* to be fired.
* Then we use the tester agent to register to the servers with
* the account info of the currently logged in account so we must
* receive multiple logins event.
*/
public void testMultipleLogins()
{
@ -105,17 +108,19 @@ public void testMultipleLogins()
testerAgent.unregister();
assertTrue(
assertNotNull(
"No event was dispatched"
,regEvtCollector.stateRecieved != null);
,regEvtCollector.stateRecieved);
assertTrue(
assertEquals(
"Event is not UNREGISTERED event"
,regEvtCollector.stateRecieved.equals(RegistrationState.UNREGISTERED));
, regEvtCollector.stateRecieved
, RegistrationState.UNREGISTERED);
assertTrue(
assertEquals(
"No registration event notifying of Multiple logins dispatched "
, regEvtCollector.eventReason == RegistrationStateChangeEvent.REASON_MULTIPLE_LOGINS);
, regEvtCollector.eventReason
, RegistrationStateChangeEvent.REASON_MULTIPLE_LOGINS);
}
/**
@ -167,43 +172,42 @@ public void testUninstallAccount()
}
/**
* A class that would plugin as a registration listener to a protocol
* provider and simply record all events that it sees and notify the
* registrationLock if it sees an event that notifies us of a completed
* registration.
* @author Emil Ivov
* A class that would plugin as a registration listener to a protocol
* provider and simply record all events that it sees and notify the
* registrationLock if it sees an event that notifies us of a completed
* registration.
*/
public class RegistrationEventCollector implements RegistrationStateChangeListener
{
RegistrationState stateRecieved = null;
int eventReason = -1;
/**
* The method would simply register all received events so that they
* could be available for later inspection by the unit tests. In the
* case where a registraiton event notifying us of a completed
* registration is seen, the method would call notifyAll() on the
* registrationLock.
*
* @param evt ProviderStatusChangeEvent the event describing the status
* change.
*/
public class RegistrationEventCollector implements RegistrationStateChangeListener
public void registrationStateChanged(RegistrationStateChangeEvent evt)
{
RegistrationState stateRecieved = null;
int eventReason = -1;
/**
* The method would simply register all received events so that they
* could be available for later inspection by the unit tests. In the
* case where a registraiton event notifying us of a completed
* registration is seen, the method would call notifyAll() on the
* registrationLock.
*
* @param evt ProviderStatusChangeEvent the event describing the status
* change.
*/
public void registrationStateChanged(RegistrationStateChangeEvent evt)
logger.debug("Received a RegistrationStateChangeEvent: " + evt);
if(evt.getNewState().equals( RegistrationState.UNREGISTERED))
{
logger.debug("Received a RegistrationStateChangeEvent: " + evt);
if(evt.getNewState().equals( RegistrationState.UNREGISTERED))
{
logger.debug("Connection FAILED!");
stateRecieved = evt.getNewState();
eventReason = evt.getReasonCode();
synchronized(registrationLock){
logger.debug(".");
registrationLock.notifyAll();
logger.debug(".");
}
logger.debug("Connection FAILED!");
stateRecieved = evt.getNewState();
eventReason = evt.getReasonCode();
synchronized(registrationLock){
logger.debug(".");
registrationLock.notifyAll();
logger.debug(".");
}
}
}
}
}

Loading…
Cancel
Save