2 * _XSingleLayerStratum.java
4 * Created on 23. March 2004, 16:37
6 package ifc
.configuration
.backend
;
7 import com
.sun
.star
.configuration
.backend
.XLayer
;
8 import com
.sun
.star
.configuration
.backend
.XSingleLayerStratum
;
9 import com
.sun
.star
.configuration
.backend
.XUpdatableLayer
;
11 import lib
.MultiMethodTest
;
13 import util
.XLayerHandlerImpl
;
16 public class _XSingleLayerStratum
extends MultiMethodTest
{
17 public XSingleLayerStratum oObj
;
19 public void _getLayer() {
20 String aLayerID
= "org.openoffice.Office.Common";
24 XLayer aLayer
= oObj
.getLayer("", "");
25 log
.println("Exception expected -- FAILED");
27 } catch (com
.sun
.star
.configuration
.backend
.BackendAccessException e
) {
28 log
.println("unexpected Exception " + e
+ " -- FAILED");
30 } catch (com
.sun
.star
.lang
.IllegalArgumentException e
) {
31 log
.println("expected Exception -- OK");
35 XLayer aLayer
= oObj
.getLayer(aLayerID
, "");
36 res
&= (aLayer
!= null);
39 log
.println("\treturned Layer is NULL -- FAILED");
42 res
&= checkLayer(aLayer
);
43 } catch (com
.sun
.star
.configuration
.backend
.BackendAccessException e
) {
44 log
.println("unexpected Exception -- FAILED");
46 } catch (com
.sun
.star
.lang
.IllegalArgumentException e
) {
47 log
.println("unexpected Exception -- FAILED");
51 tRes
.tested("getLayer()", res
);
54 public void _getUpdatableLayer() {
55 String aLayerID
= "org.openoffice.Office.Common";
59 XUpdatableLayer aLayer
= oObj
.getUpdatableLayer("");
60 log
.println("Exception expected -- FAILED");
62 } catch (com
.sun
.star
.configuration
.backend
.BackendAccessException e
) {
63 log
.println("unexpected Exception " + e
+ " -- FAILED");
65 } catch (com
.sun
.star
.lang
.IllegalArgumentException e
) {
66 log
.println("expected Exception -- OK");
67 } catch (com
.sun
.star
.lang
.NoSupportException e
) {
68 log
.println("unexpected Exception -- FAILED");
73 XUpdatableLayer aLayer
= oObj
.getUpdatableLayer(aLayerID
);
74 res
&= (aLayer
!= null);
77 log
.println("\treturned Layer is NULL -- FAILED");
80 res
&= checkLayer(aLayer
);
81 } catch (com
.sun
.star
.configuration
.backend
.BackendAccessException e
) {
82 log
.println("unexpected Exception -- FAILED");
84 } catch (com
.sun
.star
.lang
.IllegalArgumentException e
) {
85 log
.println("unexpected Exception -- FAILED");
87 } catch (com
.sun
.star
.lang
.NoSupportException e
) {
88 log
.println("unexpected Exception -- FAILED");
92 tRes
.tested("getUpdatableLayer()", res
);
95 protected boolean checkLayer(XLayer aLayer
) {
98 log
.println("Checking for Exception in case of null argument");
101 aLayer
.readData(null);
102 } catch (com
.sun
.star
.lang
.NullPointerException e
) {
103 log
.println("Expected Exception -- OK");
105 } catch (com
.sun
.star
.lang
.WrappedTargetException e
) {
106 log
.println("Unexpected Exception (" + e
+ ") -- FAILED");
107 } catch (com
.sun
.star
.configuration
.backend
.MalformedDataException e
) {
108 log
.println("Unexpected Exception (" + e
+ ") -- FAILED");
111 log
.println("checking read data with own XLayerHandler implementation");
114 XLayerHandlerImpl xLayerHandler
= new XLayerHandlerImpl();
115 aLayer
.readData(xLayerHandler
);
117 String implCalled
= xLayerHandler
.getCalls();
118 log
.println(implCalled
);
120 int sl
= implCalled
.indexOf("startLayer");
123 log
.println("startLayer wasn't called -- FAILED");
126 log
.println("startLayer was called -- OK");
130 int el
= implCalled
.indexOf("endLayer");
133 log
.println("endLayer wasn't called -- FAILED");
136 log
.println("endLayer was called -- OK");
139 } catch (com
.sun
.star
.lang
.NullPointerException e
) {
140 log
.println("Unexpected Exception (" + e
+ ") -- FAILED");
142 } catch (com
.sun
.star
.lang
.WrappedTargetException e
) {
143 log
.println("Unexpected Exception (" + e
+ ") -- FAILED");
145 } catch (com
.sun
.star
.configuration
.backend
.MalformedDataException e
) {
146 log
.println("Unexpected Exception (" + e
+ ") -- FAILED");