converts tabs to spaces in a number of classes

cusax-fix
Emil Ivov 17 years ago
parent 1cd1bdc8cc
commit 48869d0f22

@ -21,7 +21,7 @@ public class PopupDialogImpl
{
private static final long serialVersionUID = 0L;
/**
/**
* Creates an instance of <tt>PopupDialogImpl</tt>.
*/
public PopupDialogImpl()

@ -11,24 +11,24 @@
/**
* Custom table model, that allows represent a boolean value with a check
* box.
*
*
* @author Yana Stamcheva
*/
public class BooleanToCheckTableModel extends DefaultTableModel {
private static final long serialVersionUID = 0L;
/*
/*
* JTable uses this method to determine the default renderer/
* editor for each cell. If we didn't implement this method,
* then the first column in the wizard would contain text
* then the first column in the wizard would contain text
* ("true"/"false"), rather than a check box.
*/
public Class<?> getColumnClass(int c) {
return getValueAt(0, c).getClass();
}
public boolean isCellEditable(int row, int col)
{
{
return (col < 1);
}
}

@ -13,14 +13,14 @@
* The <tt>MsgToolbarButton</tt> is a <tt>SIPCommButton</tt> that has
* specific background and rollover images. It is used in the chat window
* toolbar.
*
*
* @author Yana Stamcheva
*/
public class ChatToolbarButton extends SIPCommButton
{
private static final long serialVersionUID = 0L;
/**
/**
* Creates an instance of <tt>MsgToolbarButton</tt>.
* @param iconImage The icon to display on this button.
*/

@ -13,14 +13,14 @@
/**
* The <tt>ExtendedTableModel</tt> is a <tt>DefaultTableModel</tt> with one
* method in addition that allow to obtain the row index from a value.
*
*
* @author Yana Stamcheva
*/
public class ExtendedTableModel extends DefaultTableModel
{
private static final long serialVersionUID = 0L;
private static final long serialVersionUID = 0L;
/**
/**
* Returns the index of the row, in which the given value is contained.
* @param value the value to search for
* @return the index of the row, in which the given value is contained.
@ -28,20 +28,20 @@ public class ExtendedTableModel extends DefaultTableModel
public int rowIndexOf(Object value)
{
Vector<Vector<Object>> dataVec = this.getDataVector();
for(int i = 0; i < dataVector.size(); i ++) {
Vector<Object> rowVector = dataVec.get(i);
if(rowVector.contains(value)) {
return i;
}
}
return -1;
}
public boolean isCellEditable(int row, int col)
{
{
return false;
}
}

@ -28,7 +28,7 @@ public class LabelTableCellRenderer
{
private static final long serialVersionUID = 0L;
public LabelTableCellRenderer()
public LabelTableCellRenderer()
{
this.setHorizontalAlignment(JLabel.LEFT);
this.setOpaque(true);

@ -20,7 +20,7 @@
* set an image as a background. Depending on the
* "impl.gui.IS_CONTACT_LIST_TEXTURE_BG_ENABLED" property we'll be setting a
* single image or a texture of images.
*
*
* @author Yana Stamcheva
*/
public class SCScrollPane
@ -28,9 +28,9 @@ public class SCScrollPane
{
private static final long serialVersionUID = 0L;
public SCScrollPane()
public SCScrollPane()
{
this.setBorder(BorderFactory.createMatteBorder(
this.setBorder(BorderFactory.createMatteBorder(
1, 0, 1, 0, Color.GRAY));
this.setViewport(new SCViewport());
@ -40,7 +40,7 @@ public SCScrollPane()
/**
* Sets the view of this JViewport.
*
*
* @param view the view to set.
*/
public void setViewportView(JComponent view)

@ -25,9 +25,9 @@
public class SIPCommSmartComboBox
extends JComboBox
{
private static final long serialVersionUID = 0L;
private static final long serialVersionUID = 0L;
/**
/**
* Creates an instance of <tt>SIPCommSmartComboBox</tt>.
*/
public SIPCommSmartComboBox()

@ -21,7 +21,7 @@
* out of the container, where it is added and show it in a separate window.
* The separator is a line that could be added between two buttons. This way
* the developer could visually group buttons with similar functionality.
*
*
* @author Yana Stamcheva
*/
public class SIPCommToolBar
@ -29,7 +29,7 @@ public class SIPCommToolBar
{
private static final long serialVersionUID = 0L;
/**
/**
* Creates an instance of <tt>SIPCommToolBar</tt>.
*/
public SIPCommToolBar() {

@ -9,7 +9,7 @@
/**
* A <tt>RuntimeException</tt>, which is thrown if the wizard doesn't find
* the panel corresponding to a given <tt>WizardPanelDescriptor</tt>.
*
*
* @author Yana Stamcheva
*/
public class WizardPanelNotFoundException
@ -17,6 +17,6 @@ public class WizardPanelNotFoundException
{
private static final long serialVersionUID = 0L;
public WizardPanelNotFoundException() {
public WizardPanelNotFoundException() {
}
}
}

@ -1,6 +1,6 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
*
* Distributable under LGPL license. See terms of license at gnu.org.
*/
package net.java.sip.communicator.impl.gui.lookandfeel;
@ -15,7 +15,7 @@
/**
* SIPCommBorders is where all component borders used in the SIPComm L&F are
* drawn.
*
*
* @author Yana Stamcheva
*/
public class SIPCommBorders
@ -30,7 +30,7 @@ public static class RoundBorder
{
private static final long serialVersionUID = 0L;
private static final Insets insets = new Insets(2, 2, 2, 2);
private static final Insets insets = new Insets(2, 2, 2, 2);
public void paintBorder(Component c, Graphics g, int x, int y, int w,
int h)
@ -86,7 +86,7 @@ public static class BoldRoundBorder
{
private static final long serialVersionUID = 0L;
private static final Insets insets = new Insets(2, 2, 2, 2);
private static final Insets insets = new Insets(2, 2, 2, 2);
public void paintBorder(Component c, Graphics g, int x, int y, int w,
int h)
@ -151,7 +151,7 @@ public static class TextFieldBorder
{
private static final long serialVersionUID = 0L;
public void paintBorder(Component c,
public void paintBorder(Component c,
Graphics g,
int x,
int y,

@ -13,7 +13,7 @@
/**
* The default SIP-Communicator look&feel.
*
*
* @author Yana Stamcheva
*/
public class SIPCommLookAndFeel
@ -21,7 +21,7 @@ public class SIPCommLookAndFeel
{
private static final long serialVersionUID = 0L;
public boolean isNativeLookAndFeel() {
public boolean isNativeLookAndFeel() {
return false;
}
@ -41,10 +41,10 @@ public String getName() {
return "SIPCommLookAndFeel";
}
protected void initClassDefaults(UIDefaults table) {
super.initClassDefaults(table);
String lfPackageName = "net.java.sip.communicator.impl.gui.lookandfeel.";
Object[] uiDefaults = {
@ -73,7 +73,7 @@ protected void initClassDefaults(UIDefaults table) {
};
table.putDefaults(uiDefaults);
}
public Icon getDisabledIcon(JComponent component, Icon icon) {
if (icon instanceof ImageIcon) {
return new IconUIResource(new ImageIcon(LightGrayFilter.

@ -859,7 +859,7 @@ private class RenameAction extends AbstractAction
{
private static final long serialVersionUID = 0L;
public void actionPerformed(ActionEvent e)
public void actionPerformed(ActionEvent e)
{
Object selectedObject
= getContactListPanel().getContactList().getSelectedValue();
@ -1393,7 +1393,7 @@ public void setCurrentPhoneNumber(String number)
public void setParams(Object[] windowParams) {}
/**
* @param event Currently not used
* @param event Currently not used
*/
protected void windowClosed(WindowEvent event)
{
@ -1418,7 +1418,7 @@ protected void windowClosed(WindowEvent event)
}
/**
* @param event Currently not used
* @param event Currently not used
*/
protected void windowClosing(WindowEvent event)
{

@ -17,7 +17,7 @@
/**
* Represents an UI means to put an associated <tt>CallPariticant</tt> on/off
* hold.
*
*
* @author Lubomir Marinov
*/
public class HoldButton
@ -25,10 +25,10 @@ public class HoldButton
{
private static final long serialVersionUID = 0L;
/**
/**
* Initializes a new <tt>HoldButton</tt> instance which is to put a specific
* <tt>CallParticipant</tt> on/off hold.
*
*
* @param call the <tt>Call</tt> to be associated with
* the new instance and to be put on/off hold upon performing its
* action
@ -41,7 +41,7 @@ public HoldButton(Call call)
/**
* Initializes a new <tt>HoldButton</tt> instance which is to put a specific
* <tt>CallParticipant</tt> on/off hold.
*
*
* @param call the <tt>Call</tt> to be associated with
* the new instance and to be put on/off hold upon performing
* its action.
@ -102,7 +102,7 @@ private static class HoldButtonModel
* Initializes a new <tt>HoldButtonModel</tt> instance to represent
* the state of a specific <tt>CallParticipant</tt> as a toggle
* button.
*
*
* @param call
* the <tt>Call</tt> whose state is to be
* represented as a toggle button

@ -17,7 +17,7 @@
/**
* Represents an UI means to mute the audio stream sent to an associated
* <tt>CallPariticant</tt>.
*
*
* @author Lubomir Marinov
*/
public class MuteButton
@ -25,10 +25,10 @@ public class MuteButton
{
private static final long serialVersionUID = 0L;
/**
/**
* Initializes a new <tt>MuteButton</tt> instance which is to mute the audio
* stream to a specific <tt>CallParticipant</tt>.
*
*
* @param call the <tt>Call</tt> to be associated with
* the new instance and to have the audio stream sent to muted
*/
@ -40,7 +40,7 @@ public MuteButton(Call call)
/**
* Initializes a new <tt>MuteButton</tt> instance which is to mute the audio
* stream to a specific <tt>CallParticipant</tt>.
*
*
* @param call the <tt>Call</tt> to be associated with
* the new instance and to be put on/off hold upon performing
* its action.
@ -97,7 +97,7 @@ private static class MuteButtonModel
/**
* Initializes a new <tt>MuteButtonModel</tt> instance to represent the
* state of a specific <tt>CallParticipant</tt> as a toggle button.
*
*
* @param call the <tt>Call</tt> whose state is to
* be represented as a toggle button
*/

@ -13,13 +13,13 @@
/**
* Should be used to limit the number of messages shown in the chat conversation
* area. NOT USED FOR NOW.
*
*
* @author Yana Stamcheva
*/
public class ChatBuffer<E> extends ArrayList<E> {
private static final long serialVersionUID = 0L;
private static final long serialVersionUID = 0L;
/**
/**
* Creates an instance of <tt>ChatBuffer</tt>. The buffer
* is initialized with the CHAT_BUFFER_SIZE constant in the
* <tt>Constants</tt> class.

@ -14,7 +14,7 @@
/**
* The <tt>ViewMenu</tt> is a menu in the main application menu bar.
*
*
* @author Yana Stamcheva
*/
public class ViewMenu
@ -22,7 +22,7 @@ public class ViewMenu
{
private static final long serialVersionUID = 0L;
/**
/**
* Creates an instance of <tt>ViewMenu</tt>.
* @param mainFrame The parent <tt>MainFrame</tt> window.
*/

@ -1,6 +1,6 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
@ -12,26 +12,26 @@
/**
* Class to centralize workarounds or changes that need to be made for FMJ to work.
* This is also a place to tweak which workarounds are used.
*
*
* @author Ken Larson
*/
public class FMJConditionals
{
public static final boolean IS_FMJ = false;
/**
* Some SC codecs depend on internal Sun/IBM JMF classes.
/**
* Some SC codecs depend on internal Sun/IBM JMF classes.
*/
public static final boolean FMJ_CODECS = IS_FMJ;
/**
/**
* FMJ's filter graph builder does not give specific formats for the tracks,
* but rather a general format with no encoding.
* but rather a general format with no encoding.
*/
public static final AudioFormat FORCE_AUDIO_FORMAT = !IS_FMJ
? null
public static final AudioFormat FORCE_AUDIO_FORMAT = !IS_FMJ
? null
: new AudioFormat(AudioFormat.ULAW_RTP, 8000, 8, 1);
// to force ALAW/rtp, change the format to the following
// new AudioFormat(
// "ALAW/rtp",
@ -42,15 +42,15 @@ public class FMJConditionals
// AudioFormat.SIGNED);
/**
* JMF stores CUSTOM_CODEC_FORMATS statically, so they only need to be
* registered once. FMJ does this dynamically (per instance), so it needs
* to be done for every time we instantiate an RTP manager. This variable
* determines whether we should register them every time (FMJ) or not (JMF).
* JMF stores CUSTOM_CODEC_FORMATS statically, so they only need to be
* registered once. FMJ does this dynamically (per instance), so it needs
* to be done for every time we instantiate an RTP manager. This variable
* determines whether we should register them every time (FMJ) or not (JMF).
*/
public static final boolean REGISTER_FORMATS_WITH_EVERY_RTP_MANAGER
public static final boolean REGISTER_FORMATS_WITH_EVERY_RTP_MANAGER
= IS_FMJ;
/**
/**
* Whether to use JMF's internal registry to avoid auto-detecting capture
* devices each time, by tagging it with our own "author" property.
*/

@ -104,7 +104,7 @@ static void syn_filt(
for (i = 0; i < l; i++)
{
py=yy;
pa=0; //index instead of pointer
pa=0; //index instead of pointer
s = x[x_offset ++];
for (j = 0; j <M; j++) s -= (a[a_offset + ++pa]) * (yy_b[--py]);
yy_b[yy++] = s;

@ -121,7 +121,7 @@ else if(inpLength < enc.ULP_inst.blockl*2)
return OUTPUT_BUFFER_NOT_FILLED;
}
short[] encoded_data = new short[ILBC_NO_OF_BYTES / 2];
short[] encoded_data = new short[ILBC_NO_OF_BYTES / 2];
int outLength = ILBC_NO_OF_BYTES;
byte[] outdata = validateByteArraySize(outputBuffer, outLength);

@ -15,29 +15,29 @@ class bitpack {
int rest;
public bitpack() {
firstpart = 0;
rest = 0;
firstpart = 0;
rest = 0;
}
public bitpack(int fp, int r) {
firstpart = fp;
rest = r;
firstpart = fp;
rest = r;
}
public int get_firstpart() {
return firstpart;
return firstpart;
}
public void set_firstpart(int fp) {
firstpart = fp;
firstpart = fp;
}
public int get_rest() {
return rest;
return rest;
}
public void set_rest(int r) {
rest = r;
rest = r;
}
}

@ -20,20 +20,20 @@ class bitstream {
int buffer_pos;
public bitstream(int size) {
pos = 0;
pos = 0;
buffer_len = size;
buffer_pos = 0;
buffer = new char[size];
bitcount = 0;
buffer_len = size;
buffer_pos = 0;
buffer = new char[size];
bitcount = 0;
}
public bitstream() {
pos = 0;
pos = 0;
buffer_len = 128;
buffer_pos = 0;
buffer = new char[128];
buffer_len = 128;
buffer_pos = 0;
buffer = new char[128];
}
/*----------------------------------------------------------------*
@ -48,16 +48,16 @@ public bitpack packsplit(
int bitno_total) /* (i) number of bits in full range
of value */
{
int bitno_rest = bitno_total - bitno_firstpart;
bitpack rval = new bitpack ();
int bitno_rest = bitno_total - bitno_firstpart;
bitpack rval = new bitpack ();
int fp = index >>> bitno_rest;
int fp = index >>> bitno_rest;
rval.set_firstpart(fp);
// *firstpart = *index>>(bitno_rest);
rval.set_rest(index - (rval.get_firstpart() << bitno_rest));
// *rest = *index-(*firstpart<<(bitno_rest));
return rval;
rval.set_firstpart(fp);
// *firstpart = *index>>(bitno_rest);
rval.set_rest(index - (rval.get_firstpart() << bitno_rest));
// *rest = *index-(*firstpart<<(bitno_rest));
return rval;
}
/*----------------------------------------------------------------*
@ -72,9 +72,9 @@ int packcombine(
int bitno_rest /* (i) the number of bits in the
lsb part */
){
index = index << bitno_rest;
index += rest;
return index;
index = index << bitno_rest;
index += rest;
return index;
}
/*----------------------------------------------------------------*
@ -96,7 +96,7 @@ void dopack(
// System.out.println("packing " + bitno + " bits (" + index + "), total packed : " + (bitcount+bitno) + " bits to date");
bitcount += bitno;
// System.out.println("packing tag " + index + " of length " + bitno + "bits from byte " + buffer_pos + "/" + buffer.length + " at " + pos + "th bit");
// System.out.println("packing tag " + index + " of length " + bitno + "bits from byte " + buffer_pos + "/" + buffer.length + " at " + pos + "th bit");
/* Clear the bits before starting in a new byte */
@ -110,8 +110,8 @@ void dopack(
if (pos == 8) {
pos = 0;
buffer_pos++;
buffer[buffer_pos] = 0;
buffer_pos++;
buffer[buffer_pos] = 0;
}
posLeft = 8 - pos;
@ -142,24 +142,24 @@ public int unpack(
represent the value */
)
{
int BitsLeft;
int index=0;
int BitsLeft;
int index=0;
while (bitno > 0) {
while (bitno > 0) {
/* move forward in bitstream when the end of the
byte is reached */
/* move forward in bitstream when the end of the
byte is reached */
if (pos == 8) {
pos = 0;
buffer_pos++;
}
if (pos == 8) {
pos = 0;
buffer_pos++;
}
BitsLeft = 8 - pos;
BitsLeft = 8 - pos;
/* Extract bits to index */
/* Extract bits to index */
if (BitsLeft >= bitno) {
if (BitsLeft >= bitno) {
index += ((((buffer[buffer_pos]) << (pos)) & 0xFF) >>> (8 - bitno));
pos += bitno;
bitno = 0;

@ -17,9 +17,9 @@ class ilbc_common {
public static int LSF_check( /* (o) 1 for stable lsf vectors and 0 for
nonstable ones */
float lsf[], /* (i) a table of lsf vectors */
int dim, /* (i) the dimension of each lsf vector */
int NoAn) /* (i) the number of lsf vectors in the
float lsf[], /* (i) a table of lsf vectors */
int dim, /* (i) the dimension of each lsf vector */
int NoAn) /* (i) the number of lsf vectors in the
table */
{
int k,n,m, Nit=2, change=0,pos;
@ -99,15 +99,15 @@ public static void StateConstructW(
/* initialization of buffers and coefficients */
for (int li = 0; li < ilbc_constants.LPC_FILTERORDER; li++) {
tmpbuf[li] = 0.0f;
foutbuf[li] = 0.0f;
tmpbuf[li] = 0.0f;
foutbuf[li] = 0.0f;
}
// memset(tmpbuf, 0, LPC_FILTERORDER*sizeof(float));
// memset(foutbuf, 0, LPC_FILTERORDER*sizeof(float));
for (k=0; k < ilbc_constants.LPC_FILTERORDER; k++) {
numerator[k]=syntDenum[syntDenum_idx + ilbc_constants.LPC_FILTERORDER - k];
//System.out.println("numerator-" + k + " = " + numerator[k] + " (( " + syntDenum[syntDenum_idx + ilbc_constants.LPC_FILTERORDER - k]);
//System.out.println("numerator-" + k + " = " + numerator[k] + " (( " + syntDenum[syntDenum_idx + ilbc_constants.LPC_FILTERORDER - k]);
}
numerator[ilbc_constants.LPC_FILTERORDER]=syntDenum[syntDenum_idx];
@ -119,27 +119,27 @@ public static void StateConstructW(
/* decoding of the sample values */
// for (int li = 0; li < idxVec.length; li++)
//System.out.println("idxVec["+li+"] = " + idxVec[li]);
//System.out.println("idxVec["+li+"] = " + idxVec[li]);
for (k=0; k<len; k++) {
tmpi = len-1-k;
/* maxVal = 1/scal */
tmpbuf[tmp+k] = maxVal*ilbc_constants.state_sq3Tbl[idxVec[tmpi]];
//System.out.println("index " + k + ", valeur " + tmpbuf[tmp+k]);
//System.out.println("index " + k + ", valeur " + tmpbuf[tmp+k]);
}
/* circular convolution with all-pass filter */
for (int li = 0; li < len; li++)
tmpbuf[tmp+len+li] = 0.0f;
tmpbuf[tmp+len+li] = 0.0f;
// memset(tmp+len, 0, len*sizeof(float));
ilbc_common.ZeroPoleFilter(tmpbuf, tmp, numerator, syntDenum, syntDenum_idx,
2*len, ilbc_constants.LPC_FILTERORDER,
foutbuf, fout);
2*len, ilbc_constants.LPC_FILTERORDER,
foutbuf, fout);
for (k=0;k<len;k++) {
out[out_idx+k] = foutbuf[fout+len-1-k]+foutbuf[fout+2*len-1-k];
//System.out.println("MEM -- index " + out_idx + " + " + k + " initialise a " + out[out_idx+k]);
//System.out.println(" calcul : " + foutbuf[fout+len-1-k] + " + " + foutbuf[fout+2*len-1-k]);
//System.out.println("MEM -- index " + out_idx + " + " + k + " initialise a " + out[out_idx+k]);
//System.out.println(" calcul : " + foutbuf[fout+len-1-k] + " + " + foutbuf[fout+2*len-1-k]);
}
}
@ -164,13 +164,13 @@ public static void AllPoleFilter(
int lengthInOut,/* (i) number of input/output samples */
int orderCoef) /* (i) number of filter coefficients */
{
int n, k;
int n, k;
for(n = 0; n < lengthInOut; n++) {
for(k = 1; k <= orderCoef; k++) {
InOut[n+InOut_idx] -= Coef[Coef_idx + k] * InOut[n-k+InOut_idx];
}
}
for(n = 0; n < lengthInOut; n++) {
for(k = 1; k <= orderCoef; k++) {
InOut[n+InOut_idx] -= Coef[Coef_idx + k] * InOut[n-k+InOut_idx];
}
}
}
/*----------------------------------------------------------------*
@ -227,8 +227,8 @@ public static void ZeroPoleFilter(
contain filtered samples */
int Out_idx)
{
AllZeroFilter(In, In_idx, ZeroCoef, lengthInOut, orderCoef, Out, Out_idx);
AllPoleFilter(Out, Out_idx, PoleCoef, PoleCoef_idx, lengthInOut, orderCoef);
AllZeroFilter(In, In_idx, ZeroCoef, lengthInOut, orderCoef, Out, Out_idx);
AllPoleFilter(Out, Out_idx, PoleCoef, PoleCoef_idx, lengthInOut, orderCoef);
}
/*----------------------------------------------------------------*
@ -237,22 +237,22 @@ public static void ZeroPoleFilter(
public static void lsf2a(float a_coef[], float freq[])
{
int i, j;
float hlp;
float [] p = new float[ilbc_constants.LPC_HALFORDER];
float [] q = new float[ilbc_constants.LPC_HALFORDER];
float [] a = new float[ilbc_constants.LPC_HALFORDER + 1];
float [] a1 = new float[ilbc_constants.LPC_HALFORDER];
float [] a2 = new float[ilbc_constants.LPC_HALFORDER];
float [] b = new float[ilbc_constants.LPC_HALFORDER + 1];
float [] b1 = new float[ilbc_constants.LPC_HALFORDER];
float [] b2 = new float[ilbc_constants.LPC_HALFORDER];
//System.out.println("debut de lsf2a");
for (i=0; i < ilbc_constants.LPC_FILTERORDER; i++) {
freq[i] = freq[i] * ilbc_constants.PI2;
}
int i, j;
float hlp;
float [] p = new float[ilbc_constants.LPC_HALFORDER];
float [] q = new float[ilbc_constants.LPC_HALFORDER];
float [] a = new float[ilbc_constants.LPC_HALFORDER + 1];
float [] a1 = new float[ilbc_constants.LPC_HALFORDER];
float [] a2 = new float[ilbc_constants.LPC_HALFORDER];
float [] b = new float[ilbc_constants.LPC_HALFORDER + 1];
float [] b1 = new float[ilbc_constants.LPC_HALFORDER];
float [] b2 = new float[ilbc_constants.LPC_HALFORDER];
//System.out.println("debut de lsf2a");
for (i=0; i < ilbc_constants.LPC_FILTERORDER; i++) {
freq[i] = freq[i] * ilbc_constants.PI2;
}
/* Check input for ill-conditioned cases. This part is not
found in the TIA standard. It involves the following 2 IF
@ -282,18 +282,18 @@ public static void lsf2a(float a_coef[], float freq[])
}
for (int li = 0; li < ilbc_constants.LPC_HALFORDER; li++) {
a1[li] = 0.0f;
a2[li] = 0.0f;
b1[li] = 0.0f;
b2[li] = 0.0f;
a1[li] = 0.0f;
a2[li] = 0.0f;
b1[li] = 0.0f;
b2[li] = 0.0f;
}
// memset(a1, 0, LPC_HALFORDER*sizeof(float));
// memset(a2, 0, LPC_HALFORDER*sizeof(float));
// memset(b1, 0, LPC_HALFORDER*sizeof(float));
// memset(b2, 0, LPC_HALFORDER*sizeof(float));
for (int li = 0; li < ilbc_constants.LPC_HALFORDER + 1; li++) {
a[li] = 0.0f;
b[li] = 0.0f;
a[li] = 0.0f;
b[li] = 0.0f;
}
// memset(a, 0, (LPC_HALFORDER+1)*sizeof(float));
// memset(b, 0, (LPC_HALFORDER+1)*sizeof(float));
@ -340,7 +340,7 @@ public static void lsf2a(float a_coef[], float freq[])
}
a_coef[j + 1] = 2 * (a[ilbc_constants.LPC_HALFORDER] +
b[ilbc_constants.LPC_HALFORDER]);
b[ilbc_constants.LPC_HALFORDER]);
}
a_coef[0] = 1.0f;
@ -370,8 +370,8 @@ public static void interpolate(
invcoef = 1.0f - coef;
for (i = 0; i < length; i++) {
out[i] = coef * in1[i] + invcoef * in2[i + in2_idx];
// System.out.println("out["+i+"] devient " + out[i] + ", par " +
// coef + " * " + in1[i] + " + " + invcoef + " * " + in2[i + in2_idx]);
// System.out.println("out["+i+"] devient " + out[i] + ", par " +
// coef + " * " + in1[i] + " + " + invcoef + " * " + in2[i + in2_idx]);
}
}
@ -380,39 +380,39 @@ public static void interpolate(
*---------------------------------------------------------------*/
public static void bwexpand(
float out[], /* (o) the bandwidth expanded lpc
float out[], /* (o) the bandwidth expanded lpc
coefficients */
int out_idx,
float in[], /* (i) the lpc coefficients before bandwidth
int out_idx,
float in[], /* (i) the lpc coefficients before bandwidth
expansion */
float coef, /* (i) the bandwidth expansion factor */
int length) /* (i) the length of lpc coefficient vectors */
float coef, /* (i) the bandwidth expansion factor */
int length) /* (i) the length of lpc coefficient vectors */
{
int i;
float chirp;
int i;
float chirp;
chirp = coef;
chirp = coef;
out[out_idx] = in[0];
for (i = 1; i < length; i++) {
out[i + out_idx] = chirp * in[i];
chirp *= coef;
}
out[out_idx] = in[0];
for (i = 1; i < length; i++) {
out[i + out_idx] = chirp * in[i];
chirp *= coef;
}
}
public static void getCBvec(
float cbvec[], /* (o) Constructed codebook vector */
float mem[], /* (i) Codebook buffer */
int mem_idx,
int index, /* (i) Codebook index */
int lMem, /* (i) Length of codebook buffer */
int cbveclen) /* (i) Codebook vector length */
float cbvec[], /* (o) Constructed codebook vector */
float mem[], /* (i) Codebook buffer */
int mem_idx,
int index, /* (i) Codebook index */
int lMem, /* (i) Length of codebook buffer */
int cbveclen) /* (i) Codebook vector length */
{
int j, k, n, memInd, sFilt;
float [] tmpbuf = new float[ilbc_constants.CB_MEML];
int base_size;
int ilow, ihigh;
float alfa, alfa1;
int j, k, n, memInd, sFilt;
float [] tmpbuf = new float[ilbc_constants.CB_MEML];
int base_size;
int ilow, ihigh;
float alfa, alfa1;
/* Determine size of codebook sections */
@ -430,8 +430,8 @@ public static void getCBvec(
k=index+cbveclen;
/* get vector */
System.arraycopy(mem, mem_idx + lMem - k, cbvec, 0, cbveclen);
// memcpy(cbvec, mem+lMem-k, cbveclen*sizeof(float));
System.arraycopy(mem, mem_idx + lMem - k, cbvec, 0, cbveclen);
// memcpy(cbvec, mem+lMem-k, cbveclen*sizeof(float));
} else if (index < base_size) {
@ -442,8 +442,8 @@ public static void getCBvec(
/* Copy first noninterpolated part */
System.arraycopy(mem, mem_idx + lMem - k / 2, cbvec, 0, ilow);
// memcpy(cbvec, mem+lMem-k/2, ilow*sizeof(float));
System.arraycopy(mem, mem_idx + lMem - k / 2, cbvec, 0, ilow);
// memcpy(cbvec, mem+lMem-k/2, ilow*sizeof(float));
/* interpolation */
@ -457,7 +457,7 @@ public static void getCBvec(
/* Copy second noninterpolated part */
System.arraycopy(mem, mem_idx+lMem-k+ihigh, cbvec, ihigh, (cbveclen-ihigh));
System.arraycopy(mem, mem_idx+lMem-k+ihigh, cbvec, ihigh, (cbveclen-ihigh));
// memcpy(cbvec+ihigh, mem+lMem-k+ihigh,
// (cbveclen-ihigh)*sizeof(float));
@ -473,17 +473,17 @@ public static void getCBvec(
float [] tempbuff2 = new float[ilbc_constants.CB_MEML+ilbc_constants.CB_FILTERLEN+1];
// float *pos;
// float *pp, *pp1;
int pos, pp, pp1;
int pos, pp, pp1;
for (int li = 0; li < ilbc_constants.CB_HALFFILTERLEN; li++)
tempbuff2[li] = 0.0f;
for (int li = 0; li < ilbc_constants.CB_HALFFILTERLEN; li++)
tempbuff2[li] = 0.0f;
// memset(tempbuff2, 0,
// CB_HALFFILTERLEN*sizeof(float));
System.arraycopy(mem, mem_idx, tempbuff2, ilbc_constants.CB_HALFFILTERLEN, lMem);
System.arraycopy(mem, mem_idx, tempbuff2, ilbc_constants.CB_HALFFILTERLEN, lMem);
// memcpy(&tempbuff2[CB_HALFFILTERLEN], mem,
// lMem*sizeof(float));
for (int li = 0; li < ilbc_constants.CB_HALFFILTERLEN + 1; li++)
tempbuff2[lMem + ilbc_constants.CB_HALFFILTERLEN + li] = 0.0f;
for (int li = 0; li < ilbc_constants.CB_HALFFILTERLEN + 1; li++)
tempbuff2[lMem + ilbc_constants.CB_HALFFILTERLEN + li] = 0.0f;
// memset(&tempbuff2[lMem+CB_HALFFILTERLEN], 0,
// (CB_HALFFILTERLEN+1)*sizeof(float));
@ -492,21 +492,21 @@ public static void getCBvec(
memInd=sFilt+1-ilbc_constants.CB_HALFFILTERLEN;
/* do filtering */
// pos=cbvec;
pos = 0;
for (int li = 0; li < cbveclen; li++)
cbvec[li] = 0;
// pos=cbvec;
pos = 0;
for (int li = 0; li < cbveclen; li++)
cbvec[li] = 0;
// memset(pos, 0, cbveclen*sizeof(float));
for (n=0; n<cbveclen; n++) {
pp = memInd + n + ilbc_constants.CB_HALFFILTERLEN;
pp = memInd + n + ilbc_constants.CB_HALFFILTERLEN;
// pp=&tempbuff2[memInd+n+CB_HALFFILTERLEN];
pp1 = ilbc_constants.CB_FILTERLEN - 1;
pp1 = ilbc_constants.CB_FILTERLEN - 1;
// pp1=&cbfiltersTbl[CB_FILTERLEN-1];
for (j=0; j < ilbc_constants.CB_FILTERLEN; j++) {
// (*pos)+=(*pp++)*(*pp1--);
cbvec[pos] += tempbuff2[pp] * ilbc_constants.cbfiltersTbl[pp1];
pp++;
pp1--;
cbvec[pos] += tempbuff2[pp] * ilbc_constants.cbfiltersTbl[pp1];
pp++;
pp1--;
}
pos++;
}
@ -519,43 +519,43 @@ public static void getCBvec(
// float *pos;
// float *pp, *pp1;
int pos, pp, pp1;
int pos, pp, pp1;
int i;
for (int li = 0; li < ilbc_constants.CB_HALFFILTERLEN; li++)
tempbuff2[li] = 0.0f;
for (int li = 0; li < ilbc_constants.CB_HALFFILTERLEN; li++)
tempbuff2[li] = 0.0f;
// memset(tempbuff2, 0,
// CB_HALFFILTERLEN*sizeof(float));
System.arraycopy(mem, mem_idx, tempbuff2, ilbc_constants.CB_HALFFILTERLEN, lMem);
System.arraycopy(mem, mem_idx, tempbuff2, ilbc_constants.CB_HALFFILTERLEN, lMem);
// memcpy(&tempbuff2[CB_HALFFILTERLEN], mem,
// lMem*sizeof(float));
for (int li = 0; li < ilbc_constants.CB_HALFFILTERLEN; li++)
tempbuff2[lMem+ilbc_constants.CB_HALFFILTERLEN+li] = 0.0f;
for (int li = 0; li < ilbc_constants.CB_HALFFILTERLEN; li++)
tempbuff2[lMem+ilbc_constants.CB_HALFFILTERLEN+li] = 0.0f;
// memset(&tempbuff2[lMem+CB_HALFFILTERLEN], 0,
// (CB_HALFFILTERLEN+1)*sizeof(float));
k=2*(index-base_size-
(lMem-cbveclen+1))+cbveclen;
(lMem-cbveclen+1))+cbveclen;
sFilt=lMem-k;
memInd=sFilt+1 - ilbc_constants.CB_HALFFILTERLEN;
/* do filtering */
// pos=&tmpbuf[sFilt];
pos = sFilt;
// memset(pos, 0, k*sizeof(float));
for (int li = 0; li < k; li++)
tmpbuf[pos+li] = 0.0f;
// pos=&tmpbuf[sFilt];
pos = sFilt;
// memset(pos, 0, k*sizeof(float));
for (int li = 0; li < k; li++)
tmpbuf[pos+li] = 0.0f;
for (i=0; i<k; i++) {
pp = memInd + i + ilbc_constants.CB_HALFFILTERLEN;
pp = memInd + i + ilbc_constants.CB_HALFFILTERLEN;
// pp=&tempbuff2[memInd+i+CB_HALFFILTERLEN];
pp1 = ilbc_constants.CB_FILTERLEN-1;
pp1 = ilbc_constants.CB_FILTERLEN-1;
// pp1=&cbfiltersTbl[CB_FILTERLEN-1];
for (j=0; j < ilbc_constants.CB_FILTERLEN; j++) {
// (*pos)+=(*pp++)*(*pp1--);
tmpbuf[pos] += tempbuff2[pp] * ilbc_constants.cbfiltersTbl[pp1];
pp++;
pp1--;
// (*pos)+=(*pp++)*(*pp1--);
tmpbuf[pos] += tempbuff2[pp] * ilbc_constants.cbfiltersTbl[pp1];
pp++;
pp1--;
}
pos++;
}
@ -565,7 +565,7 @@ public static void getCBvec(
/* Copy first noninterpolated part */
System.arraycopy(tmpbuf, lMem - k / 2, cbvec, 0, ilow);
System.arraycopy(tmpbuf, lMem - k / 2, cbvec, 0, ilow);
// memcpy(cbvec, tmpbuf+lMem-k/2,
// ilow*sizeof(float));
@ -581,7 +581,7 @@ public static void getCBvec(
/* Copy second noninterpolated part */
System.arraycopy(tmpbuf, lMem-k+ihigh, cbvec, ihigh, cbveclen - ihigh);
System.arraycopy(tmpbuf, lMem-k+ihigh, cbvec, ihigh, cbveclen - ihigh);
// memcpy(cbvec+ihigh, tmpbuf+lMem-k+ihigh,
// (cbveclen-ihigh)*sizeof(float));
}
@ -591,50 +591,50 @@ public static void getCBvec(
public static float gainquant(/* (o) quantized gain value */
float in, /* (i) gain value */
float maxIn,/* (i) maximum of gain value */
int cblen, /* (i) number of quantization indices */
int index[], /* (o) quantization index */
int index_idx)
float in, /* (i) gain value */
float maxIn,/* (i) maximum of gain value */
int cblen, /* (i) number of quantization indices */
int index[], /* (o) quantization index */
int index_idx)
{
int i, tindex;
float minmeasure,measure, cb[], scale;
int i, tindex;
float minmeasure,measure, cb[], scale;
/* ensure a lower bound on the scaling factor */
/* ensure a lower bound on the scaling factor */
scale = maxIn;
scale = maxIn;
if (scale < 0.1) {
scale = (float)0.1;
}
if (scale < 0.1) {
scale = (float)0.1;
}
/* select the quantization table */
/* select the quantization table */
if (cblen == 8) {
cb = ilbc_constants.gain_sq3Tbl;
} else if (cblen == 16) {
cb = ilbc_constants.gain_sq4Tbl;
} else {
cb = ilbc_constants.gain_sq5Tbl;
}
if (cblen == 8) {
cb = ilbc_constants.gain_sq3Tbl;
} else if (cblen == 16) {
cb = ilbc_constants.gain_sq4Tbl;
} else {
cb = ilbc_constants.gain_sq5Tbl;
}
/* select the best index in the quantization table */
/* select the best index in the quantization table */
minmeasure=10000000.0f;
tindex=0;
for (i=0; i<cblen; i++) {
measure = (in - scale*cb[i])*(in-scale*cb[i]);
minmeasure=10000000.0f;
tindex=0;
for (i=0; i<cblen; i++) {
measure = (in - scale*cb[i])*(in-scale*cb[i]);
if (measure<minmeasure) {
tindex=i;
minmeasure=measure;
}
}
index[index_idx] = tindex;
if (measure<minmeasure) {
tindex=i;
minmeasure=measure;
}
}
index[index_idx] = tindex;
/* return the quantized value */
/* return the quantized value */
return scale*cb[tindex];
return scale*cb[tindex];
}
/*----------------------------------------------------------------*
@ -643,47 +643,47 @@ public static float gainquant(/* (o) quantized gain value */
*---------------------------------------------------------------*/
public static float gaindequant( /* (o) quantized gain value */
int index, /* (i) quantization index */
float maxIn,/* (i) maximum of unquantized gain */
int cblen) /* (i) number of quantization indices */
int index, /* (i) quantization index */
float maxIn,/* (i) maximum of unquantized gain */
int cblen) /* (i) number of quantization indices */
{
float scale;
float scale;
/* obtain correct scale factor */
/* obtain correct scale factor */
scale=Math.abs(maxIn);
scale=Math.abs(maxIn);
if (scale < 0.1) {
scale=(float)0.1;
}
if (scale < 0.1) {
scale=(float)0.1;
}
/* select the quantization table and return the decoded value */
/* select the quantization table and return the decoded value */
if (cblen==8) {
return scale*ilbc_constants.gain_sq3Tbl[index];
} else if (cblen==16) {
return scale*ilbc_constants.gain_sq4Tbl[index];
}
else if (cblen==32) {
return scale*ilbc_constants.gain_sq5Tbl[index];
}
if (cblen==8) {
return scale*ilbc_constants.gain_sq3Tbl[index];
} else if (cblen==16) {
return scale*ilbc_constants.gain_sq4Tbl[index];
}
else if (cblen==32) {
return scale*ilbc_constants.gain_sq5Tbl[index];
}
return 0.0f;
return 0.0f;
}
public static void iCBConstruct(
float decvector[], /* (o) Decoded vector */
int decvector_idx,
int index[], /* (i) Codebook indices */
int index_idx,
int gain_index[],/* (i) Gain quantization indices */
int gain_index_idx,
float mem[], /* (i) Buffer for codevector construction */
int mem_idx,
int lMem, /* (i) Length of buffer */
int veclen, /* (i) Length of vector */
int nStages /* (i) Number of codebook stages */
float decvector[], /* (o) Decoded vector */
int decvector_idx,
int index[], /* (i) Codebook indices */
int index_idx,
int gain_index[],/* (i) Gain quantization indices */
int gain_index_idx,
float mem[], /* (i) Buffer for codevector construction */
int mem_idx,
int lMem, /* (i) Length of buffer */
int veclen, /* (i) Length of vector */
int nStages /* (i) Number of codebook stages */
){
int j,k;

@ -35,77 +35,77 @@ class ilbc_ulp {
public ilbc_ulp(int init_mode)
{
mode = init_mode;
mode = init_mode;
if ( (mode != 20) && (mode != 30) )
{
System.out.println("Unknown mode " + init_mode);
return;
}
if ( (mode != 20) && (mode != 30) )
{
System.out.println("Unknown mode " + init_mode);
return;
}
lsf_bits = new int[6][ilbc_constants.ULP_CLASSES+2];
start_bits = new int[ilbc_constants.ULP_CLASSES+2];
startfirst_bits = new int[ilbc_constants.ULP_CLASSES+2];
scale_bits = new int[ilbc_constants.ULP_CLASSES+2];
state_bits = new int[ilbc_constants.ULP_CLASSES+2];
extra_cb_index = new int[ilbc_constants.CB_NSTAGES][ilbc_constants.ULP_CLASSES+2];
extra_cb_gain = new int[ilbc_constants.CB_NSTAGES][ilbc_constants.ULP_CLASSES+2];
cb_index = new int[ilbc_constants.NSUB_MAX][ilbc_constants.CB_NSTAGES][ilbc_constants.ULP_CLASSES+2];
cb_gain = new int[ilbc_constants.NSUB_MAX][ilbc_constants.CB_NSTAGES][ilbc_constants.ULP_CLASSES+2];
lsf_bits = new int[6][ilbc_constants.ULP_CLASSES+2];
start_bits = new int[ilbc_constants.ULP_CLASSES+2];
startfirst_bits = new int[ilbc_constants.ULP_CLASSES+2];
scale_bits = new int[ilbc_constants.ULP_CLASSES+2];
state_bits = new int[ilbc_constants.ULP_CLASSES+2];
extra_cb_index = new int[ilbc_constants.CB_NSTAGES][ilbc_constants.ULP_CLASSES+2];
extra_cb_gain = new int[ilbc_constants.CB_NSTAGES][ilbc_constants.ULP_CLASSES+2];
cb_index = new int[ilbc_constants.NSUB_MAX][ilbc_constants.CB_NSTAGES][ilbc_constants.ULP_CLASSES+2];
cb_gain = new int[ilbc_constants.NSUB_MAX][ilbc_constants.CB_NSTAGES][ilbc_constants.ULP_CLASSES+2];
if (mode == 20)
{
blockl = ilbc_constants.BLOCKL_20MS;
nsub = ilbc_constants.NSUB_20MS;
nasub = ilbc_constants.NASUB_20MS;
lpc_n = ilbc_constants.LPC_N_20MS;
no_of_bytes = ilbc_constants.NO_OF_BYTES_20MS;
no_of_words = ilbc_constants.NO_OF_WORDS_20MS;
state_short_len = ilbc_constants.STATE_SHORT_LEN_20MS;
/* ULP init */
// iLBCenc_inst->ULP_inst=&ULP_20msTbl;
System.arraycopy(ilbc_constants.lsf_bits_20ms, 0, lsf_bits, 0, 6);
System.arraycopy(ilbc_constants.start_bits_20ms, 0, start_bits, 0, ilbc_constants.start_bits_20ms.length);
System.arraycopy(ilbc_constants.startfirst_bits_20ms, 0, startfirst_bits, 0, ilbc_constants.startfirst_bits_20ms.length);
System.arraycopy(ilbc_constants.scale_bits_20ms, 0, scale_bits, 0, ilbc_constants.scale_bits_20ms.length);
System.arraycopy(ilbc_constants.state_bits_20ms, 0, state_bits, 0, ilbc_constants.state_bits_20ms.length);
System.arraycopy(ilbc_constants.extra_cb_index_20ms, 0, extra_cb_index, 0, ilbc_constants.CB_NSTAGES);
System.arraycopy(ilbc_constants.extra_cb_gain_20ms, 0, extra_cb_gain, 0, ilbc_constants.CB_NSTAGES);
System.arraycopy(ilbc_constants.cb_index_20ms, 0, cb_index, 0, ilbc_constants.NSUB_20MS);
System.arraycopy(ilbc_constants.cb_gain_20ms, 0, cb_gain, 0, ilbc_constants.NSUB_20MS);
}
else if (mode == 30)
{
blockl = ilbc_constants.BLOCKL_30MS;
nsub = ilbc_constants.NSUB_30MS;
nasub = ilbc_constants.NASUB_30MS;
lpc_n = ilbc_constants.LPC_N_30MS;
no_of_bytes = ilbc_constants.NO_OF_BYTES_30MS;
no_of_words = ilbc_constants.NO_OF_WORDS_30MS;
state_short_len = ilbc_constants.STATE_SHORT_LEN_30MS;
/* ULP init */
// ULP_inst=&ULP_30msTbl;
System.arraycopy(ilbc_constants.lsf_bits_30ms, 0, lsf_bits, 0, 6);
System.arraycopy(ilbc_constants.start_bits_30ms, 0, start_bits, 0, ilbc_constants.start_bits_30ms.length);
System.arraycopy(ilbc_constants.startfirst_bits_30ms, 0, startfirst_bits, 0, ilbc_constants.startfirst_bits_30ms.length);
System.arraycopy(ilbc_constants.scale_bits_30ms, 0, scale_bits, 0, ilbc_constants.scale_bits_30ms.length);
System.arraycopy(ilbc_constants.state_bits_30ms, 0, state_bits, 0, ilbc_constants.state_bits_30ms.length);
System.arraycopy(ilbc_constants.extra_cb_index_30ms, 0, extra_cb_index, 0, ilbc_constants.CB_NSTAGES);
System.arraycopy(ilbc_constants.extra_cb_gain_30ms, 0, extra_cb_gain, 0, ilbc_constants.CB_NSTAGES);
// System.out.println("nsubmax vaut: " + NSUB_MAX + " vs " + NSUB_30MS + ", alors que la taille de la table est: " + cb_index_30ms.length + " vs " + cb_index.length);
System.arraycopy(ilbc_constants.cb_index_30ms, 0, cb_index, 0, ilbc_constants.NSUB_30MS);
System.arraycopy(ilbc_constants.cb_gain_30ms, 0, cb_gain, 0, ilbc_constants.NSUB_30MS);
}
if (mode == 20)
{
blockl = ilbc_constants.BLOCKL_20MS;
nsub = ilbc_constants.NSUB_20MS;
nasub = ilbc_constants.NASUB_20MS;
lpc_n = ilbc_constants.LPC_N_20MS;
no_of_bytes = ilbc_constants.NO_OF_BYTES_20MS;
no_of_words = ilbc_constants.NO_OF_WORDS_20MS;
state_short_len = ilbc_constants.STATE_SHORT_LEN_20MS;
/* ULP init */
// iLBCenc_inst->ULP_inst=&ULP_20msTbl;
System.arraycopy(ilbc_constants.lsf_bits_20ms, 0, lsf_bits, 0, 6);
System.arraycopy(ilbc_constants.start_bits_20ms, 0, start_bits, 0, ilbc_constants.start_bits_20ms.length);
System.arraycopy(ilbc_constants.startfirst_bits_20ms, 0, startfirst_bits, 0, ilbc_constants.startfirst_bits_20ms.length);
System.arraycopy(ilbc_constants.scale_bits_20ms, 0, scale_bits, 0, ilbc_constants.scale_bits_20ms.length);
System.arraycopy(ilbc_constants.state_bits_20ms, 0, state_bits, 0, ilbc_constants.state_bits_20ms.length);
System.arraycopy(ilbc_constants.extra_cb_index_20ms, 0, extra_cb_index, 0, ilbc_constants.CB_NSTAGES);
System.arraycopy(ilbc_constants.extra_cb_gain_20ms, 0, extra_cb_gain, 0, ilbc_constants.CB_NSTAGES);
System.arraycopy(ilbc_constants.cb_index_20ms, 0, cb_index, 0, ilbc_constants.NSUB_20MS);
System.arraycopy(ilbc_constants.cb_gain_20ms, 0, cb_gain, 0, ilbc_constants.NSUB_20MS);
}
else if (mode == 30)
{
blockl = ilbc_constants.BLOCKL_30MS;
nsub = ilbc_constants.NSUB_30MS;
nasub = ilbc_constants.NASUB_30MS;
lpc_n = ilbc_constants.LPC_N_30MS;
no_of_bytes = ilbc_constants.NO_OF_BYTES_30MS;
no_of_words = ilbc_constants.NO_OF_WORDS_30MS;
state_short_len = ilbc_constants.STATE_SHORT_LEN_30MS;
/* ULP init */
// ULP_inst=&ULP_30msTbl;
System.arraycopy(ilbc_constants.lsf_bits_30ms, 0, lsf_bits, 0, 6);
System.arraycopy(ilbc_constants.start_bits_30ms, 0, start_bits, 0, ilbc_constants.start_bits_30ms.length);
System.arraycopy(ilbc_constants.startfirst_bits_30ms, 0, startfirst_bits, 0, ilbc_constants.startfirst_bits_30ms.length);
System.arraycopy(ilbc_constants.scale_bits_30ms, 0, scale_bits, 0, ilbc_constants.scale_bits_30ms.length);
System.arraycopy(ilbc_constants.state_bits_30ms, 0, state_bits, 0, ilbc_constants.state_bits_30ms.length);
System.arraycopy(ilbc_constants.extra_cb_index_30ms, 0, extra_cb_index, 0, ilbc_constants.CB_NSTAGES);
System.arraycopy(ilbc_constants.extra_cb_gain_30ms, 0, extra_cb_gain, 0, ilbc_constants.CB_NSTAGES);
// System.out.println("nsubmax vaut: " + NSUB_MAX + " vs " + NSUB_30MS + ", alors que la taille de la table est: " + cb_index_30ms.length + " vs " + cb_index.length);
System.arraycopy(ilbc_constants.cb_index_30ms, 0, cb_index, 0, ilbc_constants.NSUB_30MS);
System.arraycopy(ilbc_constants.cb_gain_30ms, 0, cb_gain, 0, ilbc_constants.NSUB_30MS);
}
// for (int i = 0; i < NSUB_MAX; i++) {
// for (int j = 0; j < CB_NSTAGES; j++) {
// for (int k = 0; k < ULP_CLASSES+2; k++) {
// System.out.print(" " + cb_gain[i][j][k]);
// }
// System.out.print(" | ");
// }
// System.out.println("");
// }
// for (int i = 0; i < NSUB_MAX; i++) {
// for (int j = 0; j < CB_NSTAGES; j++) {
// for (int k = 0; k < ULP_CLASSES+2; k++) {
// System.out.print(" " + cb_gain[i][j][k]);
// }
// System.out.print(" | ");
// }
// System.out.println("");
// }
}
}

@ -9,43 +9,43 @@
/**
* DummyProvider class implements KeyProvider interface.
* Used only for testing - activates the hardcoded keys behaviour for SRTP traffic.
*
*
* @author Emanuel Onica (eonica@info.uaic.ro)
*
*/
public class DummyKeyProvider
implements KeyProviderAlgorithm
public class DummyKeyProvider
implements KeyProviderAlgorithm
{
/**
* The constant provider type of this class
*/
private static final KeyProviderAlgorithm.ProviderType providerType =
KeyProviderAlgorithm.ProviderType.DUMMY_PROVIDER;
private int priority;
public DummyKeyProvider(int priority)
{
this.priority = priority;
}
/*
* (non-Javadoc)
* @see net.java.sip.communicator.impl.media.keyshare.KeyProvider#getProviderType()
*/
public KeyProviderAlgorithm.ProviderType getProviderType()
{
return providerType;
}
public int getPriority()
{
return priority;
}
public void setPriority(int priority)
{
this.priority = priority;
}
/**
* The constant provider type of this class
*/
private static final KeyProviderAlgorithm.ProviderType providerType =
KeyProviderAlgorithm.ProviderType.DUMMY_PROVIDER;
private int priority;
public DummyKeyProvider(int priority)
{
this.priority = priority;
}
/*
* (non-Javadoc)
* @see net.java.sip.communicator.impl.media.keyshare.KeyProvider#getProviderType()
*/
public KeyProviderAlgorithm.ProviderType getProviderType()
{
return providerType;
}
public int getPriority()
{
return priority;
}
public void setPriority(int priority)
{
this.priority = priority;
}
}

@ -16,8 +16,8 @@
*
* @author Jean Lorchat
*/
public class AlsaStream
implements PushBufferStream, Runnable
public class AlsaStream
implements PushBufferStream, Runnable
{
protected ContentDescriptor cd = new ContentDescriptor(ContentDescriptor.RAW);
protected int maxDataLength;
@ -32,13 +32,13 @@ public class AlsaStream
private native void jni_alsa_delete();
int seqNo = 0;
/**
* Dynamically loads JNI object. Will fail if non-Linux
* Dynamically loads JNI object. Will fail if non-Linux
* or when libjmf_alsa.so is outside of the LD_LIBRARY_PATH
*/
*/
static {
System.loadLibrary("jmf_alsa");
System.loadLibrary("jmf_alsa");
}
/**
@ -49,33 +49,33 @@ public class AlsaStream
*/
public AlsaStream() {
audioFormat = new AudioFormat(AudioFormat.LINEAR,
8000.0,
16,
1,
AudioFormat.LITTLE_ENDIAN,
AudioFormat.SIGNED,
16,
Format.NOT_SPECIFIED,
Format.byteArray);
audioFormat = new AudioFormat(AudioFormat.LINEAR,
8000.0,
16,
1,
AudioFormat.LITTLE_ENDIAN,
AudioFormat.SIGNED,
16,
Format.NOT_SPECIFIED,
Format.byteArray);
maxDataLength = 160;
jni_alsa_init();
thread = new Thread(this);
maxDataLength = 160;
jni_alsa_init();
thread = new Thread(this);
}
/**
* Methods required for SourceStream interface
*
*/
/**
* We are providing access to raw data
*
*/
public ContentDescriptor getContentDescriptor() {
return cd;
return cd;
}
/**
@ -83,7 +83,7 @@ public ContentDescriptor getContentDescriptor() {
*
*/
public long getContentLength() {
return LENGTH_UNKNOWN;
return LENGTH_UNKNOWN;
}
/**
@ -91,15 +91,15 @@ public long getContentLength() {
*
*/
public boolean endOfStream() {
return false;
return false;
}
/**
* Tell whoever has interest how we are going to send the data
* Tell whoever has interest how we are going to send the data
*
*/
public Format getFormat() {
return audioFormat;
return audioFormat;
}
/**
@ -114,36 +114,36 @@ public Format getFormat() {
* implemented, but we love to be future-proof, isn't it ?
*/
public void read(Buffer buffer) throws IOException {
synchronized (this) {
Object outdata = buffer.getData();
if (outdata == null ||
!(outdata.getClass() == Format.byteArray) ||
((byte[])outdata).length < maxDataLength) {
outdata = new byte[maxDataLength];
buffer.setData(outdata);
}
buffer.setFormat(audioFormat);
buffer.setTimeStamp(1000000000 / 8);
jni_alsa_read((byte[])outdata);
buffer.setSequenceNumber(seqNo);
buffer.setLength(maxDataLength);
buffer.setFlags(0);
buffer.setHeader(null);
seqNo++;
}
}
synchronized (this) {
Object outdata = buffer.getData();
if (outdata == null ||
!(outdata.getClass() == Format.byteArray) ||
((byte[])outdata).length < maxDataLength) {
outdata = new byte[maxDataLength];
buffer.setData(outdata);
}
buffer.setFormat(audioFormat);
buffer.setTimeStamp(1000000000 / 8);
jni_alsa_read((byte[])outdata);
buffer.setSequenceNumber(seqNo);
buffer.setLength(maxDataLength);
buffer.setFlags(0);
buffer.setHeader(null);
seqNo++;
}
}
/**
* Dunno about that piece yet...
*
*/
public void setTransferHandler(BufferTransferHandler transferHandler) {
synchronized (this) {
this.transferHandler = transferHandler;
notifyAll();
}
synchronized (this) {
this.transferHandler = transferHandler;
notifyAll();
}
}
/**
@ -151,14 +151,14 @@ public void setTransferHandler(BufferTransferHandler transferHandler) {
*
*/
void start(boolean started) {
synchronized (this) {
this.started = started;
if (started && !thread.isAlive()) {
thread = new Thread(this);
thread.start();
}
notifyAll();
}
synchronized (this) {
this.started = started;
if (started && !thread.isAlive()) {
thread = new Thread(this);
thread.start();
}
notifyAll();
}
}
/**
@ -167,35 +167,35 @@ void start(boolean started) {
*
*/
public void run() {
while (started) {
synchronized (this) {
while (transferHandler == null && started) {
try {
wait(1000);
} catch (InterruptedException ie) {
}
}
}
while (started) {
synchronized (this) {
while (transferHandler == null && started) {
try {
wait(1000);
} catch (InterruptedException ie) {
}
}
}
if (started && transferHandler != null) {
transferHandler.transferData(this);
try {
Thread.currentThread().sleep(1);
} catch (InterruptedException ise) {
}
}
if (started && transferHandler != null) {
transferHandler.transferData(this);
try {
Thread.currentThread().sleep(1);
} catch (InterruptedException ise) {
}
}
}
}
}
/**
* Gives control information to the caller
*
*/
*/
public Object [] getControls() {
return controls;
return controls;
}
/**

@ -15,8 +15,8 @@
*
* @author Jean Lorchat
*/
public class DataSource
extends PushBufferDataSource
public class DataSource
extends PushBufferDataSource
{
protected Object [] controls = new Object[0];
protected boolean started = false;
@ -28,38 +28,38 @@ public class DataSource
public DataSource() {
}
/**
* Tell we are a raw datasource
*
* @return "raw"
*/
public String getContentType() {
if (!connected){
if (!connected){
System.err.println("Error: DataSource not connected");
return null;
}
return contentType;
return contentType;
}
/**
* Connect the datasource
*/
public void connect() throws IOException {
if (connected)
if (connected)
return;
connected = true;
connected = true;
}
/**
* Disconnect the datasource
*/
public void disconnect() {
try {
try {
if (started)
stop();
} catch (IOException e) {}
connected = false;
connected = false;
}
/**
@ -72,8 +72,8 @@ public void start() throws IOException {
if (started)
return;
started = true;
stream.start(true);
started = true;
stream.start(true);
}
/**
@ -81,20 +81,20 @@ public void start() throws IOException {
*/
public void stop() throws IOException {
if ((!connected) || (!started))
return;
if ((!connected) || (!started))
return;
started = false;
stream.start(false);
started = false;
stream.start(false);
}
/**
* Gives control information to the caller
*
*/
*/
public Object [] getControls() {
return controls;
return controls;
}
/**
@ -124,7 +124,7 @@ public Object getControl(String controlType) {
* @return DURATION_UNKNOWN
*/
public Time getDuration() {
return duration;
return duration;
}
/**
@ -136,11 +136,11 @@ public Time getDuration() {
* @return Array of one stream
*/
public PushBufferStream [] getStreams() {
if (streams == null) {
streams = new AlsaStream[1];
stream = streams[0] = new AlsaStream();
}
return streams;
if (streams == null) {
streams = new AlsaStream[1];
stream = streams[0] = new AlsaStream();
}
return streams;
}
}

@ -27,7 +27,7 @@ public final class TrayMenuFactory
/**
* Handles the <tt>ActionEvent</tt> when one of the menu items is selected.
*
*
* @param evt the event containing the menu item name
*/
private static void actionPerformed(ActionEvent evt)
@ -94,11 +94,11 @@ private static void addSeparator(Object trayMenu)
public static Object createTrayMenu(SystrayServiceJdicImpl tray,
boolean swing)
{
// Enable swing for java 1.6 except for the mac version
// Enable swing for java 1.6 except for the mac version
if (!swing && !System.getProperty("os.name").startsWith("Mac"))
swing = true;
Object trayMenu = swing ? new JPopupMenu() : new PopupMenu();
Object trayMenu = swing ? new JPopupMenu() : new PopupMenu();
ActionListener listener = new ActionListener()
{
public void actionPerformed(ActionEvent event)

@ -31,17 +31,17 @@ public class ContactTimerSSHImpl
{
private static final Logger logger
= Logger.getLogger(OperationSetFileTransferSSHImpl.class);
/**
* The contact ID of the remote machine
*/
private ContactSSH sshContact;
/**
* PersistentPresence Identifer assoiciated with SSH Contact
*/
private OperationSetPersistentPresenceSSHImpl persistentPresence;
/**
* The method which is called at regular intervals to update the status
* of remote machines
@ -54,7 +54,7 @@ public void run()
{
InetAddress remoteMachine = InetAddress.getByName(
sshContact.getSSHConfigurationForm().getHostName());
//check if machine is reachable
if(remoteMachine.isReachable(
sshContact.getSSHConfigurationForm().getUpdateInterval()))
@ -66,14 +66,14 @@ public void run()
// change status to online
persistentPresence.changeContactPresenceStatus(
sshContact, SSHStatusEnum.ONLINE);
logger.debug("SSH Host " + sshContact
.getSSHConfigurationForm().getHostName() + ": Online");
.getSSHConfigurationForm().getHostName() + ": Online");
}
}
else throw new IOException();
}
catch (IOException ex)
{
@ -83,7 +83,7 @@ public void run()
{
persistentPresence.changeContactPresenceStatus(
sshContact, SSHStatusEnum.OFFLINE);
logger.debug("SSH Host " + sshContact.getSSHConfigurationForm()
.getHostName() + ": Offline");
}
@ -99,5 +99,5 @@ public ContactTimerSSHImpl(ContactSSH sshContact)
this.persistentPresence = (OperationSetPersistentPresenceSSHImpl)
sshContact.getParentPresenceOperationSet();
}
}

@ -10,10 +10,10 @@
import ymsg.network.*;
/**
* Extends The Yahoo session to have access to some
* Extends The Yahoo session to have access to some
* protected functionality
* Not working for now.
*
*
* @author Damian Minkov
*/
public class YahooSession
@ -22,12 +22,12 @@ public class YahooSession
/**
* Renames a group. Not working for now
*/
public void renameGroup(String oldName, String newName)
throws IOException
public void renameGroup(String oldName, String newName)
throws IOException
{
transmitGroupRename(oldName, newName);
}
/**
* Removes the server part from the given id
*/
@ -37,7 +37,7 @@ public static String getYahooUserID(String id)
? id.substring(0, id.indexOf("@"))
: id;
}
/**
* Sending typing notifications
* @param to user we are notifing
@ -45,20 +45,20 @@ public static String getYahooUserID(String id)
*/
void keyTyped(String to, String from)
{
try {
transmitNotify(to, from, true, " ", NOTIFY_TYPING);
try {
transmitNotify(to, from, true, " ", NOTIFY_TYPING);
}catch(IOException e){}
}
/**
* Sending stop typing notifications
* @param to user we are notifing
* @param from our user id
*/
void stopTyping(String to, String from)
{
try {
transmitNotify(to, from, false, " ", NOTIFY_TYPING);
{
try {
transmitNotify(to, from, false, " ", NOTIFY_TYPING);
}catch(IOException e){}
}
}

@ -38,14 +38,14 @@ class MyRenderer implements TableCellRenderer
{
// Create a JLabel for use as a renderer and pre-load this label
// with an icon image.
private JLabel l;
MyRenderer(JLabel JLIcon)
{
this.l = JLIcon;
}
public Component getTableCellRendererComponent (
JTable table,
Object value,
@ -55,11 +55,11 @@ public Component getTableCellRendererComponent (
int column)
{
// Extract the original header renderer for this column.
TableCellRenderer tcr = table.getTableHeader().getDefaultRenderer ();
// Extract the component used to render the column header.
Component c = tcr.getTableCellRendererComponent (
table,
value,
@ -67,22 +67,22 @@ public Component getTableCellRendererComponent (
hasFocus,
row,
column);
// Establish the font, foreground color, and border for the
// JLabel so that the rendered header will look the same as the
// other rendered headers.
l.setFont (c.getFont ());
l.setForeground (c.getForeground ());
l.setBorder (((JComponent) c).getBorder ());
// Establish the column name.
l.setText ((String) value);
// Return the cached JLabel a the renderer for this column
// header.
return l;
}
}
@ -193,9 +193,9 @@ public class ListMulti extends JPanel
String strTmp = new String();
model = new ListModel(columns, 0);
listMulti = new MyJTable(model);
listMulti.setRowSelectionAllowed(true);
listMulti.getTableHeader().setReorderingAllowed(false);
listMulti.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
@ -212,7 +212,7 @@ public class ListMulti extends JPanel
{
tmp.setHeaderValue((String)columns[i]);
}
if(i == 0)
{
tmp.setMaxWidth(67);
@ -226,7 +226,7 @@ else if(i < columns.length - 1)
tmp.setPreferredWidth(25);
}
}
/* for headers */
JScrollPane scrollPane = new JScrollPane(listMulti);
this.add(scrollPane);
@ -236,9 +236,9 @@ else if(i < columns.length - 1)
public void addLine(NotificationsTableEntry dataNTE)
{
Object row[] = new Object[5];
row[0] = dataNTE.getEnabled()
? new String("enable")
row[0] = dataNTE.getEnabled()
? new String("enable")
: new String("disable");
row[1] = (dataNTE.getProgram()
&& (dataNTE.getProgramFile().trim().length() > 0))
@ -250,10 +250,10 @@ public void addLine(NotificationsTableEntry dataNTE)
? new String("Yes")
: new String("No");
row[4] = dataNTE.getEvent();
this.addLine(row);
}
public void addLine(Object data[])
{
if(data.length != model.getColumnCount())
@ -264,7 +264,7 @@ public void addLine(Object data[])
model.addRow(data);
}
public int removeLine(int num)
{
model.removeRow(num);
@ -285,25 +285,25 @@ public String getValue(int line, int column)
{
return (String)listMulti.getValueAt(line, column);
}
public void setValue(String value, int line, int column)
{
listMulti.setValueAt(value, line, column);
}
/*
* Gives the number of lines of the Table.
* Gives the number of lines of the Table.
*/
public int getRowCount()
{
return listMulti.getRowCount();
}
public void setLine(NotificationsTableEntry dataNTE, int line)
{
Object row[] = new Object[5];
row[0] = dataNTE.getEnabled()
? new String("enable")
: new String("disable");
@ -317,10 +317,10 @@ public void setLine(NotificationsTableEntry dataNTE, int line)
? new String("Yes")
: new String("No");
row[4] = dataNTE.getEvent();
this.setLine(row,line);
}
public void setLine(Object data[], int line)
{
int i;
@ -329,16 +329,16 @@ public void setLine(Object data[], int line)
setValue((String)data[i], line, i);
}
}
/*
* Adding a mouse listener on the table.
*/
public void addMouseListener(MouseListener mL)
{
listMulti.addMouseListener(mL);
}
/*
* Allows selection of a line or a group of lines.
*/
@ -346,7 +346,7 @@ public void setRowSelectionInterval(int row, int col)
{
listMulti.setRowSelectionInterval(row,col);
}
/*
* Returne the current line number
*/
@ -354,8 +354,8 @@ public int rowAtPoint(Point p)
{
return listMulti.rowAtPoint(p);
}
/*
* Extends the JTable to make easier to use whith the pluggin
*/
@ -365,7 +365,7 @@ static class MyJTable extends JTable
{
super(model);
}
protected JTableHeader createDefaultTableHeader()
{
return new JTableHeader(columnModel)
@ -374,7 +374,7 @@ public String getToolTipText(MouseEvent e)
{
java.awt.Point p = e.getPoint();
int index = columnModel.getColumnIndexAtX(p.x);
int realIndex =
int realIndex =
columnModel.getColumn(index).getModelIndex();
return NotificationConfigurationPanel.columnToolTips[
realIndex];

@ -13,41 +13,41 @@
/**
* Activates the profiler plug-in.
*
*
* @author Vladimir Skarupelov
*/
public class ProfilerActivator implements BundleActivator {
public static BundleContext bundleContext;
Logger logger = Logger.getLogger(ProfilerActivator.class);
private ServiceRegistration menuRegistration = null;
public void start(BundleContext bc) throws Exception {
Logger logger = Logger.getLogger(ProfilerActivator.class);
private ServiceRegistration menuRegistration = null;
public void start(BundleContext bc) throws Exception {
bundleContext = bc;
SettingsWindowMenuEntry menuEntry = new SettingsWindowMenuEntry(
SettingsWindowMenuEntry menuEntry = new SettingsWindowMenuEntry(
Container.CONTAINER_TOOLS_MENU);
Hashtable<String, String> toolsMenuFilter =
new Hashtable<String, String>();
Hashtable<String, String> toolsMenuFilter =
new Hashtable<String, String>();
toolsMenuFilter.put(Container.CONTAINER_ID,
Container.CONTAINER_TOOLS_MENU.getID());
menuRegistration = bc.registerService(PluginComponent.class
.getName(), menuEntry, toolsMenuFilter);
logger.info("PROFILER4J [REGISTERED]");
}
}
public void stop(BundleContext bc) throws Exception {
if (menuRegistration != null)
public void stop(BundleContext bc) throws Exception {
if (menuRegistration != null)
{
menuRegistration.unregister();
logger.info("PROFILER4J [UNREGISTERED]");
}
}
}
}

@ -8,7 +8,7 @@
/**
* Menu entry for the profiler plug-in
*
*
* @author Vladimir Skarupelov
*/
import java.awt.event.*;
@ -32,9 +32,9 @@ public void actionPerformed(ActionEvent e)
{
Prefs prefs = new Prefs();
System.setProperty("swing.aatext",
String.valueOf(prefs.isAntialiasing()));
System.setProperty("swing.aatext",
String.valueOf(prefs.isAntialiasing()));
final Console app = new Console(prefs);
app.connect();
MainFrame f = new MainFrame(app);
@ -79,7 +79,7 @@ public int getPositionIndex()
return -1;
}
public boolean isNativeComponent() {
return false;
}
public boolean isNativeComponent() {
return false;
}
}

@ -341,43 +341,43 @@ public void setKeepAliveInterval(String keepAliveInterval)
{
this.keepAliveInterval = keepAliveInterval;
}
/**
* If default call encryption is enabled
*
*
* @return If default call encryption is enabled
*/
public boolean isDefaultEncryption()
{
return defaultEncryption;
return defaultEncryption;
}
/**
* Sets default call encryption
*
*
* @param defaultEncryption if we want to set call encryption on as default
*/
public void setDefaultEncryption(boolean defaultEncryption)
{
this.defaultEncryption = defaultEncryption;
this.defaultEncryption = defaultEncryption;
}
/**
* Sets SIP ZRTP attribute support
*
*
* @param sipZrtpAttribute include the ZRTP attribute to SIP/SDP
*/
public void setSipZrtpAttribute(boolean sipZrtpAttribute) {
this.sipZrtpAttribute = sipZrtpAttribute;
}
/**
* Check if to include the ZRTP attribute to SIP/SDP
*
*
* @return include the ZRTP attribute to SIP/SDP
*/
public boolean isSipZrtpAttribute() {
return sipZrtpAttribute;
}
}
}

@ -17,7 +17,7 @@ public class OperationNotSupportedException
{
private static final long serialVersionUID = 0L;
/**
/**
* Creates an OperationNotSupportedException instance with the specified
* reason phrase.
* @param message a detailed message explaining any particular details as

@ -21,7 +21,7 @@ public class CallChangeEvent
{
private static final long serialVersionUID = 0L;
/**
/**
* An event type indicating that the corresponding event is caused by a
* change of the Call state.
*/

@ -12,7 +12,7 @@
/**
* A class representing the event of a call reception.
*
*
* @author Emil Ivov
*/
public class CallReceivedEvent
@ -20,7 +20,7 @@ public class CallReceivedEvent
{
private static final long serialVersionUID = 0L;
public CallReceivedEvent(Call call)
public CallReceivedEvent(Call call)
{
super(call);
}

@ -16,7 +16,7 @@ public class SIPCommCheckBox
{
private static final long serialVersionUID = 0L;
private static final boolean setContentAreaFilled = isWindows();
private static final boolean setContentAreaFilled = isWindows();
private static boolean isWindows()
{

@ -18,7 +18,7 @@ public class XMLException
{
private static final long serialVersionUID = 0L;
/**
/**
* Constructs a new XMLException with the specified detail message and cause.
*
* @param message a message specifying the reason that caused the

@ -10,10 +10,10 @@
* This class produces the RSS samples we use in our tests. Right now we're
* using excerpts from a real life feed, but that could change to a more
* lightweight approach.
*
*
* Feed components are stored as inline string to minimize overhead while
* testing.
*
*
* @author Mihai Balan
*/
public class FeedFactory {
@ -21,472 +21,472 @@ public class FeedFactory {
* String representing the header of a RSS feed.
*/
private static String rssHeader =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+"<rss version=\"2.0\""
+" xmlns:content=\"http://purl.org/rss/1.0/modules/content/\""
+" xmlns:wfw=\"http://wellformedweb.org/CommentAPI/\""
+" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">"
+" <channel>"
+" <title>miChou's photoblog</title>"
+" <link>http://mihaibalan.wordpress.com</link>"
+" <description>The world through my eyes</description>"
+" <pubDate>Mon, 20 Aug 2007 22:20:57 +0000</pubDate>"
+" <generator>http://wordpress.org/?v=MU</generator>"
+" <language>ro</language>";
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+"<rss version=\"2.0\""
+" xmlns:content=\"http://purl.org/rss/1.0/modules/content/\""
+" xmlns:wfw=\"http://wellformedweb.org/CommentAPI/\""
+" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">"
+" <channel>"
+" <title>miChou's photoblog</title>"
+" <link>http://mihaibalan.wordpress.com</link>"
+" <description>The world through my eyes</description>"
+" <pubDate>Mon, 20 Aug 2007 22:20:57 +0000</pubDate>"
+" <generator>http://wordpress.org/?v=MU</generator>"
+" <language>ro</language>";
/**
* String containing the body of a RSS feed.
*/
private static String rssBody =
" <item>"
+" <title>Milky wave</title>"
+" <link>http://mihaibalan.wordpress.com/2007/08/15/milky-wave/</link>"
+" <comments>http://mihaibalan.wordpress.com/2007/08/15/milky-wave/#co"
+"mments</comments>"
+" <pubDate>Tue, 14 Aug 2007 22:02:48 +0000</pubDate>"
+" <dc:creator>mich0u</dc:creator>"
+" <category><![CDATA[flash]]></category>"
+" <guid isPermaLink=\"false\">http://mihaibalan.wordpress.com/2007/08"
+"/15/milky-wave/</guid>"
+" <description><![CDATA["
+"]]></description>"
+" <content:encoded><![CDATA[<div class='snap_preview'><p align=\"cent"
+"er\"><a href=\"http://www.flickr.com/photos/mi-chou/1092690810/\" title="
+"\"Photo Sharing\"><img src=\"http://farm2.static.flickr.com/1419/10926908"
+"10_79510d9695.jpg\" alt=\"Milky wave\" style=\"border:medium none;\" heig"
+"ht=\"288\" width=\"500\" /></a></p>"
+"</div>]]></content:encoded>"
+" <wfw:commentRss>http://mihaibalan.wordpress.com/2007/08/15/milky-"
+"wave/feed/</wfw:commentRss>"
+" </item>"
+" <item>"
+" <title>Light patterns</title>"
+" <link>http://mihaibalan.wordpress.com/2007/08/14/light-patterns/</"
+"link>"
+" <comments>http://mihaibalan.wordpress.com/2007/08/14/light-pattern"
+"s/#comments</comments>"
+" <pubDate>Mon, 13 Aug 2007 22:02:32 +0000</pubDate>"
+" <dc:creator>mich0u</dc:creator>"
+" <category><![CDATA[dark]]></category>"
+" <category><![CDATA[architecture]]></category>"
+" <guid isPermaLink=\"false\">http://mihaibalan.wordpress.com/2007/08"
+"/14/light-patterns/</guid>"
+" <description><![CDATA["
+"]]></description>"
+" <content:encoded><![CDATA[<div class='snap_preview'><p align=\"cent"
+"er\"><a href=\"http://www.flickr.com/photos/mi-chou/1091949941/\" title="
+"\"Photo Sharing\"><img src=\"http://farm2.static.flickr.com/1055/10919499"
+"41_34853b5130.jpg\" alt=\"Light patterns\" style=\"border:medium none;\" "
+"height=\"386\" width=\"500\" /></a></p>"
+"</div>]]></content:encoded>"
+" <wfw:commentRss>http://mihaibalan.wordpress.com/2007/08/14/light-p"
+"atterns/feed/</wfw:commentRss>"
+" </item>";
" <item>"
+" <title>Milky wave</title>"
+" <link>http://mihaibalan.wordpress.com/2007/08/15/milky-wave/</link>"
+" <comments>http://mihaibalan.wordpress.com/2007/08/15/milky-wave/#co"
+"mments</comments>"
+" <pubDate>Tue, 14 Aug 2007 22:02:48 +0000</pubDate>"
+" <dc:creator>mich0u</dc:creator>"
+" <category><![CDATA[flash]]></category>"
+" <guid isPermaLink=\"false\">http://mihaibalan.wordpress.com/2007/08"
+"/15/milky-wave/</guid>"
+" <description><![CDATA["
+"]]></description>"
+" <content:encoded><![CDATA[<div class='snap_preview'><p align=\"cent"
+"er\"><a href=\"http://www.flickr.com/photos/mi-chou/1092690810/\" title="
+"\"Photo Sharing\"><img src=\"http://farm2.static.flickr.com/1419/10926908"
+"10_79510d9695.jpg\" alt=\"Milky wave\" style=\"border:medium none;\" heig"
+"ht=\"288\" width=\"500\" /></a></p>"
+"</div>]]></content:encoded>"
+" <wfw:commentRss>http://mihaibalan.wordpress.com/2007/08/15/milky-"
+"wave/feed/</wfw:commentRss>"
+" </item>"
+" <item>"
+" <title>Light patterns</title>"
+" <link>http://mihaibalan.wordpress.com/2007/08/14/light-patterns/</"
+"link>"
+" <comments>http://mihaibalan.wordpress.com/2007/08/14/light-pattern"
+"s/#comments</comments>"
+" <pubDate>Mon, 13 Aug 2007 22:02:32 +0000</pubDate>"
+" <dc:creator>mich0u</dc:creator>"
+" <category><![CDATA[dark]]></category>"
+" <category><![CDATA[architecture]]></category>"
+" <guid isPermaLink=\"false\">http://mihaibalan.wordpress.com/2007/08"
+"/14/light-patterns/</guid>"
+" <description><![CDATA["
+"]]></description>"
+" <content:encoded><![CDATA[<div class='snap_preview'><p align=\"cent"
+"er\"><a href=\"http://www.flickr.com/photos/mi-chou/1091949941/\" title="
+"\"Photo Sharing\"><img src=\"http://farm2.static.flickr.com/1055/10919499"
+"41_34853b5130.jpg\" alt=\"Light patterns\" style=\"border:medium none;\" "
+"height=\"386\" width=\"500\" /></a></p>"
+"</div>]]></content:encoded>"
+" <wfw:commentRss>http://mihaibalan.wordpress.com/2007/08/14/light-p"
+"atterns/feed/</wfw:commentRss>"
+" </item>";
/**
* String containing the updates to the RSS feed.
*/
private static String rssBodyUpdate =
" <item>"
+" <title>Tuig - The show goes on</title>"
+" <link>http://mihaibalan.wordpress.com/2007/08/17/tuig-the-show-goes"
+"-on/</link>"
+" <comments>http://mihaibalan.wordpress.com/2007/08/17/tuig-the-show"
+"-goes-on/#comments</comments>"
+" <pubDate>Thu, 16 Aug 2007 22:05:53 +0000</pubDate>"
+" <dc:creator>mich0u</dc:creator>"
+" <category><![CDATA[water]]></category>"
+" <category><![CDATA[people]]></category>"
+" <guid isPermaLink=\"false\">http://mihaibalan.wordpress.com/2007/08"
+"/17/tuig-the-show-goes-on/</guid>"
+" <description><![CDATA["
+"]]></description>"
+" <content:encoded><![CDATA[<div class='snap_preview'><p align=\"cen"
+"ter\"><a href=\"http://www.flickr.com/photos/mi-chou/1030251126/\" title="
+"\"Photo Sharing\"><img src=\"http://farm2.static.flickr.com/1361/10302511"
+"26_9a5d311039.jpg\" alt=\"Tuig - The show goes on\" style=\"border:medium"
+" none;\" height=\"340\" width=\"500\" /></a></p>"
+"</div>]]></content:encoded>"
+" <wfw:commentRss>http://mihaibalan.wordpress.com/2007/08/17/tuig-the"
+"-show-goes-on/feed/</wfw:commentRss>"
+" </item>"
+" <item>"
+" <title>Tuig - Patiently waiting</title>"
+" <link>http://mihaibalan.wordpress.com/2007/08/16/tuig-patiently-wai"
+"ting/</link>"
+" <comments>http://mihaibalan.wordpress.com/2007/08/16/tuig-patiently"
+"-waiting/#comments</comments>"
+" <pubDate>Wed, 15 Aug 2007 22:03:55 +0000</pubDate>"
+" <dc:creator>mich0u</dc:creator>"
+" <category><![CDATA[sky]]></category>"
+" <category><![CDATA[urban]]></category>"
+" <category><![CDATA[dark]]></category>"
+" <guid isPermaLink=\"false\">http://mihaibalan.wordpress.com/2007/0"
+"8/16/tuig-patiently-waiting/</guid>"
+" <description><![CDATA["
+"]]></description>"
+" <content:encoded><![CDATA[<div class='snap_preview'><p align=\"cent"
+"er\"><a href=\"http://www.flickr.com/photos/mi-chou/1030250394/\" title="
+"\"Photo Sharing\"><img src=\"http://farm2.static.flickr.com/1029/10302503"
+"94_687df58297.jpg\" alt=\"Tuig - Patiently waiting\" style=\"border:mediu"
+"m none;\" height=\"500\" width=\"410\" /></a></p>"
+"<p> <a href=\"http://mihaibalan.wordpress.com/2007/08/16/tuig-patiently-w"
+"aiting/#more-118\" class=\"more-link\">(more&#8230;)</a></p>"
+"</div>]]></content:encoded>"
+" <wfw:commentRss>http://mihaibalan.wordpress.com/2007/08/16/tuig-pa"
+"tiently-waiting/feed/</wfw:commentRss>"
+" </item>";
private static String rssBodyUpdate =
" <item>"
+" <title>Tuig - The show goes on</title>"
+" <link>http://mihaibalan.wordpress.com/2007/08/17/tuig-the-show-goes"
+"-on/</link>"
+" <comments>http://mihaibalan.wordpress.com/2007/08/17/tuig-the-show"
+"-goes-on/#comments</comments>"
+" <pubDate>Thu, 16 Aug 2007 22:05:53 +0000</pubDate>"
+" <dc:creator>mich0u</dc:creator>"
+" <category><![CDATA[water]]></category>"
+" <category><![CDATA[people]]></category>"
+" <guid isPermaLink=\"false\">http://mihaibalan.wordpress.com/2007/08"
+"/17/tuig-the-show-goes-on/</guid>"
+" <description><![CDATA["
+"]]></description>"
+" <content:encoded><![CDATA[<div class='snap_preview'><p align=\"cen"
+"ter\"><a href=\"http://www.flickr.com/photos/mi-chou/1030251126/\" title="
+"\"Photo Sharing\"><img src=\"http://farm2.static.flickr.com/1361/10302511"
+"26_9a5d311039.jpg\" alt=\"Tuig - The show goes on\" style=\"border:medium"
+" none;\" height=\"340\" width=\"500\" /></a></p>"
+"</div>]]></content:encoded>"
+" <wfw:commentRss>http://mihaibalan.wordpress.com/2007/08/17/tuig-the"
+"-show-goes-on/feed/</wfw:commentRss>"
+" </item>"
+" <item>"
+" <title>Tuig - Patiently waiting</title>"
+" <link>http://mihaibalan.wordpress.com/2007/08/16/tuig-patiently-wai"
+"ting/</link>"
+" <comments>http://mihaibalan.wordpress.com/2007/08/16/tuig-patiently"
+"-waiting/#comments</comments>"
+" <pubDate>Wed, 15 Aug 2007 22:03:55 +0000</pubDate>"
+" <dc:creator>mich0u</dc:creator>"
+" <category><![CDATA[sky]]></category>"
+" <category><![CDATA[urban]]></category>"
+" <category><![CDATA[dark]]></category>"
+" <guid isPermaLink=\"false\">http://mihaibalan.wordpress.com/2007/0"
+"8/16/tuig-patiently-waiting/</guid>"
+" <description><![CDATA["
+"]]></description>"
+" <content:encoded><![CDATA[<div class='snap_preview'><p align=\"cent"
+"er\"><a href=\"http://www.flickr.com/photos/mi-chou/1030250394/\" title="
+"\"Photo Sharing\"><img src=\"http://farm2.static.flickr.com/1029/10302503"
+"94_687df58297.jpg\" alt=\"Tuig - Patiently waiting\" style=\"border:mediu"
+"m none;\" height=\"500\" width=\"410\" /></a></p>"
+"<p> <a href=\"http://mihaibalan.wordpress.com/2007/08/16/tuig-patiently-w"
+"aiting/#more-118\" class=\"more-link\">(more&#8230;)</a></p>"
+"</div>]]></content:encoded>"
+" <wfw:commentRss>http://mihaibalan.wordpress.com/2007/08/16/tuig-pa"
+"tiently-waiting/feed/</wfw:commentRss>"
+" </item>";
/**
* String containing the body of a new RSS feed.
*/
private static String rssBodyNew = " <item>"
+" <title>I see trees of green and skies of blue</title>"
+" <link>http://mihaibalan.wordpress.com/2007/08/21/i-see-trees-of-gr"
+"een-and-skies-of-blue/</link>"
+" <comments>http://mihaibalan.wordpress.com/2007/08/21/i-see-trees-of"
+"-green-and-skies-of-blue/#comments</comments>"
+" <pubDate>Mon, 20 Aug 2007 22:20:57 +0000</pubDate>"
+" <dc:creator>mich0u</dc:creator>"
+" <category><![CDATA[tree]]></category>"
+" <category><![CDATA[bucharest]]></category>"
+" <category><![CDATA[architecture]]></category>"
+" <guid isPermaLink=\"false\">http://mihaibalan.wordpress.com/2007"
+"/08/21/i-see-trees-of-green-and-skies-of-blue/</guid>"
+" <description><![CDATA["
+"]]></description>"
+" <content:encoded><![CDATA[<div class='snap_preview'><p align=\"cent"
+"er\"><a href=\"http://www.zooomr.com/photos/michou/2997760/\" title=\"Ph"
+"oto Sharing\"><img src=\"http://static.zooomr.com/images/2997760_f5a39d2a"
+"db.jpg\" alt=\"I see trees of green, and skies of blue\" style=\"border:"
+"medium none;\" height=\"340\" width=\"500\" /></a></p>"
+"</div>]]></content:encoded>"
+" <wfw:commentRss>http://mihaibalan.wordpress.com/2007/08/21/i-see"
+"-trees-of-green-and-skies-of-blue/feed/</wfw:commentRss>"
+" </item>"
+" <item>"
+" <title>Tuig - If I could turn back time</title>"
+" <link>http://mihaibalan.wordpress.com/2007/08/20/tuig-if-i-could-"
+"turn-back-time/</link>"
+" <comments>http://mihaibalan.wordpress.com/2007/08/20/tuig-if-i-"
+"could-turn-back-time/#comments</comments>"
+" <pubDate>Sun, 19 Aug 2007 22:05:53 +0000</pubDate>"
+" <dc:creator>mich0u</dc:creator>"
+" <category><![CDATA[light]]></category>"
+" <category><![CDATA[long exposure]]></category>"
+" <category><![CDATA[dark]]></category>"
+" <guid isPermaLink=\"false\">http://mihaibalan.wordpress.com/2007/"
+"08/20/tuig-if-i-could-turn-back-time/</guid>"
+" <description><![CDATA["
+"]]></description>"
+" <content:encoded><![CDATA[<div class='snap_preview'><p align=\"cent"
+"er\"><a href=\"http://www.flickr.com/photos/mi-chou/1029399905/\" title="
+"\"Photo Sharing\"><img src=\"http://farm2.static.flickr.com/1191/10293999"
+"05_08e5d41b89.jpg\" alt=\"Tuig - If I could roll back time\" style=\""
+"border:medium none;\" height=\"383\" width=\"500\" /></a></p>"
+"<p> <a href=\"http://mihaibalan.wordpress.com/2007/08/20/tuig-if-i-could-"
+"turn-back-time/#more-122\" class=\"more-link\">(more&#8230;)</a></p>"
+"</div>]]></content:encoded>"
+" <wfw:commentRss>http://mihaibalan.wordpress.com/2007/08/20/tuig-if"
+"-i-could-turn-back-time/feed/</wfw:commentRss>"
+" </item>";
+" <title>I see trees of green and skies of blue</title>"
+" <link>http://mihaibalan.wordpress.com/2007/08/21/i-see-trees-of-gr"
+"een-and-skies-of-blue/</link>"
+" <comments>http://mihaibalan.wordpress.com/2007/08/21/i-see-trees-of"
+"-green-and-skies-of-blue/#comments</comments>"
+" <pubDate>Mon, 20 Aug 2007 22:20:57 +0000</pubDate>"
+" <dc:creator>mich0u</dc:creator>"
+" <category><![CDATA[tree]]></category>"
+" <category><![CDATA[bucharest]]></category>"
+" <category><![CDATA[architecture]]></category>"
+" <guid isPermaLink=\"false\">http://mihaibalan.wordpress.com/2007"
+"/08/21/i-see-trees-of-green-and-skies-of-blue/</guid>"
+" <description><![CDATA["
+"]]></description>"
+" <content:encoded><![CDATA[<div class='snap_preview'><p align=\"cent"
+"er\"><a href=\"http://www.zooomr.com/photos/michou/2997760/\" title=\"Ph"
+"oto Sharing\"><img src=\"http://static.zooomr.com/images/2997760_f5a39d2a"
+"db.jpg\" alt=\"I see trees of green, and skies of blue\" style=\"border:"
+"medium none;\" height=\"340\" width=\"500\" /></a></p>"
+"</div>]]></content:encoded>"
+" <wfw:commentRss>http://mihaibalan.wordpress.com/2007/08/21/i-see"
+"-trees-of-green-and-skies-of-blue/feed/</wfw:commentRss>"
+" </item>"
+" <item>"
+" <title>Tuig - If I could turn back time</title>"
+" <link>http://mihaibalan.wordpress.com/2007/08/20/tuig-if-i-could-"
+"turn-back-time/</link>"
+" <comments>http://mihaibalan.wordpress.com/2007/08/20/tuig-if-i-"
+"could-turn-back-time/#comments</comments>"
+" <pubDate>Sun, 19 Aug 2007 22:05:53 +0000</pubDate>"
+" <dc:creator>mich0u</dc:creator>"
+" <category><![CDATA[light]]></category>"
+" <category><![CDATA[long exposure]]></category>"
+" <category><![CDATA[dark]]></category>"
+" <guid isPermaLink=\"false\">http://mihaibalan.wordpress.com/2007/"
+"08/20/tuig-if-i-could-turn-back-time/</guid>"
+" <description><![CDATA["
+"]]></description>"
+" <content:encoded><![CDATA[<div class='snap_preview'><p align=\"cent"
+"er\"><a href=\"http://www.flickr.com/photos/mi-chou/1029399905/\" title="
+"\"Photo Sharing\"><img src=\"http://farm2.static.flickr.com/1191/10293999"
+"05_08e5d41b89.jpg\" alt=\"Tuig - If I could roll back time\" style=\""
+"border:medium none;\" height=\"383\" width=\"500\" /></a></p>"
+"<p> <a href=\"http://mihaibalan.wordpress.com/2007/08/20/tuig-if-i-could-"
+"turn-back-time/#more-122\" class=\"more-link\">(more&#8230;)</a></p>"
+"</div>]]></content:encoded>"
+" <wfw:commentRss>http://mihaibalan.wordpress.com/2007/08/20/tuig-if"
+"-i-could-turn-back-time/feed/</wfw:commentRss>"
+" </item>";
/**
* String containing some invalid mark-up in the RSS feed.
*/
private static String rssBodyInvalid =
"<some-invalid-tag attr='value1'>Lorem ipsum</some-invalid-tg>";
"<some-invalid-tag attr='value1'>Lorem ipsum</some-invalid-tg>";
/**
* String containing the footer of a RSS feed.
*/
private static String rssFooter = "</channel></rss>";
/**
* String containing the header of a ATOM feed.
*/
private static String atomHeader =
"<?xml version='1.0' encoding='UTF-8'?>"
+"<?xml-stylesheet href=\"http://www.blogger.com/styles/atom.css\" type=\""
+"text/css\"?>"
+"<feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.co"
+"m/-/spec/opensearchrss/1.0/'>"
+" <id>tag:blogger.com,1999:blog-3490925879145756058</id><updated>2007-"
+"08-08T10:24:42.424-07:00</updated><title type='text'>miChou's Summer of "
+"Code blog</title><link rel='alternate' type='text/html' href='http://ete"
+"-de-code-a-la-chou.blogspot.com/'/>"
+" <link rel='http://schemas.google.com/g/2005#feed' type='application/"
+"atom+xml' href='http://ete-de-code-a-la-chou.blogspot.com/feeds/posts/de"
+"fault'/>"
+" <link rel='self' type='application/atom+xml' href='http://ete-de-cod"
+"e-a-la-chou.blogspot.com/feeds/posts/default'/>"
+" <author>"
+" <name>Mihai Balan</name>"
+" </author>"
+" <generator version='7.00' uri='http://www.blogger.com'>Blogger</gene"
+"rator><openSearch:totalResults>6</openSearch:totalResults><openSearch:st"
+"artIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearc"
+"h:itemsPerPage>";
"<?xml version='1.0' encoding='UTF-8'?>"
+"<?xml-stylesheet href=\"http://www.blogger.com/styles/atom.css\" type=\""
+"text/css\"?>"
+"<feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.co"
+"m/-/spec/opensearchrss/1.0/'>"
+" <id>tag:blogger.com,1999:blog-3490925879145756058</id><updated>2007-"
+"08-08T10:24:42.424-07:00</updated><title type='text'>miChou's Summer of "
+"Code blog</title><link rel='alternate' type='text/html' href='http://ete"
+"-de-code-a-la-chou.blogspot.com/'/>"
+" <link rel='http://schemas.google.com/g/2005#feed' type='application/"
+"atom+xml' href='http://ete-de-code-a-la-chou.blogspot.com/feeds/posts/de"
+"fault'/>"
+" <link rel='self' type='application/atom+xml' href='http://ete-de-cod"
+"e-a-la-chou.blogspot.com/feeds/posts/default'/>"
+" <author>"
+" <name>Mihai Balan</name>"
+" </author>"
+" <generator version='7.00' uri='http://www.blogger.com'>Blogger</gene"
+"rator><openSearch:totalResults>6</openSearch:totalResults><openSearch:st"
+"artIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearc"
+"h:itemsPerPage>";
/**
* String containing the body of an ATOM feed.
* String containing the body of an ATOM feed.
*/
private static String atomBody =
"<entry><id>tag:blogger.com,1999:blog-3490925879145756058.post-445569517"
+"5541848605</id><published>2007-06-05T02:15:00.000-07:00</published><upda"
+"ted>2007-06-05T03:34:35.892-07:00</updated><category scheme='http://www."
+"blogger.com/atom/ns#' term='soc'/>"
+" <category scheme='http://www.blogger.com/atom/ns#' term='todo'/>"
+""
+" <title type='text'>Happy hacking!</title><content type='html'>Fi"
+"nally the second semester is over, and the summer exams sessions is abou"
+"t to begin (that means I have the first exam tomorrow - Digital Computer"
+"s 2).And in between all this, I should also get my exams going :)</conte"
+"nt><link rel='alternate' type='text/html' href='http://ete-de-code-a-la-"
+"chou.blogspot.com/2007/06/happy-hacking.html' title='Happy hacking!'/>"
+" <link rel='replies' type='text/html' href='http://www.blogger.co"
+"m/comment.g?blogID=3490925879145756058&amp;postID=4455695175541848605' t"
+"itle='0 Comments'/>"
+" <link rel='replies' type='application/atom+xml' href='http://ete"
+"-de-code-a-la-chou.blogspot.com/feeds/4455695175541848605/comments/defau"
+"lt' title='Post Comments'/>"
+" <link rel='self' type='application/atom+xml' href='http://ete-de"
+"-code-a-la-chou.blogspot.com/feeds/posts/default/4455695175541848605'/>"
+" <link rel='edit' type='application/atom+xml' href='http://www.bl"
+"ogger.com/feeds/3490925879145756058/posts/default/4455695175541848605'/>"
+""
+" <author>"
+" <name>Mihai Balan</name>"
+" </author>"
+" </entry>"
+" <entry>"
+" <id>tag:blogger.com,1999:blog-3490925879145756058.post-160551373"
+"861169805</id><published>2007-05-31T13:34:00.000-07:00</published><updat"
+"ed>2007-06-01T04:21:00.167-07:00</updated><category scheme='http://www.b"
+"logger.com/atom/ns#' term='soc'/>"
+" <category scheme='http://www.blogger.com/atom/ns#' term='francai"
+"s'/>"
+" <category scheme='http://www.blogger.com/atom/ns#' term='bla-bla"
+"'/>"
+" <title type='text'>Un debut attarde</title><content type='html'>"
+"&lt;span style=\"font-style: italic;font-size:100%;\" &gt;&lt;span style="
+"\"font-family:georgia;\"&gt;Bien qu'on m'ait dit que toute communication "
+"regardant SIP se fera en anglais je prends le risque d'ecrire ce premier "
+"post en francais.</content><link rel='alternate' type='text/html' href='h"
+"ttp://ete-de-code-a-la-chou.blogspot.com/2007/05/un-debut-attarde.html' "
+"title='Un debut attarde'/>"
+" <link rel='replies' type='text/html' href='http://www.blogger.co"
+"m/comment.g?blogID=3490925879145756058&amp;postID=160551373861169805' ti"
+"tle='0 Comments'/>"
+" <link rel='replies' type='application/atom+xml' href='http://ete"
+"-de-code-a-la-chou.blogspot.com/feeds/160551373861169805/comments/defaul"
+"t' title='Post Comments'/>"
+" <link rel='self' type='application/atom+xml' href='http://ete-de"
+"-code-a-la-chou.blogspot.com/feeds/posts/default/160551373861169805'/>"
+" <link rel='edit' type='application/atom+xml' href='http://www.bl"
+"ogger.com/feeds/3490925879145756058/posts/default/160551373861169805'/>"
+" <author>"
+" <name>Mihai Balan</name>"
+" </author>"
+" </entry>";
"<entry><id>tag:blogger.com,1999:blog-3490925879145756058.post-445569517"
+"5541848605</id><published>2007-06-05T02:15:00.000-07:00</published><upda"
+"ted>2007-06-05T03:34:35.892-07:00</updated><category scheme='http://www."
+"blogger.com/atom/ns#' term='soc'/>"
+" <category scheme='http://www.blogger.com/atom/ns#' term='todo'/>"
+""
+" <title type='text'>Happy hacking!</title><content type='html'>Fi"
+"nally the second semester is over, and the summer exams sessions is abou"
+"t to begin (that means I have the first exam tomorrow - Digital Computer"
+"s 2).And in between all this, I should also get my exams going :)</conte"
+"nt><link rel='alternate' type='text/html' href='http://ete-de-code-a-la-"
+"chou.blogspot.com/2007/06/happy-hacking.html' title='Happy hacking!'/>"
+" <link rel='replies' type='text/html' href='http://www.blogger.co"
+"m/comment.g?blogID=3490925879145756058&amp;postID=4455695175541848605' t"
+"itle='0 Comments'/>"
+" <link rel='replies' type='application/atom+xml' href='http://ete"
+"-de-code-a-la-chou.blogspot.com/feeds/4455695175541848605/comments/defau"
+"lt' title='Post Comments'/>"
+" <link rel='self' type='application/atom+xml' href='http://ete-de"
+"-code-a-la-chou.blogspot.com/feeds/posts/default/4455695175541848605'/>"
+" <link rel='edit' type='application/atom+xml' href='http://www.bl"
+"ogger.com/feeds/3490925879145756058/posts/default/4455695175541848605'/>"
+""
+" <author>"
+" <name>Mihai Balan</name>"
+" </author>"
+" </entry>"
+" <entry>"
+" <id>tag:blogger.com,1999:blog-3490925879145756058.post-160551373"
+"861169805</id><published>2007-05-31T13:34:00.000-07:00</published><updat"
+"ed>2007-06-01T04:21:00.167-07:00</updated><category scheme='http://www.b"
+"logger.com/atom/ns#' term='soc'/>"
+" <category scheme='http://www.blogger.com/atom/ns#' term='francai"
+"s'/>"
+" <category scheme='http://www.blogger.com/atom/ns#' term='bla-bla"
+"'/>"
+" <title type='text'>Un debut attarde</title><content type='html'>"
+"&lt;span style=\"font-style: italic;font-size:100%;\" &gt;&lt;span style="
+"\"font-family:georgia;\"&gt;Bien qu'on m'ait dit que toute communication "
+"regardant SIP se fera en anglais je prends le risque d'ecrire ce premier "
+"post en francais.</content><link rel='alternate' type='text/html' href='h"
+"ttp://ete-de-code-a-la-chou.blogspot.com/2007/05/un-debut-attarde.html' "
+"title='Un debut attarde'/>"
+" <link rel='replies' type='text/html' href='http://www.blogger.co"
+"m/comment.g?blogID=3490925879145756058&amp;postID=160551373861169805' ti"
+"tle='0 Comments'/>"
+" <link rel='replies' type='application/atom+xml' href='http://ete"
+"-de-code-a-la-chou.blogspot.com/feeds/160551373861169805/comments/defaul"
+"t' title='Post Comments'/>"
+" <link rel='self' type='application/atom+xml' href='http://ete-de"
+"-code-a-la-chou.blogspot.com/feeds/posts/default/160551373861169805'/>"
+" <link rel='edit' type='application/atom+xml' href='http://www.bl"
+"ogger.com/feeds/3490925879145756058/posts/default/160551373861169805'/>"
+" <author>"
+" <name>Mihai Balan</name>"
+" </author>"
+" </entry>";
/**
* String containing the updates to the ATOM feed.
*/
private static String atomBodyUpdate =
"<entry><id>tag:blogger.com,1999:blog-3490925879145756058.post-722978588"
+"3825532193</id><published>2007-06-25T14:29:00.000-07:00</published><upda"
+"ted>2007-06-26T06:12:44.479-07:00</updated><category scheme='http://www."
+"blogger.com/atom/ns#' term='bugzilla'/>"
+" <category scheme='http://www.blogger.com/atom/ns#' term='todo'/>"
+""
+" <category scheme='http://www.blogger.com/atom/ns#' term='google'"
+"/>"
+" <category scheme='http://www.blogger.com/atom/ns#' term='rss'/>"
+" <title type='text'>Google politics</title><content type='html'>O"
+"ne of the problems well known in the current implementation of the RSS s"
+"upport in SIP Communicator was the inability to retrieve feeds from news"
+".google.com (and you must admit, news.google.com is quite a source of ne"
+"ws ;) ).&lt;br /&gt;&lt;br /&gt; A brief look at the exception returned"
+" by the plugin points out the problem. The server is sending a HTTP/403 "
+"(Forbidden) response code instead of the HTTP/200 (OK) response code.</c"
+"ontent><link rel='alternate' type='text/html' href='http://ete-de-code-a"
+"-la-chou.blogspot.com/2007/06/google-politics.html' title='Google politi"
+"cs'/>"
+" <link rel='replies' type='text/html' href='http://www.blogger.co"
+"m/comment.g?blogID=3490925879145756058&amp;postID=7229785883825532193' t"
+"itle='0 Comments'/>"
+" <link rel='replies' type='application/atom+xml' href='http://ete"
+"-de-code-a-la-chou.blogspot.com/feeds/7229785883825532193/comments/defau"
+"lt' title='Post Comments'/>"
+" <link rel='self' type='application/atom+xml' href='http://ete-de"
+"-code-a-la-chou.blogspot.com/feeds/posts/default/7229785883825532193'/>"
+" <link rel='edit' type='application/atom+xml' href='http://www.bl"
+"ogger.com/feeds/3490925879145756058/posts/default/7229785883825532193'/>"
+""
+" <author>"
+" <name>Mihai Balan</name>"
+" </author>"
+" </entry>";
"<entry><id>tag:blogger.com,1999:blog-3490925879145756058.post-722978588"
+"3825532193</id><published>2007-06-25T14:29:00.000-07:00</published><upda"
+"ted>2007-06-26T06:12:44.479-07:00</updated><category scheme='http://www."
+"blogger.com/atom/ns#' term='bugzilla'/>"
+" <category scheme='http://www.blogger.com/atom/ns#' term='todo'/>"
+""
+" <category scheme='http://www.blogger.com/atom/ns#' term='google'"
+"/>"
+" <category scheme='http://www.blogger.com/atom/ns#' term='rss'/>"
+" <title type='text'>Google politics</title><content type='html'>O"
+"ne of the problems well known in the current implementation of the RSS s"
+"upport in SIP Communicator was the inability to retrieve feeds from news"
+".google.com (and you must admit, news.google.com is quite a source of ne"
+"ws ;) ).&lt;br /&gt;&lt;br /&gt; A brief look at the exception returned"
+" by the plugin points out the problem. The server is sending a HTTP/403 "
+"(Forbidden) response code instead of the HTTP/200 (OK) response code.</c"
+"ontent><link rel='alternate' type='text/html' href='http://ete-de-code-a"
+"-la-chou.blogspot.com/2007/06/google-politics.html' title='Google politi"
+"cs'/>"
+" <link rel='replies' type='text/html' href='http://www.blogger.co"
+"m/comment.g?blogID=3490925879145756058&amp;postID=7229785883825532193' t"
+"itle='0 Comments'/>"
+" <link rel='replies' type='application/atom+xml' href='http://ete"
+"-de-code-a-la-chou.blogspot.com/feeds/7229785883825532193/comments/defau"
+"lt' title='Post Comments'/>"
+" <link rel='self' type='application/atom+xml' href='http://ete-de"
+"-code-a-la-chou.blogspot.com/feeds/posts/default/7229785883825532193'/>"
+" <link rel='edit' type='application/atom+xml' href='http://www.bl"
+"ogger.com/feeds/3490925879145756058/posts/default/7229785883825532193'/>"
+""
+" <author>"
+" <name>Mihai Balan</name>"
+" </author>"
+" </entry>";
/**
* String containing a new ATOM feed.
*/
private static String atomBodyNew =
"<entry><id>tag:blogger.com,1999:blog-3490925879145756058.post-325829288"
+"5225110686</id><published>2007-08-08T09:59:00.000-07:00</published><upda"
+"ted>2007-08-08T10:24:42.470-07:00</updated><category scheme='http://www."
+"blogger.com/atom/ns#' term='todo'/>"
+" <category scheme='http://www.blogger.com/atom/ns#' term='new fea"
+"ture'/>"
+" <category scheme='http://www.blogger.com/atom/ns#' term='emil'/>"
+""
+" <category scheme='http://www.blogger.com/atom/ns#' term='rss'/>"
+" <title type='text'>check out. again...</title><content type='htm"
+"l'>&lt;div style=\"text-align: justify;\"&gt;It seems I do have a strange"
+" problem when it comes to using CVS. It's not version control systems in "
+"general, but CVS. Or at least, the CVS I'm using here, on Sip Communicat"
+"or. Somehow, I never get it right.</content><link rel='alternate' type='"
+"text/html' href='http://ete-de-code-a-la-chou.blogspot.com/2007/08/check"
+"-out-again.html' title='check out. again...'/>"
+" <link rel='replies' type='text/html' href='http://www.blogger.co"
+"m/comment.g?blogID=3490925879145756058&amp;postID=3258292885225110686' t"
+"itle='0 Comments'/>"
+" <link rel='replies' type='application/atom+xml' href='http://ete"
+"-de-code-a-la-chou.blogspot.com/feeds/3258292885225110686/comments/defau"
+"lt' title='Post Comments'/>"
+" <link rel='self' type='application/atom+xml' href='http://ete-de"
+"-code-a-la-chou.blogspot.com/feeds/posts/default/3258292885225110686'/>"
+" <link rel='edit' type='application/atom+xml' href='http://www.bl"
+"ogger.com/feeds/3490925879145756058/posts/default/3258292885225110686'/>"
+""
+" <author>"
+" <name>Mihai Balan</name>"
+" </author>"
+" </entry>"
+" <entry>"
+" <id>tag:blogger.com,1999:blog-3490925879145756058.post-186104691"
+"5714479007</id><published>2007-07-06T13:23:00.000-07:00</published><upda"
+"ted>2007-07-06T13:54:46.478-07:00</updated><category scheme='http://www."
+"blogger.com/atom/ns#' term='new feature'/>"
+" <category scheme='http://www.blogger.com/atom/ns#' term='questio"
+"n'/>"
+" <category scheme='http://www.blogger.com/atom/ns#' term='rss'/>"
+" <title type='text'>Favicon - check!</title><content type='html'>"
+"&lt;div style=\"text-align: justify;\"&gt;Finally, favicon retrieval supp"
+"ort is here. What is this all about? Almost all IM protocols out there al"
+"low you to specify and associate an image to your account (a so called a"
+"vatar), either natively (e.g. Y!M), either through extensions (e.g. XMPP"
+"/Jabber).</content><link rel='alternate' type='text/html' href='http://e"
+"te-de-code-a-la-chou.blogspot.com/2007/07/favicon-check.html' title='Fav"
+"icon - check!'/>"
+" <link rel='replies' type='text/html' href='http://www.blogger.co"
+"m/comment.g?blogID=3490925879145756058&amp;postID=1861046915714479007' t"
+"itle='0 Comments'/>"
+" <link rel='replies' type='application/atom+xml' href='http://ete"
+"-de-code-a-la-chou.blogspot.com/feeds/1861046915714479007/comments/defau"
+"lt' title='Post Comments'/>"
+" <link rel='self' type='application/atom+xml' href='http://ete-de"
+"-code-a-la-chou.blogspot.com/feeds/posts/default/1861046915714479007'/>"
+" <link rel='edit' type='application/atom+xml' href='http://www.bl"
+"ogger.com/feeds/3490925879145756058/posts/default/1861046915714479007'/>"
+""
+" <author>"
+" <name>Mihai Balan</name>"
+" </author>"
+" </entry>"
+" <entry>"
+" <id>tag:blogger.com,1999:blog-3490925879145756058.post-717349866"
+"079669848</id><published>2007-06-29T12:35:00.000-07:00</published><updat"
+"ed>2007-06-29T12:39:34.816-07:00</updated><category scheme='http://www.b"
+"logger.com/atom/ns#' term='bugzilla'/>"
+" <category scheme='http://www.blogger.com/atom/ns#' term='todo'/>"
+""
+" <title type='text'>Interim objectives</title><content type='html"
+"'>I know I've been a little late setting these, but now it's kinda' sett"
+"led.</content><link rel='alternate' type='text/html' href='http://ete-de"
+"-code-a-la-chou.blogspot.com/2007/06/interim-objectives.html' title='Int"
+"erim objectives'/>"
+" <link rel='replies' type='text/html' href='http://www.blogger.co"
+"m/comment.g?blogID=3490925879145756058&amp;postID=717349866079669848' ti"
+"tle='0 Comments'/>"
+" <link rel='replies' type='application/atom+xml' href='http://ete"
+"-de-code-a-la-chou.blogspot.com/feeds/717349866079669848/comments/defaul"
+"t' title='Post Comments'/>"
+" <link rel='self' type='application/atom+xml' href='http://ete-de"
+"-code-a-la-chou.blogspot.com/feeds/posts/default/717349866079669848'/>"
+" <link rel='edit' type='application/atom+xml' href='http://www.bl"
+"ogger.com/feeds/3490925879145756058/posts/default/717349866079669848'/>"
+" <author>"
+" <name>Mihai Balan</name>"
+" </author>"
+" </entry>";
"<entry><id>tag:blogger.com,1999:blog-3490925879145756058.post-325829288"
+"5225110686</id><published>2007-08-08T09:59:00.000-07:00</published><upda"
+"ted>2007-08-08T10:24:42.470-07:00</updated><category scheme='http://www."
+"blogger.com/atom/ns#' term='todo'/>"
+" <category scheme='http://www.blogger.com/atom/ns#' term='new fea"
+"ture'/>"
+" <category scheme='http://www.blogger.com/atom/ns#' term='emil'/>"
+""
+" <category scheme='http://www.blogger.com/atom/ns#' term='rss'/>"
+" <title type='text'>check out. again...</title><content type='htm"
+"l'>&lt;div style=\"text-align: justify;\"&gt;It seems I do have a strange"
+" problem when it comes to using CVS. It's not version control systems in "
+"general, but CVS. Or at least, the CVS I'm using here, on Sip Communicat"
+"or. Somehow, I never get it right.</content><link rel='alternate' type='"
+"text/html' href='http://ete-de-code-a-la-chou.blogspot.com/2007/08/check"
+"-out-again.html' title='check out. again...'/>"
+" <link rel='replies' type='text/html' href='http://www.blogger.co"
+"m/comment.g?blogID=3490925879145756058&amp;postID=3258292885225110686' t"
+"itle='0 Comments'/>"
+" <link rel='replies' type='application/atom+xml' href='http://ete"
+"-de-code-a-la-chou.blogspot.com/feeds/3258292885225110686/comments/defau"
+"lt' title='Post Comments'/>"
+" <link rel='self' type='application/atom+xml' href='http://ete-de"
+"-code-a-la-chou.blogspot.com/feeds/posts/default/3258292885225110686'/>"
+" <link rel='edit' type='application/atom+xml' href='http://www.bl"
+"ogger.com/feeds/3490925879145756058/posts/default/3258292885225110686'/>"
+""
+" <author>"
+" <name>Mihai Balan</name>"
+" </author>"
+" </entry>"
+" <entry>"
+" <id>tag:blogger.com,1999:blog-3490925879145756058.post-186104691"
+"5714479007</id><published>2007-07-06T13:23:00.000-07:00</published><upda"
+"ted>2007-07-06T13:54:46.478-07:00</updated><category scheme='http://www."
+"blogger.com/atom/ns#' term='new feature'/>"
+" <category scheme='http://www.blogger.com/atom/ns#' term='questio"
+"n'/>"
+" <category scheme='http://www.blogger.com/atom/ns#' term='rss'/>"
+" <title type='text'>Favicon - check!</title><content type='html'>"
+"&lt;div style=\"text-align: justify;\"&gt;Finally, favicon retrieval supp"
+"ort is here. What is this all about? Almost all IM protocols out there al"
+"low you to specify and associate an image to your account (a so called a"
+"vatar), either natively (e.g. Y!M), either through extensions (e.g. XMPP"
+"/Jabber).</content><link rel='alternate' type='text/html' href='http://e"
+"te-de-code-a-la-chou.blogspot.com/2007/07/favicon-check.html' title='Fav"
+"icon - check!'/>"
+" <link rel='replies' type='text/html' href='http://www.blogger.co"
+"m/comment.g?blogID=3490925879145756058&amp;postID=1861046915714479007' t"
+"itle='0 Comments'/>"
+" <link rel='replies' type='application/atom+xml' href='http://ete"
+"-de-code-a-la-chou.blogspot.com/feeds/1861046915714479007/comments/defau"
+"lt' title='Post Comments'/>"
+" <link rel='self' type='application/atom+xml' href='http://ete-de"
+"-code-a-la-chou.blogspot.com/feeds/posts/default/1861046915714479007'/>"
+" <link rel='edit' type='application/atom+xml' href='http://www.bl"
+"ogger.com/feeds/3490925879145756058/posts/default/1861046915714479007'/>"
+""
+" <author>"
+" <name>Mihai Balan</name>"
+" </author>"
+" </entry>"
+" <entry>"
+" <id>tag:blogger.com,1999:blog-3490925879145756058.post-717349866"
+"079669848</id><published>2007-06-29T12:35:00.000-07:00</published><updat"
+"ed>2007-06-29T12:39:34.816-07:00</updated><category scheme='http://www.b"
+"logger.com/atom/ns#' term='bugzilla'/>"
+" <category scheme='http://www.blogger.com/atom/ns#' term='todo'/>"
+""
+" <title type='text'>Interim objectives</title><content type='html"
+"'>I know I've been a little late setting these, but now it's kinda' sett"
+"led.</content><link rel='alternate' type='text/html' href='http://ete-de"
+"-code-a-la-chou.blogspot.com/2007/06/interim-objectives.html' title='Int"
+"erim objectives'/>"
+" <link rel='replies' type='text/html' href='http://www.blogger.co"
+"m/comment.g?blogID=3490925879145756058&amp;postID=717349866079669848' ti"
+"tle='0 Comments'/>"
+" <link rel='replies' type='application/atom+xml' href='http://ete"
+"-de-code-a-la-chou.blogspot.com/feeds/717349866079669848/comments/defaul"
+"t' title='Post Comments'/>"
+" <link rel='self' type='application/atom+xml' href='http://ete-de"
+"-code-a-la-chou.blogspot.com/feeds/posts/default/717349866079669848'/>"
+" <link rel='edit' type='application/atom+xml' href='http://www.bl"
+"ogger.com/feeds/3490925879145756058/posts/default/717349866079669848'/>"
+" <author>"
+" <name>Mihai Balan</name>"
+" </author>"
+" </entry>";
/**
* String containing some invalid markup in the ATOM feed.
*/
private static String atomBodyInvalid =
"<some-invalid-tag attr='value1'>Lorem ipsum</some-invalid-tg>";
private static String atomBodyInvalid =
"<some-invalid-tag attr='value1'>Lorem ipsum</some-invalid-tg>";
/**
* String containing the footer of the ATOM feed.
*/
private static String atomFooter = "</feed>";
/**
* Returns a <code>String</code> representing an RSS feed.
* @return textual representation of the RSS feed.
*/
public static String getRss()
{
return rssHeader + rssBody + rssFooter;
return rssHeader + rssBody + rssFooter;
}
/**
* Returns a <code>String</code> representing the updated RSS feed.
* @return textual representation of the RSS feed.
*/
public static String getRssUpdated()
{
return rssHeader + rssBodyUpdate + rssBody + rssFooter;
return rssHeader + rssBodyUpdate + rssBody + rssFooter;
}
/**
* Returns a <code>String</code> representing a new version of the RSS feed.
* @return textual representation of the RSS feed.
*/
public static String getRssNew()
{
return rssHeader + rssBodyNew + rssFooter;
return rssHeader + rssBodyNew + rssFooter;
}
/**
* Returns a <code>String</code> representing an invalid RSS feed.
* @return textual representation of the RSS feed.
*/
public static String getRssInvalid()
{
return rssHeader + rssBodyInvalid + rssFooter;
return rssHeader + rssBodyInvalid + rssFooter;
}
/**
* Returns a <code>String</code> representing an ATOM feed.
* @return textual representation of the RSS feed.
*/
public static String getAtom()
{
return atomHeader + atomBody + atomFooter;
return atomHeader + atomBody + atomFooter;
}
/**
* Returns a <code>String</code> representing the updated ATOM feed.
* @return textual representation of the RSS feed.
*/
public static String getAtomUpdated()
{
return atomHeader + atomBodyUpdate + atomBody + atomFooter;
return atomHeader + atomBodyUpdate + atomBody + atomFooter;
}
/**
* Returns a <code>String</code> representing a new version of the ATOM
* feed.
@ -494,15 +494,15 @@ public static String getAtomUpdated()
*/
public static String getAtomNew()
{
return atomHeader + atomBodyNew + atomFooter;
return atomHeader + atomBodyNew + atomFooter;
}
/**
* Returns a <code>String</code> representing an invalid ATOM feed.
* @return textual representation of the RSS feed.
*/
public static String getAtomInvalid()
{
return atomHeader + atomBodyInvalid + atomFooter;
return atomHeader + atomBodyInvalid + atomFooter;
}
}

@ -18,45 +18,45 @@
* @author Mihai Balan
*/
public class RssProtocolProviderServiceLick
extends TestSuite
implements BundleActivator
extends TestSuite
implements BundleActivator
{
/**
* Initializes and registers all tests that we'll run as a part of this
* Initializes and registers all tests that we'll run as a part of this
* SLICK.
*
*
* @param bundleContext a currently valid bundle context.
*/
public void start(BundleContext bundleContext)
{
Logger logger =
Logger.getLogger(RssProtocolProviderServiceLick.class);
logger.setLevelAll();
logger.debug("***Start() called on RSS slick***");
setName("RssProtocolProviderServiceLick");
Hashtable properties = new Hashtable();
properties.put("service.pid", getName());
RssSlickFixture.bc = bundleContext;
//test account installation
addTestSuite(TestAccountInstallation.class);
//test Protocol Provider Service implementation
addTestSuite(TestProtocolProviderServiceRssImpl.class);
//test account uninstallation
addTest(TestAccountUninstallation.suite());
addTestSuite(TestAccountUninstallationPersistence.class);
bundleContext.registerService(getClass().getName(), this, properties);
Logger logger =
Logger.getLogger(RssProtocolProviderServiceLick.class);
logger.setLevelAll();
logger.debug("***Start() called on RSS slick***");
setName("RssProtocolProviderServiceLick");
Hashtable properties = new Hashtable();
properties.put("service.pid", getName());
RssSlickFixture.bc = bundleContext;
//test account installation
addTestSuite(TestAccountInstallation.class);
//test Protocol Provider Service implementation
addTestSuite(TestProtocolProviderServiceRssImpl.class);
//test account uninstallation
addTest(TestAccountUninstallation.suite());
addTestSuite(TestAccountUninstallationPersistence.class);
bundleContext.registerService(getClass().getName(), this, properties);
}
/**
* Prepares the slick for shutdown.
*
*
* @param context a currently valid bundle context.
*/
public void stop(BundleContext context)

@ -13,11 +13,11 @@
/**
* Installs a test account and verifies it is available after installation.
*
*
* @author Mihai Balan
*/
public class TestAccountInstallation
extends TestCase
extends TestCase
{
/**
@ -26,105 +26,105 @@ public class TestAccountInstallation
*/
public TestAccountInstallation(String name)
{
super(name);
super(name);
}
/**
* JUnit setup method.
*/
protected void setUp() throws Exception
{
super.setUp();
super.setUp();
}
/**
* JUnit cleanup method.
*/
protected void tearDown() throws Exception
{
super.tearDown();
super.tearDown();
}
/**
* Installs and account and verifies whether the installation succedded.
*/
public void testInstallAccount()
{
Hashtable accountProperties = new Hashtable();
ServiceReference[] serRefs = null;
String osgiFilter = "(" + ProtocolProviderFactory.PROTOCOL + "="
Hashtable accountProperties = new Hashtable();
ServiceReference[] serRefs = null;
String osgiFilter = "(" + ProtocolProviderFactory.PROTOCOL + "="
+ ProtocolNames.RSS + ")";
accountProperties.put(ProtocolProviderFactory.USER_ID, "RSS");
try {
serRefs = RssSlickFixture.bc.getServiceReferences(
ProtocolProviderFactory.class.getName(), osgiFilter);
} catch (InvalidSyntaxException ise)
{
//shouldn't happen as the filter is static
fail(osgiFilter + "is not a valid filter");
}
//couldn't find a provider factory service.
assertTrue("Failed to find a provider factory service or protocol RSS",
serRefs != null && serRefs.length > 0);
ProtocolProviderFactory rssProviderFactory = (ProtocolProviderFactory)
RssSlickFixture.bc.getService(serRefs[0]);
//there shouldn't be any account installed
assertTrue("There was an account already registered with the account "
accountProperties.put(ProtocolProviderFactory.USER_ID, "RSS");
try {
serRefs = RssSlickFixture.bc.getServiceReferences(
ProtocolProviderFactory.class.getName(), osgiFilter);
} catch (InvalidSyntaxException ise)
{
//shouldn't happen as the filter is static
fail(osgiFilter + "is not a valid filter");
}
//couldn't find a provider factory service.
assertTrue("Failed to find a provider factory service or protocol RSS",
serRefs != null && serRefs.length > 0);
ProtocolProviderFactory rssProviderFactory = (ProtocolProviderFactory)
RssSlickFixture.bc.getService(serRefs[0]);
//there shouldn't be any account installed
assertTrue("There was an account already registered with the account "
+ "manager",
rssProviderFactory.getRegisteredAccounts().size() == 0);
try {
rssProviderFactory.installAccount(null, accountProperties);
fail("Installing an account with a null account id must result in a"
+ " NullPointerException!");
} catch(NullPointerException npe)
{
//that's ought to happen
}
rssProviderFactory.installAccount("RSS", accountProperties);
//try to install the same account twice and check for exceptions
try {
rssProviderFactory.installAccount("RSS", accountProperties);
fail("An IllegalStateException must be thrown when trying to "
+ "install a duplicate account.");
} catch(IllegalStateException ise)
{
//that's ought to happen
}
assertTrue("Newly installed account is not in the account manager's "
+ "registered accounts!",
rssProviderFactory.getRegisteredAccounts().size() == 1);
osgiFilter = "(&(" + ProtocolProviderFactory.PROTOCOL + "="
rssProviderFactory.getRegisteredAccounts().size() == 0);
try {
rssProviderFactory.installAccount(null, accountProperties);
fail("Installing an account with a null account id must result in a"
+ " NullPointerException!");
} catch(NullPointerException npe)
{
//that's ought to happen
}
rssProviderFactory.installAccount("RSS", accountProperties);
//try to install the same account twice and check for exceptions
try {
rssProviderFactory.installAccount("RSS", accountProperties);
fail("An IllegalStateException must be thrown when trying to "
+ "install a duplicate account.");
} catch(IllegalStateException ise)
{
//that's ought to happen
}
assertTrue("Newly installed account is not in the account manager's "
+ "registered accounts!",
rssProviderFactory.getRegisteredAccounts().size() == 1);
osgiFilter = "(&(" + ProtocolProviderFactory.PROTOCOL + "="
+ ProtocolNames.RSS + ")"
+ "(" + ProtocolProviderFactory.USER_ID + "=RSS))";
try {
serRefs = RssSlickFixture.bc.getServiceReferences(
ProtocolProviderService.class.getName(), osgiFilter);
} catch(InvalidSyntaxException ise)
{
fail(osgiFilter + " is not a valid filter");
}
assertTrue("A protocol provider was apparently not installed as"
+ "(" + ProtocolProviderFactory.USER_ID + "=RSS))";
try {
serRefs = RssSlickFixture.bc.getServiceReferences(
ProtocolProviderService.class.getName(), osgiFilter);
} catch(InvalidSyntaxException ise)
{
fail(osgiFilter + " is not a valid filter");
}
assertTrue("A protocol provider was apparently not installed as"
+ " requested",
serRefs != null && serRefs.length > 0);
Object rssProtocolProvider =
RssSlickFixture.bc.getService(serRefs[0]);
assertTrue("The installed protocol provider does not implement the"
+ "protocol provider service.",
rssProtocolProvider instanceof ProtocolProviderService);
serRefs != null && serRefs.length > 0);
Object rssProtocolProvider =
RssSlickFixture.bc.getService(serRefs[0]);
assertTrue("The installed protocol provider does not implement the"
+ "protocol provider service.",
rssProtocolProvider instanceof ProtocolProviderService);
}
}

@ -23,36 +23,36 @@ public class TestAccountUninstallation
extends TestCase
{
private RssSlickFixture fixture = new RssSlickFixture();
/**
* Constructs a test instance
* @param name The name of the test.
*/
public TestAccountUninstallation(String name)
{
super(name);
super(name);
}
/**
* JUnit setup method.
* @throws Exception in case anything goes wrong.
*/
public void setUp() throws Exception
{
super.setUp();
fixture.setUp();
super.setUp();
fixture.setUp();
}
/**
* JUnit teardown method.
* @throws Exception in case anything goes wrong.
*/
public void tearDown() throws Exception
{
fixture.tearDown();
super.tearDown();
fixture.tearDown();
super.tearDown();
}
/**
* Returns a suite containing tests in this class in the order that we'd
* like them executed.
@ -61,16 +61,16 @@ public void tearDown() throws Exception
*/
public static Test suite()
{
TestSuite suite = new TestSuite();
suite.addTest(
new TestAccountUninstallation("testInstallationPersistence"));
suite.addTest(
new TestAccountUninstallation("testUninstallAccount"));
return suite;
TestSuite suite = new TestSuite();
suite.addTest(
new TestAccountUninstallation("testInstallationPersistence"));
suite.addTest(
new TestAccountUninstallation("testUninstallAccount"));
return suite;
}
/**
* Stops and removes the tested bundle, verifies that it has unregistered
* its provider, then reloads and restarts the bundle and verifies that
@ -80,95 +80,95 @@ public static Test suite()
*/
public void testInstallationPersistence() throws Exception
{
Bundle providerBundle =
fixture.findProtocolProviderBundle(fixture.provider);
//set the global providerBundle reference that we will be using
Bundle providerBundle =
fixture.findProtocolProviderBundle(fixture.provider);
//set the global providerBundle reference that we will be using
//in the last series of tests (Account uninstallation persistency)
RssSlickFixture.providerBundle = providerBundle;
assertNotNull("Couldn't find a bundle for the protocol provider",
providerBundle);
providerBundle.stop();
assertTrue("Couldn't stop protocol provider bundle. State was "
+ providerBundle.getSymbolicName(),
providerBundle.getState() != Bundle.ACTIVE
&& providerBundle.getState() != Bundle.STOPPING);
providerBundle.uninstall();
assertEquals("Couldn't uninstall protocol provider bundle.",
providerBundle.getState(), Bundle.UNINSTALLED);
//verify that the provider is no longer available
ServiceReference providerRefs[] = null;
try {
providerRefs = fixture.bc.getServiceReferences(
ProtocolProviderService.class.getName(),
"(&(" + ProtocolProviderFactory.PROTOCOL + "="
RssSlickFixture.providerBundle = providerBundle;
assertNotNull("Couldn't find a bundle for the protocol provider",
providerBundle);
providerBundle.stop();
assertTrue("Couldn't stop protocol provider bundle. State was "
+ providerBundle.getSymbolicName(),
providerBundle.getState() != Bundle.ACTIVE
&& providerBundle.getState() != Bundle.STOPPING);
providerBundle.uninstall();
assertEquals("Couldn't uninstall protocol provider bundle.",
providerBundle.getState(), Bundle.UNINSTALLED);
//verify that the provider is no longer available
ServiceReference providerRefs[] = null;
try {
providerRefs = fixture.bc.getServiceReferences(
ProtocolProviderService.class.getName(),
"(&(" + ProtocolProviderFactory.PROTOCOL + "="
+ ProtocolNames.RSS + "))");
} catch (InvalidSyntaxException ise)
{
fail("Invalid OSGi filter. Exception was" + ise.getMessage());
}
//verify the provider really uninstalled
assertTrue("Protocol provider still present after being explicitly" +
} catch (InvalidSyntaxException ise)
{
fail("Invalid OSGi filter. Exception was" + ise.getMessage());
}
//verify the provider really uninstalled
assertTrue("Protocol provider still present after being explicitly" +
" uninstalled",
providerRefs == null || providerRefs.length == 0);
assertTrue("The RSS protocol provider factory didn't completely "
+ "uninstalled the provider service",
fixture.providerFactory.getRegisteredAccounts().size() == 0 &&
fixture.providerFactory.getProviderForAccount(
fixture.provider.getAccountID()) == null);
//reinstall provider
providerBundle = fixture.bc.installBundle(providerBundle.getLocation());
RssSlickFixture.providerBundle = providerBundle;
assertTrue("Couldn't reinstall provider bundle",
providerBundle.getState() == Bundle.INSTALLED);
providerRefs == null || providerRefs.length == 0);
assertTrue("The RSS protocol provider factory didn't completely "
+ "uninstalled the provider service",
fixture.providerFactory.getRegisteredAccounts().size() == 0 &&
fixture.providerFactory.getProviderForAccount(
fixture.provider.getAccountID()) == null);
//reinstall provider
providerBundle = fixture.bc.installBundle(providerBundle.getLocation());
RssSlickFixture.providerBundle = providerBundle;
assertTrue("Couldn't reinstall provider bundle",
providerBundle.getState() == Bundle.INSTALLED);
AccountManagerUtils.startBundleAndWaitStoredAccountsLoaded(fixture.bc,
providerBundle, ProtocolNames.RSS);
assertTrue("Couldn't start provider",
providerBundle.getState() == Bundle.ACTIVE);
providerRefs = null;
try {
providerRefs = fixture.bc.getServiceReferences(
ProtocolProviderService.class.getName(),
"(&(" + ProtocolProviderFactory.PROTOCOL + "="
assertTrue("Couldn't start provider",
providerBundle.getState() == Bundle.ACTIVE);
providerRefs = null;
try {
providerRefs = fixture.bc.getServiceReferences(
ProtocolProviderService.class.getName(),
"(&(" + ProtocolProviderFactory.PROTOCOL + "="
+ ProtocolNames.RSS + "))");
} catch (InvalidSyntaxException ise)
{
fail("Invalid OSGi filter. Exception was" + ise.getMessage());
}
assertTrue("The protocol provider hasn't been restored after being "
} catch (InvalidSyntaxException ise)
{
fail("Invalid OSGi filter. Exception was" + ise.getMessage());
}
assertTrue("The protocol provider hasn't been restored after being "
+ "reinstalled",
providerRefs != null && providerRefs.length > 0);
ServiceReference factoryRefs[] = null;
try {
factoryRefs = fixture.bc.getServiceReferences(
ProtocolProviderFactory.class.getName(),
"(" + ProtocolProviderFactory.PROTOCOL + "=RSS)");
} catch (InvalidSyntaxException ise)
{
fail("Invalid OSGi filter. Exception was " + ise.getMessage());
}
fixture.providerFactory =
(ProtocolProviderFactory) fixture.bc.getService(factoryRefs[0]);
fixture.provider =
(ProtocolProviderService) fixture.bc.getService(providerRefs[0]);
assertFalse("RSS provider did not restore its own reference to the"
+ " provider that we just reinstalled.",
fixture.providerFactory.getRegisteredAccounts().isEmpty()
&& fixture.providerFactory.getProviderForAccount(
fixture.provider.getAccountID()) == null);
providerRefs != null && providerRefs.length > 0);
ServiceReference factoryRefs[] = null;
try {
factoryRefs = fixture.bc.getServiceReferences(
ProtocolProviderFactory.class.getName(),
"(" + ProtocolProviderFactory.PROTOCOL + "=RSS)");
} catch (InvalidSyntaxException ise)
{
fail("Invalid OSGi filter. Exception was " + ise.getMessage());
}
fixture.providerFactory =
(ProtocolProviderFactory) fixture.bc.getService(factoryRefs[0]);
fixture.provider =
(ProtocolProviderService) fixture.bc.getService(providerRefs[0]);
assertFalse("RSS provider did not restore its own reference to the"
+ " provider that we just reinstalled.",
fixture.providerFactory.getRegisteredAccounts().isEmpty()
&& fixture.providerFactory.getProviderForAccount(
fixture.provider.getAccountID()) == null);
}
/**
@ -176,35 +176,35 @@ public void testInstallationPersistence() throws Exception
*/
public void testUninstallAccount() throws Exception
{
assertTrue("No accounts found.",
! fixture.providerFactory.getRegisteredAccounts().isEmpty());
assertNotNull("Found no provider corresponding to RSS",
fixture.providerFactory.getProviderForAccount(
fixture.provider.getAccountID()));
assertTrue("Failed to remove provider",
fixture.providerFactory.uninstallAccount(
fixture.provider.getAccountID()));
ServiceReference[] providerRefs = null;
try {
providerRefs = fixture.bc.getServiceReferences(
ProtocolProviderService.class.getName(),
"(" + ProtocolProviderFactory.PROTOCOL + "=" + ProtocolNames.RSS
assertTrue("No accounts found.",
! fixture.providerFactory.getRegisteredAccounts().isEmpty());
assertNotNull("Found no provider corresponding to RSS",
fixture.providerFactory.getProviderForAccount(
fixture.provider.getAccountID()));
assertTrue("Failed to remove provider",
fixture.providerFactory.uninstallAccount(
fixture.provider.getAccountID()));
ServiceReference[] providerRefs = null;
try {
providerRefs = fixture.bc.getServiceReferences(
ProtocolProviderService.class.getName(),
"(" + ProtocolProviderFactory.PROTOCOL + "=" + ProtocolNames.RSS
+ ")");
} catch (InvalidSyntaxException ise)
{
fail("Invalid OSGi filter.Exception was: " + ise.getMessage());
}
assertTrue("Protocol provider service still registered as OSGi service",
providerRefs == null || providerRefs.length == 0);
assertTrue("Provider factory didn't properly uninstalled the provider"
+ "service we just uninstalled",
fixture.providerFactory.getRegisteredAccounts().isEmpty()
&& fixture.providerFactory.getProviderForAccount(
fixture.provider.getAccountID()) == null);
} catch (InvalidSyntaxException ise)
{
fail("Invalid OSGi filter.Exception was: " + ise.getMessage());
}
assertTrue("Protocol provider service still registered as OSGi service",
providerRefs == null || providerRefs.length == 0);
assertTrue("Provider factory didn't properly uninstalled the provider"
+ "service we just uninstalled",
fixture.providerFactory.getRegisteredAccounts().isEmpty()
&& fixture.providerFactory.getProviderForAccount(
fixture.provider.getAccountID()) == null);
}
}

@ -18,76 +18,76 @@
*
* @author Mihai Balan
*/
public class TestAccountUninstallationPersistence
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);
super(testName);
}
/**
* Retrieves a reference to the RSS bundle, stops and uninstalls it and then
* reinstalls it in order to make sure that accounts are not reloaded once
* removed.
*
*
* @throws Exception if anything goes wrong while manipulating the bundles.
*/
public void testAccountUninstallationPersistence()
throws Exception
throws Exception
{
Bundle providerBundle = RssSlickFixture.providerBundle;
providerBundle.stop();
assertTrue("Couldn't stop the protocol provider bundle. State was"
+ providerBundle.getState(),
providerBundle.getState() != Bundle.ACTIVE
&& providerBundle.getState() != Bundle.STOPPING);
providerBundle.uninstall();
assertEquals("Couldn't stop the protocol provider bundle.",
providerBundle.getState(), Bundle.UNINSTALLED);
//now reinstall the bundle and restart the provider
providerBundle = RssSlickFixture.bc.installBundle(
providerBundle.getLocation());
assertEquals("Couldn't reinstall protocol provider bundle.",
providerBundle.getState(), Bundle.INSTALLED);
Bundle providerBundle = RssSlickFixture.providerBundle;
providerBundle.stop();
assertTrue("Couldn't stop the protocol provider bundle. State was"
+ providerBundle.getState(),
providerBundle.getState() != Bundle.ACTIVE
&& providerBundle.getState() != Bundle.STOPPING);
providerBundle.uninstall();
assertEquals("Couldn't stop the protocol provider bundle.",
providerBundle.getState(), Bundle.UNINSTALLED);
//now reinstall the bundle and restart the provider
providerBundle = RssSlickFixture.bc.installBundle(
providerBundle.getLocation());
assertEquals("Couldn't reinstall protocol provider bundle.",
providerBundle.getState(), Bundle.INSTALLED);
AccountManagerUtils.startBundleAndWaitStoredAccountsLoaded(
RssSlickFixture.bc, providerBundle, ProtocolNames.RSS);
assertEquals("Couldn't restart protocol provider bundle.",
providerBundle.getState(), Bundle.ACTIVE);
//verify the provider is not reinstalled
ServiceReference[] providerRefs = null;
try {
providerRefs = RssSlickFixture.bc.getServiceReferences(
ProtocolProviderService.class.getName(),
"(" + ProtocolProviderFactory.PROTOCOL + "=" + ProtocolNames.RSS
assertEquals("Couldn't restart protocol provider bundle.",
providerBundle.getState(), Bundle.ACTIVE);
//verify the provider is not reinstalled
ServiceReference[] providerRefs = null;
try {
providerRefs = RssSlickFixture.bc.getServiceReferences(
ProtocolProviderService.class.getName(),
"(" + ProtocolProviderFactory.PROTOCOL + "=" + ProtocolNames.RSS
+ ")");
} catch (InvalidSyntaxException ise)
{
fail("OSGi filter is wrong. Error was: " + ise.getMessage());
}
//make sure we didn't retrieve a service
assertTrue("An RSS protocol provider service was still registered as an"
+ " OSGi service even after being explicitly uninstalled",
providerRefs == null || providerRefs.length == 0);
//now delete configuration file for a fresh start for the next test
ServiceReference confRef = RssSlickFixture.bc.getServiceReference(
ConfigurationService.class.getName());
ConfigurationService confServ =
(ConfigurationService) RssSlickFixture.bc.getService(confRef);
confServ.purgeStoredConfiguration();
} catch (InvalidSyntaxException ise)
{
fail("OSGi filter is wrong. Error was: " + ise.getMessage());
}
//make sure we didn't retrieve a service
assertTrue("An RSS protocol provider service was still registered as an"
+ " OSGi service even after being explicitly uninstalled",
providerRefs == null || providerRefs.length == 0);
//now delete configuration file for a fresh start for the next test
ServiceReference confRef = RssSlickFixture.bc.getServiceReference(
ConfigurationService.class.getName());
ConfigurationService confServ =
(ConfigurationService) RssSlickFixture.bc.getService(confRef);
confServ.purgeStoredConfiguration();
}
}

@ -16,7 +16,7 @@
* This class performs testing on protocol provider methods. It verifies that
* the protocol provider service implements the declared operation sets and also
* tests the process of registering an account.
*
*
* @author Mihai Balan
*/
public class TestProtocolProviderServiceRssImpl
@ -29,94 +29,94 @@ public class TestProtocolProviderServiceRssImpl
public static final int WAIT_DELAY = 10000;
public static final Logger logger =
Logger.getLogger(TestProtocolProviderServiceRssImpl.class);
Logger.getLogger(TestProtocolProviderServiceRssImpl.class);
/**
* Test's fixture.
*/
private RssSlickFixture fixture = new RssSlickFixture();
public RegistrationEventCollector eventCollector =
new RegistrationEventCollector();
new RegistrationEventCollector();
/**
* Creates a test case that runs the specified test.
*
*
* @param testName the name of the method the test should run.
*/
public TestProtocolProviderServiceRssImpl(String testName)
{
super(testName);
super(testName);
}
/**
* Initializes the fixture.
*
* @throws Exception if <code>super.setUp()</code> throws one.
*
* @throws Exception if <code>super.setUp()</code> throws one.
*/
public void setUp() throws Exception
{
super.setUp();
fixture.setUp();
super.setUp();
fixture.setUp();
}
/**
* Cleans up after the test.
*
*
* @throws Exception if <code>fixture.tearDown()</code> fails.
*/
public void tearDown() throws Exception
{
fixture.tearDown();
super.tearDown();
fixture.tearDown();
super.tearDown();
}
/**
* This methods makes sure that the instance of the RSS protocol provider
* that we are going to use is properly initialized and registered. It also
* verifies that a registration event is fired upon successful registration
* and collected by our event collector.
*
*
* @throws OperationFailedException if <code>provider.register()</code>
* fails.
*/
public void testRegister() throws OperationFailedException
{
//registering as a listener & starting registration with a
//null SecurityAuthority
fixture.provider.addRegistrationStateChangeListener(
//registering as a listener & starting registration with a
//null SecurityAuthority
fixture.provider.addRegistrationStateChangeListener(
this.eventCollector);
fixture.provider.register(new NullSecurityAuthority());
//give it a little time to do his magic ;)
logger.debug("Waiting for registration to complete...");
eventCollector.waitForEvent(WAIT_DELAY);
//make sure we received events...
assertTrue("No events were dispatched during the registration process.",
eventCollector.collectedStates.size() > 0);
//...and they were the right ones
assertTrue("No registration event notifying of registration was"
fixture.provider.register(new NullSecurityAuthority());
//give it a little time to do his magic ;)
logger.debug("Waiting for registration to complete...");
eventCollector.waitForEvent(WAIT_DELAY);
//make sure we received events...
assertTrue("No events were dispatched during the registration process.",
eventCollector.collectedStates.size() > 0);
//...and they were the right ones
assertTrue("No registration event notifying of registration was"
+ " dispatched."
+ " All events were:" + eventCollector.collectedStates,
eventCollector.collectedStates.contains(
RegistrationState.REGISTERED));
//if everything is ok, we leave it alone
fixture.provider.removeRegistrationStateChangeListener(eventCollector);
+ " All events were:" + eventCollector.collectedStates,
eventCollector.collectedStates.contains(
RegistrationState.REGISTERED));
//if everything is ok, we leave it alone
fixture.provider.removeRegistrationStateChangeListener(eventCollector);
}
/**
* This method verifies that all operation sets have the type they are
* declared to have.
*
*
* @throws ClassNotFoundException if a class name found in the keys for the
* supported operation sets doesn't correspond to a class that the
* supported operation sets doesn't correspond to a class that the
* class loader can find.
*/
public void testOperationsSets() throws ClassNotFoundException
{
Map<String, OperationSet> supportedOperationSets =
Map<String, OperationSet> supportedOperationSets =
fixture.provider.getSupportedOperationSets();
// get the keys for the supported operation set. The keys are strings
@ -132,97 +132,97 @@ public void testOperationsSets() throws ClassNotFoundException
.forName(key).isInstance(opSet));
}
}
/**
* This class acts as a very simple registration listener for the protocol
* provider and simply records all events it receives and notifies
* provider and simply records all events it receives and notifies
* (<code>notifyAll()</code>) all objects waiting for an instance of this
* class upon receiving an event that signals a completed registration.
*
* TODO: This class is just the same as the one in
*
* TODO: This class is just the same as the one in
* TestProtocolProviderServiceGibberishImpl.java . Is there any reason for
* duplicating code this way?
*
*
* @author Emil Ivov
* @author Mihai Balan
*/
public class RegistrationEventCollector
implements RegistrationStateChangeListener
implements RegistrationStateChangeListener
{
/**
* We store all the received events in this list. It's made public to
* ease later inspection by unit tests.
*/
public List collectedStates = new LinkedList();
/**
* This method simply records all received events in a <code>List</code>
* that can be easily inspected by unit tests. In case we receive a
* registration event notifying us of a completed registration, the
* method calls <code>notifyAll()</code>.
*
* @param e a <code>RegistrationStateChangeEvent</code> decribing the
* status change.
*/
public void registrationStateChanged(RegistrationStateChangeEvent e)
{
logger.debug("Received a RegistrationChangeEvent: " + e.toString());
collectedStates.add(e.getNewState());
if (e.getNewState().equals(RegistrationState.REGISTERED))
{
logger.debug("We're registered. Notifying waiting threads");
synchronized(this)
{
notifyAll();
}
}
}
/**
* Blocks until an event notifying us of the awaited status change is
* received or until <code>waitFor</code> miliseconds pass, whichever
* comes first.
*
* @param waitFor the number of seconds to wait for an event. If no
* event is received, we simply return.
*/
public void waitForEvent(long waitFor)
{
logger.trace("Waiting for a RegistrationChangeEvent");
synchronized(this)
{
if (collectedStates.contains(RegistrationState.REGISTERED))
{
logger.trace("Event already received" + collectedStates);
return;
}
try {
wait(waitFor);
if (collectedStates.size() > 0)
logger.trace("Received a RegistrationStateChangeEvent.");
else
logger.trace("No registrationStateChangeEvent received"
+ " for" + waitFor + "ms.");
} catch(InterruptedException ie)
{
logger.debug("Interrupted while waiting for "
+ "a RegistrationStateChangeEvent", ie);
}
}
}
/**
* We store all the received events in this list. It's made public to
* ease later inspection by unit tests.
*/
public List collectedStates = new LinkedList();
/**
* This method simply records all received events in a <code>List</code>
* that can be easily inspected by unit tests. In case we receive a
* registration event notifying us of a completed registration, the
* method calls <code>notifyAll()</code>.
*
* @param e a <code>RegistrationStateChangeEvent</code> decribing the
* status change.
*/
public void registrationStateChanged(RegistrationStateChangeEvent e)
{
logger.debug("Received a RegistrationChangeEvent: " + e.toString());
collectedStates.add(e.getNewState());
if (e.getNewState().equals(RegistrationState.REGISTERED))
{
logger.debug("We're registered. Notifying waiting threads");
synchronized(this)
{
notifyAll();
}
}
}
/**
* Blocks until an event notifying us of the awaited status change is
* received or until <code>waitFor</code> miliseconds pass, whichever
* comes first.
*
* @param waitFor the number of seconds to wait for an event. If no
* event is received, we simply return.
*/
public void waitForEvent(long waitFor)
{
logger.trace("Waiting for a RegistrationChangeEvent");
synchronized(this)
{
if (collectedStates.contains(RegistrationState.REGISTERED))
{
logger.trace("Event already received" + collectedStates);
return;
}
try {
wait(waitFor);
if (collectedStates.size() > 0)
logger.trace("Received a RegistrationStateChangeEvent.");
else
logger.trace("No registrationStateChangeEvent received"
+ " for" + waitFor + "ms.");
} catch(InterruptedException ie)
{
logger.debug("Interrupted while waiting for "
+ "a RegistrationStateChangeEvent", ie);
}
}
}
}
/**
* Dummy implementation of a <code>SecurityAuthority</code>. It simply
* returns null credentials as the RSS "authentication" protocol requires
* none.
*
*
* @author Mihai Balan
*/
public class NullSecurityAuthority

@ -13,7 +13,7 @@
* This classed is used in the automatic testing of the RSS protocol. It acts as
* a <b>very</b> simple HTTP server that can serve RSS files. It has the ability
* to simulate an update to the file, or to send an invalid file.
*
*
* The usual flow when using a <code>TestingServer</code> is as follows:
* <ol>
* <li>Create <code>TestingServer</code> object.</li>
@ -24,7 +24,7 @@
* <li>Stop the server with <code>stop()</code>.</li>
* <li>If necessary rewind from 2.</li>
* </ol>
*
*
* @see setAtomUsage, setServerBehaviour, start, stop
* @author Mihai Balan
*/
@ -40,49 +40,49 @@ public class TestingServer
* Numeric constant specifying an invalid file to be served.
*/
public static final int INVALID = 0;
/**
* Numeric constant specifying a valid file to be served.
*/
public static final int VALID = 1;
/**
* Numeric constant specifying a valid, updated file to be served.
*/
public static final int VALID_UPDATE = 2;
/**
* Numeric constant specifying a valid, new file to be served.
*/
public static final int VALID_NEW = 3;
/**
* <code>true</code> if ATOM-like files are used, <code>false</code>
* otherwise.
*/
private boolean usesAtom;
/**
* Flag specifying the current type of file used.
*/
private int currentFile = VALID;
/**
* ServerSocket used to listen for incoming connections.
*/
private ServerSocket server = null;
/**
* Thread for responding to client requests.
*/
private TestingServerThread runner = null;
/**
* <code>true</code> if the server was successfully launched (through a call
* to <code>start()</code>, <code>false</code> otherwise.
*/
private boolean serverActive;
/**
* Public constructor. Creates the server and binds it to port 8080 of the
* loop-back address. It uses port 8080 instead of the more
@ -92,15 +92,15 @@ public class TestingServer
* address/port, it throws an IOException detailing the problem.
*/
public TestingServer()
throws IOException
throws IOException
{
server = new ServerSocket(8080, 20,
InetAddress.getByName(null));
usesAtom = false;
serverActive = false;
currentFile = INVALID;
server = new ServerSocket(8080, 20,
InetAddress.getByName(null));
usesAtom = false;
serverActive = false;
currentFile = INVALID;
}
/**
* Sets whether or not to use ATOM-like files or not
* @param usesAtom <code>true</code> to serve ATOM-like files,
@ -108,19 +108,19 @@ public TestingServer()
*/
public void setAtomUsage(boolean usesAtom)
{
this.usesAtom = usesAtom;
this.usesAtom = usesAtom;
}
/**
* Accessor for the field variable <code>usesAtom</code>
* @return <code>true</code> if ATOM-like files are used, <code>false</code>
* otherwise.
* otherwise.
*/
public boolean usesAtom()
{
return this.usesAtom;
return this.usesAtom;
}
/**
* Returns the current state of the server.
* @return <code>true</code> if a successful call to <code>start()</code>
@ -129,47 +129,47 @@ public boolean usesAtom()
*/
public boolean isActive()
{
return serverActive;
return serverActive;
}
/**
* Sets the type of file the server serves.
* @param type int enum specifying the type of file.
*/
public void setServerBehaviour(int type)
{
if (type == INVALID || type == VALID || type == VALID_UPDATE
|| type == VALID_NEW )
currentFile = type;
else
currentFile = INVALID;
if (type == INVALID || type == VALID || type == VALID_UPDATE
|| type == VALID_NEW )
currentFile = type;
else
currentFile = INVALID;
}
/**
* Return the type of file currently server by the server.
* @return file type.
*/
public int getServerBehaviour()
{
return currentFile;
return currentFile;
}
/**
* Starts the listening process for incoming connections in a separate
* thread.
*/
public void start()
{
//only allow one "instance" of the server to be running at a given time
if (serverActive)
return;
//create new thread and launch
runner = new TestingServerThread(this, server);
serverActive = true;
runner.start();
//only allow one "instance" of the server to be running at a given time
if (serverActive)
return;
//create new thread and launch
runner = new TestingServerThread(this, server);
serverActive = true;
runner.start();
}
/**
* Takes the server into an inactive state. If the listening thread is still
* running it waits for it to end.
@ -177,12 +177,12 @@ public void start()
*/
public void stop() throws InterruptedException
{
//wait for listening thread to end
if (runner.isAlive())
runner.join();
//restore server state
serverActive = false;
runner = null;
//wait for listening thread to end
if (runner.isAlive())
runner.join();
//restore server state
serverActive = false;
runner = null;
}
}

@ -9,24 +9,24 @@
import java.net.*;
import java.io.*;
import java.util.*;
import java.text.*;
import java.text.*;
/**
* This class represents the separate thread that a <code>TestingServer</code>
* uses to listen for incoming connections.
* A reference to the object that launched the thread is also kept too in order
* to have easier access to the server settings.
*
*
* @author Mihai Balan
*/
public class TestingServerThread
extends Thread
extends Thread
{
/**
* The server that launched us.
*/
private TestingServer launcher = null;
/**
* The server's <code>ServerSocket</code>. We keep a reference to it to as
* the call to <code>ServerSocket.accept()</code> is made in the thread (us)
@ -37,7 +37,7 @@ public class TestingServerThread
* <code>Socket</code> used for network I/O.
*/
private Socket socket;
/**
* Creates a new thread for listening for connections.
* @param launcher the <code>TestingServer</code> object that created us.
@ -46,140 +46,140 @@ public class TestingServerThread
*/
public TestingServerThread(TestingServer launcher, ServerSocket serverSock)
{
/* would a check for null (mainly for the launcher) and an eventual
* NullPointerException make sense here?*/
this.launcher = launcher;
this.serverSocket = serverSock;
/* would a check for null (mainly for the launcher) and an eventual
* NullPointerException make sense here?*/
this.launcher = launcher;
this.serverSocket = serverSock;
}
/**
* Effectively launches the server thread. It starts listening for
* connections on <code>serverSocket</code>, and upon a successful request
* serves the file according to the <code>launcher</code>'s settings.
* serves the file according to the <code>launcher</code>'s settings.
*/
public void run()
{
if (launcher.isActive())
{
try {
socket = serverSocket.accept();
BufferedReader in = new BufferedReader(
new InputStreamReader(socket.getInputStream()));
processRequest(in);
launcher.stop();
} catch (IOException e)
{
e.printStackTrace();
socket = null;
} catch (InterruptedException ie)
{
ie.printStackTrace();
}
}
if (launcher.isActive())
{
try {
socket = serverSocket.accept();
BufferedReader in = new BufferedReader(
new InputStreamReader(socket.getInputStream()));
processRequest(in);
launcher.stop();
} catch (IOException e)
{
e.printStackTrace();
socket = null;
} catch (InterruptedException ie)
{
ie.printStackTrace();
}
}
}
/**
* Processes the HTTP request and initiates the sending of a response
* according to the server settings.
*
*
* @param in network end-point from which we read.
*
*
* @throws IOException
*/
public void processRequest(BufferedReader in)
throws IOException
throws IOException
{
String crtLine;
String httpVersion = null;
boolean gotRequest = false;
//XXX: Debug
//System.out.println("Processing request. Dump follows:");
//look for the get string and totally and blindly ignore all other
//HTTP headers
while (! "".equals(crtLine = in.readLine().trim()) && crtLine != null)
{
//XXX: Debug
//System.out.println("> " + crtLine);
if (crtLine.startsWith("GET /"))
{
gotRequest = true;
int httpPos = -1;
httpPos = crtLine.lastIndexOf(" HTTP/");
if (httpPos != -1)
httpVersion = crtLine.substring(httpPos + 1);
else
httpVersion = "HTTP/1.0";
}
}
//if no file was requested, just abort
if (! gotRequest)
return;
BufferedWriter out = new BufferedWriter(
new OutputStreamWriter(socket.getOutputStream()));
sendResponse(out, httpVersion);
String crtLine;
String httpVersion = null;
boolean gotRequest = false;
//XXX: Debug
//System.out.println("Processing request. Dump follows:");
//look for the get string and totally and blindly ignore all other
//HTTP headers
while (! "".equals(crtLine = in.readLine().trim()) && crtLine != null)
{
//XXX: Debug
//System.out.println("> " + crtLine);
if (crtLine.startsWith("GET /"))
{
gotRequest = true;
int httpPos = -1;
httpPos = crtLine.lastIndexOf(" HTTP/");
if (httpPos != -1)
httpVersion = crtLine.substring(httpPos + 1);
else
httpVersion = "HTTP/1.0";
}
}
//if no file was requested, just abort
if (! gotRequest)
return;
BufferedWriter out = new BufferedWriter(
new OutputStreamWriter(socket.getOutputStream()));
sendResponse(out, httpVersion);
}
/**
* Builds and sends the HTTP response according to the server settings.
*
*
* @param out the network end-point to which we write to.
* @param httpVersion textual representation of the HTTP version used.
* Should either be "HTTP/1.0" or "HTTP/1.1".
*
*
* @throws IOException
*/
public void sendResponse(BufferedWriter out, String httpVersion)
throws IOException
throws IOException
{
String content = "";
SimpleDateFormat dateFormatter =
new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z");
//getting output
switch (launcher.getServerBehaviour())
{
case TestingServer.INVALID:
content = launcher.usesAtom() ? FeedFactory.getAtomInvalid()
: FeedFactory.getRssInvalid();
break;
case TestingServer.VALID:
content = launcher.usesAtom() ? FeedFactory.getAtom()
: FeedFactory.getRss();
break;
case TestingServer.VALID_UPDATE:
content = launcher.usesAtom() ? FeedFactory.getAtomUpdated()
: FeedFactory.getRssUpdated();
break;
case TestingServer.VALID_NEW:
content = launcher.usesAtom() ? FeedFactory.getAtomNew()
: FeedFactory.getRssNew();
break;
}
//XXX: Debug
//System.out.println("Sending response headers...");
//building response HTTP headers
out.write(httpVersion + "200 OK\r\n");
out.write("Server: RssTestingServer/0.0.1\r\n");
out.write("Date: " + dateFormatter.format(new Date()) + "\r\n");
out.write("Content-Type: text/html; charset=utf-8\r\n");
out.write("Content-length: " + content.length() + "\r\n");
out.write("\r\n");
//outputting the file
out.write(content);
out.close();
socket.close();
socket = null;
String content = "";
SimpleDateFormat dateFormatter =
new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z");
//getting output
switch (launcher.getServerBehaviour())
{
case TestingServer.INVALID:
content = launcher.usesAtom() ? FeedFactory.getAtomInvalid()
: FeedFactory.getRssInvalid();
break;
case TestingServer.VALID:
content = launcher.usesAtom() ? FeedFactory.getAtom()
: FeedFactory.getRss();
break;
case TestingServer.VALID_UPDATE:
content = launcher.usesAtom() ? FeedFactory.getAtomUpdated()
: FeedFactory.getRssUpdated();
break;
case TestingServer.VALID_NEW:
content = launcher.usesAtom() ? FeedFactory.getAtomNew()
: FeedFactory.getRssNew();
break;
}
//XXX: Debug
//System.out.println("Sending response headers...");
//building response HTTP headers
out.write(httpVersion + "200 OK\r\n");
out.write("Server: RssTestingServer/0.0.1\r\n");
out.write("Date: " + dateFormatter.format(new Date()) + "\r\n");
out.write("Content-Type: text/html; charset=utf-8\r\n");
out.write("Content-length: " + content.length() + "\r\n");
out.write("\r\n");
//outputting the file
out.write(content);
out.close();
socket.close();
socket = null;
}
}

@ -286,7 +286,7 @@ public void firstTestReceiveMessage()
assertEquals("message content type"
, OperationSetBasicInstantMessaging.DEFAULT_MIME_TYPE
, evt.getSourceMessage().getContentType());
// ensure that we received every messages event
try {
synchronized (this) {
@ -356,7 +356,7 @@ public void thenTestSendMessage()
((MessageReceivedEvent)imEvtCollector2.collectedEvents
.get(0)).getSourceMessage().getContent();
assertEquals("received message body", msg.getContent(), receivedBody);
// ensure that we received every messages event
try {
synchronized (this) {
@ -423,7 +423,7 @@ public void testCreateMessage2()
assertEquals("message length", body.getBytes(encoding).length,
msg.getSize());
} catch (UnsupportedEncodingException e) {
logger.warn("The current content encoding isn't supported", e);
logger.warn("The current content encoding isn't supported", e);
assertTrue("message body bytes"
, Arrays.equals(body.getBytes(), msg.getRawData()));
assertEquals("message length", body.getBytes().length,

Loading…
Cancel
Save