01: /*******************************************************************************
02: * Copyright (c) 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.ui.tests.model.bundle;
11:
12: import org.eclipse.pde.internal.core.ibundle.IManifestHeader;
13:
14: public abstract class MultiLineHeaderTestCase extends
15: BundleModelTestCase {
16:
17: public MultiLineHeaderTestCase(String headerName) {
18: super (headerName);
19: }
20:
21: public void testHeaderLengthMultiLines1() throws Exception {
22: StringBuffer buffer = new StringBuffer();
23: buffer.append("Manifest-Version: 1.0\n");
24: buffer.append("Bundle-ManifestVersion: 2\n");
25: buffer.append("Bundle-SymoblicName: com.example.xyz\n");
26: buffer.append(fHeaderName);
27: buffer.append(": com.example.abc,\n");
28: buffer.append(" com.example.abc.actions\n");
29: fDocument.set(buffer.toString());
30: load();
31:
32: IManifestHeader header = fModel.getBundle().getManifestHeader(
33: fHeaderName);
34: assertEquals(fDocument.getLineLength(3)
35: + fDocument.getLineLength(4), header.getLength());
36: }
37:
38: public void testHeaderLengthMultiLines2() throws Exception {
39: StringBuffer buffer = new StringBuffer();
40: buffer.append("Manifest-Version: 1.0\n");
41: buffer.append("Bundle-ManifestVersion: 2\n");
42: buffer.append(fHeaderName);
43: buffer.append(": com.example.abc,\n");
44: buffer.append(" com.example.abc.actions\n");
45: buffer.append("Bundle-SymoblicName: com.example.xyz\n");
46: fDocument.set(buffer.toString());
47: load();
48:
49: IManifestHeader header = fModel.getBundle().getManifestHeader(
50: fHeaderName);
51: assertEquals(fDocument.getLineLength(2)
52: + fDocument.getLineLength(3), header.getLength());
53: }
54: }
|