/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @summary Tests for HeaderParser and MessageHeader
*
* Test of HeaderParser, MessageHeader changes
* introduced for bug fix 4722333.
*/
public class HeaderTests {
MessageHeader h = new MessageHeader ();
try {
h.parseHeader (bis);
} catch (IOException e) {
throw new RuntimeException ("IOException parsing header");
}
return h;
}
/* String to parse */
"Foo: bar\r\n"+
"Fub: abc\r\n"+
"Foo:\r\n"+
"Fub: \r\n"+
"Foo: param1=one param2=\"two\" param3 param4=\"value=4\"\r\n"+
"Fub: xparam1=one xparam2=\"two\" xparam3 xparam4=\"value=4\"\r\n";
static String s3 = "p1=1, p2=2, p3=3, p4=4, p5=5, p6=\"six\", p7=7, p8=8, p9=9, p10=10, p11=11, p12=12";
{"p7","7"},{"p8","8"},{"p9","9"},{"p10","10"},{"p11","11"},{"p12","12"}};
static String s23_expect1[][] = {{"p1","1"},{"p2","2"},{"p3","3"},{"p4","4"},{"p5","5"},{"p6","six"},
{"p7","7"},{"p8","8"},{"p9","9"},{"p10","10"},{"p11","11"}};
/* Expected header parser contents for Foo headers */
},
{{"param1","one"},{"param2","two"},
}
};
/* Expected header parser contents for Fub headers */
},
{{"xparam1","one"},{"xparam2","two"},
}
};
}
HeaderParser p = new HeaderParser (s);
if (!empty) {
i++;
}
}
}
boolean empty = true;
empty = false;
continue;
}
}
}
}
return empty;
}
}