- @Test
- public void namespaceNotNullAndInvalidNamespaceAndNoModuleNameTest() {
- boolean exceptionReised = false;
- try {
- TestUtils.normalizeCompositeNode(prepareCnSn("wrongnamespace"), modules, schemaNodePath);
- } catch (ResponseException e) {
- exceptionReised = true;
- }
- assertTrue(exceptionReised);
- }
-
- @Test
- public void namespaceNullTest() {
- String exceptionMessage = null;
- try {
- TestUtils.normalizeCompositeNode(prepareCnSn(null), modules, schemaNodePath);
- } catch (ResponseException e) {
- exceptionMessage = String.valueOf(e.getResponse().getEntity());
- }
- assertNull(exceptionMessage);
- }
-
- @Test
- public void namespaceValidNamespaceTest() {
- String exceptionMessage = null;
- try {
- TestUtils.normalizeCompositeNode(prepareCnSn("normalize:node:module"), modules, schemaNodePath);
- } catch (ResponseException e) {
- exceptionMessage = String.valueOf(e.getResponse().getEntity());
- }
- assertNull(exceptionMessage);
- }
-
- @Test
- public void namespaceValidModuleNameTest() {
- String exceptionMessage = null;
- try {
- TestUtils.normalizeCompositeNode(prepareCnSn("normalize-node-module"), modules, schemaNodePath);
- } catch (ResponseException e) {
- exceptionMessage = String.valueOf(e.getResponse().getEntity());
- }
- assertNull(exceptionMessage);
- }
-
- private CompositeNode prepareCnSn(String namespace) {
- URI uri = null;
- if (namespace != null) {
- try {
- uri = new URI(namespace);
- } catch (URISyntaxException e) {
- }
- assertNotNull(uri);
- }
-
- SimpleNodeWrapper lf1 = new SimpleNodeWrapper(uri, "lf1", 43);
- CompositeNodeWrapper cont = new CompositeNodeWrapper(uri, "cont");
- cont.addValue(lf1);
-
- return cont;
- }
-