You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ar...@apache.org on 2012/01/27 02:29:58 UTC

svn commit: r1236486 [41/43] - in /incubator/ooo/devtools/netbeansintegration: ./ build/ build/public-package-jars/ javahelp/ javahelp/org/ javahelp/org/openoffice/ javahelp/org/openoffice/extensions/ javahelp/org/openoffice/extensions/docs/ javahelp/o...

Added: incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/config/office/WinLocatorTest.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/config/office/WinLocatorTest.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/config/office/WinLocatorTest.java (added)
+++ incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/config/office/WinLocatorTest.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,70 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.openoffice.extensions.config.office;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ *
+ * @author sg128468
+ */
+public class WinLocatorTest extends TestCase {
+    
+    public WinLocatorTest(String testName) {
+        super(testName);
+    }
+
+    public static Test suite() {
+        TestSuite suite = new TestSuite(WinLocatorTest.class);
+        return suite;
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    /**
+     * Test of locateOfficePaths method, of class WinLocator.
+     */
+    public void testLocateOfficePaths() {
+        System.out.println("locateOfficePaths");
+        WinLocator instance = null;
+        instance.locateOfficePaths();
+        // TODO review the generated test code and remove the default call to fail.
+        fail("The test case is a prototype.");
+    }
+
+    /**
+     * Test of locateOffice method, of class WinLocator.
+     */
+    public void testLocateOffice() {
+        System.out.println("locateOffice");
+        WinLocator instance = null;
+        instance.locateOffice();
+        // TODO review the generated test code and remove the default call to fail.
+        fail("The test case is a prototype.");
+    }
+
+    /**
+     * Test of locateSDK method, of class WinLocator.
+     */
+    public void testLocateSDK() {
+        System.out.println("locateSDK");
+        WinLocator instance = null;
+        instance.locateSDK();
+        // TODO review the generated test code and remove the default call to fail.
+        fail("The test case is a prototype.");
+    }
+
+}

Added: incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/IdlFileCreatorTest.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/IdlFileCreatorTest.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/IdlFileCreatorTest.java (added)
+++ incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/IdlFileCreatorTest.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,72 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.openoffice.extensions.util;
+
+import junit.framework.TestCase;
+import org.openide.filesystems.FileObject;
+import org.openoffice.extensions.util.datamodel.NbNodeObject;
+import org.openoffice.extensions.util.datamodel.Service;
+
+/**
+ *
+ * @author sg128468
+ */
+public class IdlFileCreatorTest extends TestCase {
+    
+    public IdlFileCreatorTest(String testName) {
+        super(testName);
+    }            
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    /**
+     * Test of getIdlTypeForJavaType method, of class IdlFileCreator.
+     */
+    public void testGetIdlTypeForJavaType() {
+        System.out.println("getIdlTypeForJavaType");
+        for (int i = 0; i < IdlFileCreator.IDL_JAVA_TYPE_MAPPING.length; i++) {
+            String result = IdlFileCreator.getIdlTypeForJavaType(IdlFileCreator.IDL_JAVA_TYPE_MAPPING[i][1]);
+            assertEquals(IdlFileCreator.IDL_JAVA_TYPE_MAPPING[i][0], result);
+        }
+        String someType = "com.sun.star.test.TestType";
+        String expResult = "com::sun::star::test::TestType";
+        assertEquals(expResult, IdlFileCreator.getIdlTypeForJavaType(someType));
+    }
+
+    /**
+     * Test of createAllIdlFiles method, of class IdlFileCreator.
+     *
+    public void testCreateAllIdlFiles() {
+        NbNodeObject baseObject = new Service("Service", "com.example.package");
+        IdlFileCreator instance = new IdlFileCreator();
+        FileObject[] expResult = null;
+        FileObject[] result = instance.createAllIdlFiles(baseObject);
+        assertEquals(expResult, result);
+        // TODO review the generated test code and remove the default call to fail.
+        fail("The test case is a prototype.");
+    }
+
+    /**
+     * Test of getModuleFromPackage method, of class IdlFileCreator.
+     *
+    public void testGetModuleFromPackage() {
+        System.out.println("getModuleFromPackage");
+        String pkg = "";
+        IdlFileCreator instance = null;
+        instance.getModuleFromPackage(pkg);
+        // TODO review the generated test code and remove the default call to fail.
+        fail("The test case is a prototype.");
+    } */
+
+}

Added: incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/IdlFileHelperTest.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/IdlFileHelperTest.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/IdlFileHelperTest.java (added)
+++ incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/IdlFileHelperTest.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,61 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.openoffice.extensions.util;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import junit.framework.TestCase;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.Exceptions;
+import org.openoffice.extensions.util.datamodel.NbNodeObject;
+
+/**
+ *
+ * @author sg128468
+ */
+public class IdlFileHelperTest extends TestCase {
+    
+    public IdlFileHelperTest(String testName) {
+        super(testName);
+    }            
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    /**
+     * Test of getAllIdlFiles method, of class IdlFileHelper.
+     */
+    public void testGetAllIdlFiles() {
+        System.out.println("getAllIdlFiles");
+        File tmpDir = new File(System.getProperty("java.io.tmpdir"));
+//        System.out.println("Tempdir" + tmpDir);
+//        FileObject o;
+//        try {
+//            o = FileUtil.createFolder(tmpDir);
+//        } catch (IOException ex) {
+//            fail(ex.toString());
+//        }
+//        System.out.println("FO " + o);
+//        IdlFileHelper instance = new IdlFileHelper(o);
+//        File[] list = tmpDir.listFiles(new FilenameFilter() {
+//            public boolean accept(File dir, String name) {
+//                return name.endsWith(".idl");
+//            }
+//        });
+//        NbNodeObject[] result = instance.getAllIdlFiles();
+//        assertEquals(list.length, result.length);
+    }
+
+}

Added: incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/LogWriterTest.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/LogWriterTest.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/LogWriterTest.java (added)
+++ incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/LogWriterTest.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,161 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.openoffice.extensions.util;
+
+import java.io.OutputStream;
+import junit.framework.TestCase;
+
+/**
+ *
+ * @author sg128468
+ */
+public class LogWriterTest extends TestCase {
+    
+    public LogWriterTest(String testName) {
+        super(testName);
+    }            
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    /**
+     * Test of getLoglevels method, of class LogWriter.
+     */
+    public void testGetLoglevels() {
+        System.out.println("getLoglevels");
+        String[] expResult = new String[]{"Info", "Warning", "Critical"};
+        String[] result = LogWriter.getLoglevels();
+        assertEquals(expResult.length, result.length);
+        for (int i = 0; i < result.length; i++) {
+            assertEquals(expResult[i], result[i]);
+        }
+    }
+
+    /**
+     * Test of getLogWriter method, of class LogWriter.
+     */
+    public void testGetLogWriter() {
+        System.out.println("getLogWriter");
+        LogWriter result = LogWriter.getLogWriter();
+        assertNotNull(result);
+    }
+
+    /**
+     * Test of createLogWriter method, of class LogWriter.
+     */
+    public void testCreateLogWriter() {
+        System.out.println("createLogWriter");
+        String level = "info";
+        String path = System.getProperty("java.io.tmpdir");
+        LogWriter result = LogWriter.createLogWriter(level, path);
+        assertNotNull(result);
+    }
+
+    /**
+     * Test of getDefaultValues method, of class LogWriter.
+     */
+    public void testGetDefaultValues() {
+        System.out.println("getDefaultValues");
+        String level = "info";
+        String path = System.getProperty("java.io.tmpdir");
+        System.setProperty(LogWriter.LOG_LEVEL, level);
+        System.setProperty(LogWriter.LOG_PATH, path);
+        String[] expResult = new String[]{level, path};
+        String[] result = LogWriter.getDefaultValues();
+        assertEquals(expResult.length, result.length);
+        for (int i = 0; i < result.length; i++) {
+            assertEquals(expResult[i], result[i]);
+        }
+    }
+
+    /**
+     * Test of isActive method, of class LogWriter.
+     */
+    public void testIsActive() {
+        System.out.println("isActive");
+        LogWriter instance = LogWriter.createLogWriter("inactive", System.getProperty("java.io.tmpdir"));
+        boolean expResult = true;
+        boolean result = instance.isActive();
+        assertEquals(expResult, result);
+        instance = LogWriter.createLogWriter("info", System.getProperty("java.io.tmpdir"));
+        expResult = false;
+        result = instance.isActive();
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of getLogFile method, of class LogWriter.
+     */
+    public void testGetLogFile() {
+        System.out.println("getLogFile");
+        LogWriter instance = LogWriter.getLogWriter();
+        String result = instance.getLogFile();
+        assertNotNull(result);
+    }
+
+    /**
+     * Test of getLogStream method, of class LogWriter.
+     */
+    public void testGetLogStream() {
+        System.out.println("getLogStream");
+        int logLevel = LogWriter.LEVEL_ALL;
+        LogWriter instance = LogWriter.getLogWriter();
+        OutputStream result = instance.getLogStream(logLevel);
+        assertNotNull(result);
+    }
+
+    /**
+     * Test of clearLogFile method, of class LogWriter.
+     */
+    public void testClearLogFile() {
+        System.out.println("clearLogFile");
+        LogWriter instance = LogWriter.getLogWriter();
+        instance.clearLogFile();
+        // how to test?
+    }
+
+    /**
+     * Test of log method, of class LogWriter.
+     */
+    public void testLog() {
+        System.out.println("log");
+        int level = 0;
+        String message = "This is a message";
+        LogWriter instance = LogWriter.getLogWriter();
+        instance.log(level, message);
+        // how to test?
+    }
+
+    /**
+     * Test of printStackTrace method, of class LogWriter.
+     */
+    public void testPrintStackTrace_Throwable() {
+        System.out.println("printStackTrace");
+        Throwable t = new Throwable("A test Throwable");
+        LogWriter instance = LogWriter.getLogWriter();
+        instance.printStackTrace(t);
+        // how to test?
+    }
+
+    /**
+     * Test of printStackTrace method, of class LogWriter.
+     */
+    public void testPrintStackTrace_String_int() {
+        System.out.println("printStackTrace");
+        String message = "Hello World.";
+        int depth = 0;
+        LogWriter instance = LogWriter.getLogWriter();
+        instance.printStackTrace(message, depth);
+    }
+
+}

Added: incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/ManifestCreatorTest.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/ManifestCreatorTest.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/ManifestCreatorTest.java (added)
+++ incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/ManifestCreatorTest.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,84 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.openoffice.extensions.util;
+
+import java.io.File;
+import java.util.Properties;
+import junit.framework.TestCase;
+import org.netbeans.api.project.Project;
+import org.netbeans.api.project.ProjectInformation;
+import org.netbeans.api.project.ProjectUtils;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+
+/**
+ *
+ * @author sg128468
+ */
+public class ManifestCreatorTest extends TestCase {
+    
+    FileObject projectRoot;
+    
+    public ManifestCreatorTest(String testName) {
+        super(testName);
+    }            
+
+    @Override
+    protected void setUp() throws Exception {
+        // TODO: create mock file object for tests
+        projectRoot = FileUtil.toFileObject(new File(System.getProperty("java.io.tmpdir")));
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    /**
+     * Test of add method, of class ManifestCreator.
+     */
+    public void testAdd() {
+        System.out.println("add");
+        String mimeType = "some type";
+        String fullPath = "some path";
+        ManifestCreator instance = new ManifestCreator(projectRoot);
+        instance.add(mimeType, fullPath);
+    }
+
+    /**
+     * Test of remove method, of class ManifestCreator.
+     */
+    public void testRemove() {
+        System.out.println("remove");
+        String mimeType = "some type";
+        String fullPath = "some path";
+        ManifestCreator instance = new ManifestCreator(projectRoot);
+        instance.remove(mimeType, fullPath);
+    }
+
+    /**
+     * Test of flush method, of class ManifestCreator.
+     */
+    public void testFlush() throws Exception {
+        System.out.println("flush");
+        ManifestCreator instance = new ManifestCreator(projectRoot);
+//        instance.flush();
+//        FileObject man = projectRoot.getFileObject("src/uno-extension-manifest.xml"); // NOI18N
+//        assertTrue(man.canRead());
+//        assertTrue(man.isData());
+    }
+
+    /**
+     * Test of updateManifest method, of class ManifestCreator.
+     */
+    public void testUpdateManifest() {
+        System.out.println("updateManifest");
+        Properties props = new Properties();
+        ManifestCreator instance = new ManifestCreator(projectRoot);
+//        instance.updateManifest(props);
+    }
+
+}

Added: incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/PathExchangerTest.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/PathExchangerTest.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/PathExchangerTest.java (added)
+++ incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/PathExchangerTest.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,53 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.openoffice.extensions.util;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ * @author sg128468
+ */
+public class PathExchangerTest extends TestCase {
+    
+    public PathExchangerTest(String testName) {
+        super(testName);
+    }            
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    /**
+     * Test of pathToOfficeFileUrl method, of class PathExchanger.
+     */
+    public void testPathToOfficeFileUrl() {
+        System.out.println("pathToOfficeFileUrl");
+        String path = "d:\\example\\path";
+        String expResult = "file:///d:/example/path";
+        String result = PathExchanger.pathToOfficeFileUrl(path);
+        assertEquals(expResult, result);
+        path = "example/path";
+        expResult = "file:///example/path";
+        result = PathExchanger.pathToOfficeFileUrl(path);
+        assertEquals(expResult, result);
+        path = "/example/path";
+        expResult = "file:///example/path";
+        result = PathExchanger.pathToOfficeFileUrl(path);
+        assertEquals(expResult, result);
+        path = "file:///example/path";
+        expResult = "file:///example/path";
+        result = PathExchanger.pathToOfficeFileUrl(path);
+        assertEquals(expResult, result);
+    }
+
+}

Added: incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/ScriptExecutorTest.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/ScriptExecutorTest.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/ScriptExecutorTest.java (added)
+++ incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/ScriptExecutorTest.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,147 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.openoffice.extensions.util;
+
+import java.io.File;
+import java.util.Map;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.openoffice.extensions.config.office.PlatformInfo;
+
+/**
+ *
+ * @author sg128468
+ */
+public class ScriptExecutorTest extends TestCase {
+    
+    private String executeCommand;
+            
+    public ScriptExecutorTest(String testName) {
+        super(testName);
+    }            
+
+    @Override
+    protected void setUp() throws Exception {
+        if (PlatformInfo.isWindows()) {
+            executeCommand = "dir";
+        }
+        else {
+            executeCommand = "ls";
+        }
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    public static Test suite() {
+        TestSuite suite = new TestSuite(ScriptExecutorTest.class);
+        
+        return suite;
+    }
+
+    /**
+     * Test of setEnv method, of class ScriptExecutor.
+     */
+    public void testSetEnv() {
+        System.out.println("setEnv");
+        Map _envVars = null;
+        ScriptExecutor.setEnv(_envVars);
+    }
+
+    /**
+     * Test of executeScript method, of class ScriptExecutor.
+     */
+    public void testExecuteScript_3args() {
+        System.out.println("executeScript");
+        String[] script = new String[]{executeCommand};
+        Map _envVars = null;
+        File workDir = new File(System.getProperty("java.io.tmpdir"));
+        int expResult = 0;
+        int result = ScriptExecutor.executeScript(script, _envVars, workDir);
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of executeScript method, of class ScriptExecutor.
+     */
+    public void testExecuteScript_StringArr_StringArr() {
+        System.out.println("executeScript");
+        String[] script = new String[]{executeCommand};
+        Map envVars = null;
+        int expResult = 0;
+        int result = ScriptExecutor.executeScript(script, envVars);
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of executeScript method, of class ScriptExecutor.
+     */
+    public void testExecuteScript_StringArr() {
+        System.out.println("executeScript");
+        String[] script = new String[]{executeCommand};
+        int expResult = 0;
+        int result = ScriptExecutor.executeScript(script);
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of executeScript method, of class ScriptExecutor.
+     */
+    public void testExecuteScript_StringArr_File() {
+        System.out.println("executeScript");
+        String[] script = new String[]{executeCommand};
+        File workDir = new File(System.getProperty("java.io.tmpdir"));
+        int expResult = 0;
+        int result = ScriptExecutor.executeScript(script, workDir);
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of getErrors method, of class ScriptExecutor.
+     */
+    public void testGetErrors() {
+        System.out.println("getErrors");
+        String expResult = "";
+        String result = ScriptExecutor.getErrors();
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of hasErrors method, of class ScriptExecutor.
+     */
+    public void testHasErrors() {
+        System.out.println("hasErrors");
+        boolean expResult = false;
+        boolean result = ScriptExecutor.hasErrors();
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of getOutput method, of class ScriptExecutor.
+     */
+    public void testGetOutput() {
+        System.out.println("getOutput");
+        String[] script = new String[]{executeCommand};
+        ScriptExecutor.executeScript(script);
+        String result = ScriptExecutor.getOutput();
+        assertTrue(result.length() > 0);
+    }
+
+    /**
+     * Test of hasOutput method, of class ScriptExecutor.
+     */
+    public void testHasOutput() {
+        System.out.println("hasOutput");
+        boolean expResult = true;
+        String[] script = new String[]{executeCommand};
+        ScriptExecutor.executeScript(script);
+        boolean result = ScriptExecutor.hasOutput();
+        assertEquals(expResult, result);
+    }
+}

Added: incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/UtilSuite.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/UtilSuite.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/UtilSuite.java (added)
+++ incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/UtilSuite.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile: UtilSuite.java,v $
+ *
+ *  $Revision: 1.1 $
+ *
+ *  last change: $Author: sg $ $Date: 2008/08/01 15:45:14 $
+ *
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
+ *
+ *    This library 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
+ *    Lesser General Public License for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.util;
+
+import junit.framework.*;
+
+/**
+ *
+ * @author sg128468
+ */
+public class UtilSuite extends TestCase {
+    
+    public UtilSuite(String testName) {
+        super(testName);
+    }
+
+    protected void setUp() throws Exception {
+    }
+
+    protected void tearDown() throws Exception {
+    }
+
+    /**
+     * suite method automatically generated by JUnit module
+     */
+    public static Test suite() {
+        TestSuite suite = new TestSuite("UtilSuite");
+        suite.addTest(org.openoffice.extensions.util.ScriptExecutorTest.suite());
+        return suite;
+    }
+    
+}

Added: incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/DatamodelSuite.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/DatamodelSuite.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/DatamodelSuite.java (added)
+++ incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/DatamodelSuite.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile: DatamodelSuite.java,v $
+ *
+ *  $Revision: 1.1 $
+ *
+ *  last change: $Author: sg $ $Date: 2007/09/04 15:06:44 $
+ *
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
+ *
+ *    This library 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
+ *    Lesser General Public License for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.util.datamodel;
+
+import junit.framework.*;
+
+/**
+ *
+ * @author sg128468
+ */
+public class DatamodelSuite extends TestCase {
+    
+    public DatamodelSuite(String testName) {
+        super(testName);
+    }
+
+    protected void setUp() throws Exception {
+    }
+
+    protected void tearDown() throws Exception {
+    }
+
+    /**
+     * suite method automatically generated by JUnit module
+     */
+    public static Test suite() {
+        TestSuite suite = new TestSuite("DatamodelSuite");
+        suite.addTest(org.openoffice.extensions.util.datamodel.PolyStructTest.suite());
+        suite.addTest(org.openoffice.extensions.util.datamodel.properties.PropertiesSuite.suite());
+        suite.addTest(org.openoffice.extensions.util.datamodel.InterfaceTest.suite());
+        suite.addTest(org.openoffice.extensions.util.datamodel.StructTest.suite());
+        suite.addTest(org.openoffice.extensions.util.datamodel.ParameterTest.suite());
+        suite.addTest(org.openoffice.extensions.util.datamodel.IdlEnumTest.suite());
+        suite.addTest(org.openoffice.extensions.util.datamodel.IdlEnumerationTest.suite());
+        suite.addTest(org.openoffice.extensions.util.datamodel.PropertyContainerTest.suite());
+        suite.addTest(org.openoffice.extensions.util.datamodel.FunctionExceptionTest.suite());
+        suite.addTest(org.openoffice.extensions.util.datamodel.localization.LocalizationSuite.suite());
+        suite.addTest(org.openoffice.extensions.util.datamodel.ServiceTest.suite());
+        suite.addTest(org.openoffice.extensions.util.datamodel.OrderedContainerTest.suite());
+        suite.addTest(org.openoffice.extensions.util.datamodel.FunctionTest.suite());
+        suite.addTest(org.openoffice.extensions.util.datamodel.TemplateTypeTest.suite());
+        return suite;
+    }
+    
+}

Added: incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/FunctionExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/FunctionExceptionTest.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/FunctionExceptionTest.java (added)
+++ incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/FunctionExceptionTest.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,199 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile: FunctionExceptionTest.java,v $
+ *
+ *  $Revision: 1.1 $
+ *
+ *  last change: $Author: sg $ $Date: 2007/09/04 15:06:44 $
+ *
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
+ *
+ *    This library 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
+ *    Lesser General Public License for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.util.datamodel;
+
+import junit.framework.*;
+import java.beans.PropertyChangeListener;
+import java.util.Arrays;
+import java.util.Vector;
+import javax.swing.Action;
+import org.openide.nodes.Node;
+import org.openide.nodes.Sheet;
+import org.openide.util.NbBundle;
+import org.openoffice.extensions.projecttemplates.calcaddin.AddinWizardIterator;
+import org.openoffice.extensions.util.LogWriter;
+import org.openoffice.extensions.util.datamodel.actions.BaseAction;
+import org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgProperty;
+import org.openoffice.extensions.util.datamodel.properties.SimpleOpenOfficeOrgProperty;
+import org.openoffice.extensions.util.datamodel.properties.UnknownOpenOfficeOrgLanguageIDException;
+import org.openoffice.extensions.util.datamodel.properties.UnknownOpenOfficeOrgPropertyException;
+
+/**
+ *
+ * @author sg128468
+ */
+public class FunctionExceptionTest extends TestCase {
+    
+    public FunctionExceptionTest(String testName) {
+        super(testName);
+    }
+    
+    protected void setUp() throws Exception {
+    }
+    
+    protected void tearDown() throws Exception {
+    }
+    
+    public static Test suite() {
+        TestSuite suite = new TestSuite(FunctionExceptionTest.class);
+        
+        return suite;
+    }
+    
+    /**
+     * Test of getDisplayName method, of class org.openoffice.extensions.util.datamodel.FunctionException.
+     */
+    public void testGetDisplayName() {
+        System.out.println("getDisplayName");
+        
+        FunctionException instance = new FunctionException("execptionName", "sample.package");
+        
+        String expResult = "sample.package.execptionName";
+        String result = instance.getDisplayName();
+        assertEquals(expResult, result);
+    }
+    
+    /**
+     * Test of getProperty method, of class org.openoffice.extensions.util.datamodel.FunctionException.
+     */
+    public void testGetProperty() {
+        System.out.println("getProperty");
+        
+        int propertyIndex = 0;
+        FunctionException instance = new FunctionException("execptionName", "sample.package");
+        
+        String expResult = "execptionName";
+        OpenOfficeOrgProperty result = instance.getProperty(propertyIndex);
+        try {
+            assertEquals(expResult, result.getValueForLanguage(-1));
+        } catch (UnknownOpenOfficeOrgLanguageIDException ex) {
+            fail(ex.getMessage());
+        }
+    }
+    
+    /**
+     * Test of getAllSubObjects method, of class org.openoffice.extensions.util.datamodel.FunctionException.
+     */
+    public void testGetAllSubObjects() {
+        System.out.println("getAllSubObjects");
+        
+        FunctionException instance = new FunctionException("execptionName", "sample.package");
+        
+        int expResult = 3;
+        NbNodeObject[] result = instance.getAllSubObjects();
+        assertEquals(expResult, result.length);
+    }
+    
+    /**
+     * Test of createProperties method, of class org.openoffice.extensions.util.datamodel.FunctionException.
+     */
+    public void testCreateProperties() {
+        System.out.println("createProperties");
+        
+        FunctionException instance = new FunctionException("execptionName", "sample.package");
+        
+        int expResult = 3;
+        Node.Property[] result = instance.createProperties(null, null);
+        assertEquals(expResult, result.length);
+    }
+    
+    /**
+     * Test of setActions method, of class org.openoffice.extensions.util.datamodel.FunctionException.
+     */
+    public void testSetActions() {
+        System.out.println("setActions");
+        
+        FunctionException instance = new FunctionException("execptionName", "sample.package");
+        
+        instance.setActions(null); // empty implementation
+    }
+    
+    /**
+     * Test of getActions method, of class org.openoffice.extensions.util.datamodel.FunctionException.
+     */
+    public void testGetActions() {
+        System.out.println("getActions");
+        
+        boolean b = true;
+        FunctionException instance = new FunctionException("execptionName", "sample.package");
+        
+//        Action[] expResult = null;
+        Action[] result = instance.getActions(b);
+        assertNull(result);
+    }
+    
+    /**
+     * Test of hasActions method, of class org.openoffice.extensions.util.datamodel.FunctionException.
+     */
+    public void testHasActions() {
+        System.out.println("hasActions");
+        
+        int type = 0;
+        FunctionException instance = new FunctionException("execptionName", "sample.package");
+        
+        boolean expResult = false;
+        boolean result = instance.hasActions(type);
+        assertEquals(expResult, result);
+    }
+    
+    /**
+     * Test of getParent method, of class org.openoffice.extensions.util.datamodel.FunctionException.
+     */
+    public void testGetParent() {
+        System.out.println("getParent");
+        
+        FunctionException instance = new FunctionException("execptionName", "sample.package");
+        
+        NbNodeObject expResult = null;
+        NbNodeObject result = instance.getParent();
+        assertEquals(expResult, result);
+    }
+    
+    /**
+     * Test of getType method, of class org.openoffice.extensions.util.datamodel.FunctionException.
+     */
+    public void testGetType() {
+        System.out.println("getType");
+        
+        FunctionException instance = new FunctionException("execptionName", "sample.package");
+        
+        int expResult = NbNodeObject.EXCEPTION_TYPE;
+        int result = instance.getType();
+        assertEquals(expResult, result);
+        
+    }
+    
+}

Added: incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/FunctionTest.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/FunctionTest.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/FunctionTest.java (added)
+++ incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/FunctionTest.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,433 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile: FunctionTest.java,v $
+ *
+ *  $Revision: 1.1 $
+ *
+ *  last change: $Author: sg $ $Date: 2007/09/04 15:06:45 $
+ *
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
+ *
+ *    This library 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
+ *    Lesser General Public License for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.util.datamodel;
+
+import junit.framework.*;
+import javax.swing.Action;
+import org.openide.nodes.Node;
+import org.openoffice.extensions.util.datamodel.localization.LanguageDefinition;
+import org.openoffice.extensions.util.datamodel.properties.ObjectHelperImplementations;
+import org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgProperty;
+import org.openoffice.extensions.util.datamodel.properties.UnknownOpenOfficeOrgLanguageIDException;
+import org.openoffice.extensions.util.datamodel.properties.UnknownOpenOfficeOrgPropertyException;
+
+/**
+ *
+ * @author sg128468
+ */
+public class FunctionTest extends TestCase {
+
+    private ObjectHelperImplementations m_objectHelper;
+    
+    public FunctionTest(String testName) {
+        super(testName);
+    }
+
+    protected void setUp() throws Exception {
+        m_objectHelper = new ObjectHelperImplementations();
+    }
+
+    protected void tearDown() throws Exception {
+        m_objectHelper = null;
+    }
+
+    public static Test suite() {
+        TestSuite suite = new TestSuite(FunctionTest.class);
+        
+        return suite;
+    }
+
+    /**
+     * Test of addLanguage method, of class org.openoffice.extensions.util.datamodel.Function.
+     */
+    public void testAddLanguage() {
+        System.out.println("addLanguage");
+        
+        Function instance = new Function("functionName", "int", 
+            m_objectHelper.getAddinNbNodeObject(), 
+            new Integer[]{new Integer(LanguageDefinition.LANGUAGE_ID_en)}
+            );
+        
+        OpenOfficeOrgProperty prop = instance.getProperty(instance.PROPERTY_DisplayName);
+        try {
+            prop.getValueForLanguage(LanguageDefinition.LANGUAGE_ID_en);
+        } catch (UnknownOpenOfficeOrgLanguageIDException ex) {
+            fail(ex.getMessage());
+        }
+        
+        try {
+            String val = prop.getValueForLanguage(LanguageDefinition.LANGUAGE_ID_de);
+            assertNull(val);
+        } catch (UnknownOpenOfficeOrgLanguageIDException ex) {
+            fail(ex.getMessage());
+        }
+        
+        String expValue = "dummy text";
+        instance.addLanguage(LanguageDefinition.LANGUAGE_ID_de, expValue);
+        try {
+            prop.getValueForLanguage(LanguageDefinition.LANGUAGE_ID_en);
+            String value = prop.getValueForLanguage(LanguageDefinition.LANGUAGE_ID_de);
+            assertEquals(expValue, value);
+        } catch (UnknownOpenOfficeOrgLanguageIDException ex) {
+            fail(ex.getMessage());
+        }
+    }
+
+    /**
+     * Test of printLanguages method, of class org.openoffice.extensions.util.datamodel.Function.
+     */
+    public void testPrintLanguages() {
+        System.out.println("printLanguages");
+        
+        Function instance = new Function("functionName", "int", 
+            m_objectHelper.getAddinNbNodeObject(), 
+            new Integer[]{new Integer(LanguageDefinition.LANGUAGE_ID_en)}
+            );
+        
+        instance.printLanguages();  // just internal testing for languages
+    }
+
+    /**
+     * Test of removeLanguage method, of class org.openoffice.extensions.util.datamodel.Function.
+     */
+    public void testRemoveLanguage() {
+        System.out.println("removeLanguage");
+        
+        Function instance = new Function("functionName", "int", 
+            m_objectHelper.getAddinNbNodeObject(), 
+            new Integer[]{new Integer(LanguageDefinition.LANGUAGE_ID_en)}
+            );
+
+        String expValue = "dummy text";
+        instance.addLanguage(LanguageDefinition.LANGUAGE_ID_de, expValue);
+        
+        instance.removeLanguage(LanguageDefinition.LANGUAGE_ID_en);
+        
+        OpenOfficeOrgProperty prop = instance.getProperty(instance.PROPERTY_DisplayName);
+        try {
+            prop.getValueForLanguage(LanguageDefinition.LANGUAGE_ID_de);
+            String value = prop.getValueForLanguage(LanguageDefinition.LANGUAGE_ID_de);
+            assertEquals(expValue, value);
+        } catch (UnknownOpenOfficeOrgLanguageIDException ex) {
+            fail(ex.getMessage());
+        }
+
+        try {
+            String val = prop.getValueForLanguage(LanguageDefinition.LANGUAGE_ID_en);
+            assertNull(val);
+        } catch (UnknownOpenOfficeOrgLanguageIDException ex) {
+            fail(ex.getMessage());
+        }
+    }
+
+    /**
+     * Test of getParameter method, of class org.openoffice.extensions.util.datamodel.Function.
+     */
+    public void testGetParameter() {
+        System.out.println("getParameter");
+        
+        Function instance = new Function("functionName", "int", 
+            m_objectHelper.getAddinNbNodeObject(), 
+            new Integer[]{new Integer(LanguageDefinition.LANGUAGE_ID_en)}
+            );
+        
+        Parameter newParam = instance.addParameter();
+        
+        Parameter expResult = newParam;
+        Parameter result = null;
+        try {
+            String name = newParam.getProperty(newParam.PROPERTY_Name).getValueForLanguage(-1);
+            result = instance.getParameter(name);
+        } catch (UnknownOpenOfficeOrgLanguageIDException ex) {
+            fail(ex.getMessage());
+        }
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of addParameter method, of class org.openoffice.extensions.util.datamodel.Function.
+     */
+    public void testAddParameter() {
+        System.out.println("addParameter");
+        
+        Function instance = new Function("functionName", "int", 
+            m_objectHelper.getAddinNbNodeObject(), 
+            new Integer[]{new Integer(LanguageDefinition.LANGUAGE_ID_en)}
+            );
+        
+        Parameter result = instance.addParameter();
+        assertNotNull(result);  // tested in getParameter
+    }
+
+    /**
+     * Test of removeParameter method, of class org.openoffice.extensions.util.datamodel.Function.
+     */
+    public void testRemoveParameter() {
+        System.out.println("removeParameter");
+        
+        Function instance = new Function("functionName", "int", 
+            m_objectHelper.getAddinNbNodeObject(), 
+            new Integer[]{new Integer(LanguageDefinition.LANGUAGE_ID_en)}
+            );
+        
+        Parameter newParam1 = instance.addParameter();
+        Parameter newParam2 = instance.addParameter();
+        
+        Parameter expResult = null;
+        Parameter result = null;
+        try {
+            expResult = newParam1;
+            String name = expResult.getProperty(expResult.PROPERTY_Name).getValueForLanguage(-1);
+            result = instance.getParameter(name);
+            assertEquals(expResult, result);
+
+            instance.removeParameter(name);
+            assertNull(instance.getParameter(name));
+            
+            expResult = newParam2;
+            name = expResult.getProperty(expResult.PROPERTY_Name).getValueForLanguage(-1);
+            result = instance.getParameter(name);
+            assertEquals(expResult, result);
+            
+            instance.removeParameter(name);
+            assertNull(instance.getParameter(name));
+            
+        } catch (UnknownOpenOfficeOrgLanguageIDException ex) {
+            fail(ex.getMessage());
+        }
+        
+    }
+
+    /**
+     * Test of getAllSetObjectNames method, of class org.openoffice.extensions.util.datamodel.Function.
+     */
+    public void testGetAllSetObjectNames() {
+        System.out.println("getAllSetObjectNames");
+        
+        Function instance = new Function("functionName", "int", 
+            m_objectHelper.getAddinNbNodeObject(), 
+            new Integer[]{new Integer(LanguageDefinition.LANGUAGE_ID_en)}
+            );
+        
+        instance.addParameter();
+        instance.addParameter();
+        
+        String[] expResult = new String[]{"parameter0", "parameter1"};
+        String[] result = instance.getAllSetObjectNames();
+        assertEquals(expResult.length, result.length);
+        for (int i = 0; i < expResult.length; i++) {
+            assertEquals(expResult[i], result[i]);
+        }
+        
+    }
+
+    /**
+     * Test of getSetObject method, of class org.openoffice.extensions.util.datamodel.Function.
+     */
+    public void testGetSetObject() {
+        System.out.println("getSetObject");
+        
+        String internalName = "parameter0";
+        Function instance = new Function("functionName", "int", 
+            m_objectHelper.getAddinNbNodeObject(), 
+            new Integer[]{new Integer(LanguageDefinition.LANGUAGE_ID_en)}
+            );
+
+        Parameter expResult = instance.addParameter();
+        
+        Object result = instance.getSetObject(internalName);
+        assertTrue(result instanceof Parameter);
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of addSetObject method, of class org.openoffice.extensions.util.datamodel.Function.
+     */
+    public void testAddSetObject() {
+        System.out.println("addSetObject");
+        
+        String internalName = "bumblebee";
+        Function instance = new Function("functionName", "int", 
+            m_objectHelper.getAddinNbNodeObject(), 
+            new Integer[]{new Integer(LanguageDefinition.LANGUAGE_ID_en)}
+            );
+
+        Object setObject = new Parameter("a name", "int", instance, 
+            new Integer[]{new Integer(LanguageDefinition.LANGUAGE_ID_en)});
+        
+        instance.addSetObject(internalName, setObject);
+        
+        Object result = instance.getSetObject(internalName);
+        assertTrue(result instanceof Parameter);
+        assertEquals(setObject, result);
+    }
+
+    /**
+     * Test of getDisplayName method, of class org.openoffice.extensions.util.datamodel.Function.
+     */
+    public void testGetDisplayName() {
+        System.out.println("getDisplayName");
+        
+        Function instance = new Function("functionName", "int", 
+            m_objectHelper.getMockNbNodeObject(), 
+            new Integer[]{new Integer(LanguageDefinition.LANGUAGE_ID_en)}
+            );
+        
+        String expResult = "int functionName();";
+        String result = instance.getDisplayName();
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of getAllSubObjects method, of class org.openoffice.extensions.util.datamodel.Function.
+     */
+    public void testGetAllSubObjects() {
+        System.out.println("getAllSubObjects");
+        
+        Function instance = new Function("functionName", "int", 
+            m_objectHelper.getMockNbNodeObject(), 
+            new Integer[]{new Integer(LanguageDefinition.LANGUAGE_ID_en)}
+            );
+        
+        int expResult = 3;
+        NbNodeObject[] result = instance.getAllSubObjects();
+        assertEquals(expResult, result.length);
+        
+    }
+
+    /**
+     * Test of createProperties method, of class org.openoffice.extensions.util.datamodel.Function.
+     */
+    public void testCreateProperties() {
+        System.out.println("createProperties");
+        
+        Function instance = new Function("functionName", "int", 
+            m_objectHelper.getMockNbNodeObject(), 
+            new Integer[]{new Integer(LanguageDefinition.LANGUAGE_ID_en)}
+            );
+        
+        int expResult = 3;
+        Node.Property[] result = instance.createProperties(null, null);
+        assertEquals(expResult, result.length);
+    }
+
+    /**
+     * Test of hasActions method, of class org.openoffice.extensions.util.datamodel.Function.
+     */
+    public void testHasActions() {
+        System.out.println("hasActions");
+        
+        int type = 0;
+        Function instance = new Function("functionName", "int", 
+            m_objectHelper.getMockNbNodeObject(), 
+            new Integer[]{new Integer(LanguageDefinition.LANGUAGE_ID_en)}
+            );
+        
+        boolean expResult = false;
+        boolean result = instance.hasActions(type);
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of getActions method, of class org.openoffice.extensions.util.datamodel.Function.
+     */
+    public void testGetActions() {
+        System.out.println("getActions");
+        
+        boolean b = true;
+        Function instance = new Function("functionName", "int", 
+            m_objectHelper.getMockNbNodeObject(), 
+            new Integer[]{new Integer(LanguageDefinition.LANGUAGE_ID_en)}
+            );
+
+        instance.setActions(m_objectHelper.getMyLanguageAction());
+        assertTrue(instance.hasActions(0));
+        
+//        Action[] expResult = null;
+        Action[] result = instance.getActions(b);
+        assertNull(result);  // wrong parent type for actions
+    }
+
+    /**
+     * Test of setActions method, of class org.openoffice.extensions.util.datamodel.Function.
+     */
+    public void testSetActions() {
+        System.out.println("setActions");
+        
+        Function instance = new Function("functionName", "int", 
+            m_objectHelper.getMockNbNodeObject(), 
+            new Integer[]{new Integer(LanguageDefinition.LANGUAGE_ID_en)}
+            );
+
+        instance.setActions(m_objectHelper.getMyLanguageAction());
+        assertTrue(instance.hasActions(0));
+    }
+
+    /**
+     * Test of getParent method, of class org.openoffice.extensions.util.datamodel.Function.
+     */
+    public void testGetParent() {
+        System.out.println("getParent");
+        
+        NbNodeObject parent = m_objectHelper.getMockNbNodeObject();
+        Function instance = new Function("functionName", "int", 
+            parent, 
+            new Integer[]{new Integer(LanguageDefinition.LANGUAGE_ID_en)}
+            );
+
+        
+        NbNodeObject expResult = parent;
+        NbNodeObject result = instance.getParent();
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of getType method, of class org.openoffice.extensions.util.datamodel.Function.
+     */
+    public void testGetType() {
+        System.out.println("getType");
+        
+        Function instance = new Function("functionName", "int", 
+            m_objectHelper.getMockNbNodeObject(), 
+            new Integer[]{new Integer(LanguageDefinition.LANGUAGE_ID_en)}
+            );
+        
+        int expResult = NbNodeObject.FUNCTION_TYPE;
+        int result = instance.getType();
+        assertEquals(expResult, result);
+    }
+    
+}

Added: incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/IdlEnumTest.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/IdlEnumTest.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/IdlEnumTest.java (added)
+++ incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/IdlEnumTest.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,200 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile: IdlEnumTest.java,v $
+ *
+ *  $Revision: 1.1 $
+ *
+ *  last change: $Author: sg $ $Date: 2007/09/04 15:06:45 $
+ *
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
+ *
+ *    This library 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
+ *    Lesser General Public License for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.util.datamodel;
+
+import junit.framework.*;
+import java.beans.PropertyChangeListener;
+import javax.swing.Action;
+import org.openide.nodes.Node;
+import org.openide.nodes.Sheet;
+import org.openide.util.NbBundle;
+import org.openoffice.extensions.projecttemplates.calcaddin.AddinWizardIterator;
+import org.openoffice.extensions.util.LogWriter;
+import org.openoffice.extensions.util.datamodel.actions.BaseAction;
+import org.openoffice.extensions.util.datamodel.properties.ObjectHelperImplementations;
+import org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgProperty;
+import org.openoffice.extensions.util.datamodel.properties.SimpleOpenOfficeOrgProperty;
+import org.openoffice.extensions.util.datamodel.properties.UnknownOpenOfficeOrgLanguageIDException;
+
+/**
+ *
+ * @author sg128468
+ */
+public class IdlEnumTest extends TestCase {
+
+    private ObjectHelperImplementations m_objectHelper;
+    
+    public IdlEnumTest(String testName) {
+        super(testName);
+    }
+
+    protected void setUp() throws Exception {
+        m_objectHelper = new ObjectHelperImplementations();
+    }
+
+    protected void tearDown() throws Exception {
+        m_objectHelper = null;
+    }
+
+    public static Test suite() {
+        TestSuite suite = new TestSuite(IdlEnumTest.class);
+        
+        return suite;
+    }
+
+    /**
+     * Test of getDisplayName method, of class org.openoffice.extensions.util.datamodel.IdlEnum.
+     */
+    public void testGetDisplayName() {
+        System.out.println("getDisplayName");
+        
+        IdlEnum instance = new IdlEnum("name", m_objectHelper.getMockNbNodeObject());
+        
+        String expResult = "name";
+        String result = instance.getDisplayName();
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of getProperty method, of class org.openoffice.extensions.util.datamodel.IdlEnum.
+     */
+    public void testGetProperty() {
+        System.out.println("getProperty");
+        
+        int propertyIndex = 0;
+        IdlEnum instance = new IdlEnum("name", m_objectHelper.getMockNbNodeObject());
+        
+        String expResult = "name";
+        OpenOfficeOrgProperty result = instance.getProperty(propertyIndex);
+        try {
+            assertEquals(expResult, result.getValueForLanguage(-1));
+        } catch (UnknownOpenOfficeOrgLanguageIDException ex) {
+            fail(ex.getMessage());
+        }
+    }
+
+    /**
+     * Test of getAllSubObjects method, of class org.openoffice.extensions.util.datamodel.IdlEnum.
+     */
+    public void testGetAllSubObjects() {
+        System.out.println("getAllSubObjects");
+        
+        IdlEnum instance = new IdlEnum("name", m_objectHelper.getMockNbNodeObject());
+        
+        String expResult = "name";
+        NbNodeObject[] result = instance.getAllSubObjects();
+        assertEquals(1, result.length);
+        assertEquals(expResult, ((SimpleOpenOfficeOrgProperty)result[0]).getValueForLanguage(-1));
+    }
+
+    /**
+     * Test of createProperties method, of class org.openoffice.extensions.util.datamodel.IdlEnum.
+     */
+    public void testCreateProperties() {
+        System.out.println("createProperties");
+        
+        IdlEnum instance = new IdlEnum("name", m_objectHelper.getMockNbNodeObject());
+        
+        Node.Property[] result = instance.createProperties(null, null);
+        assertEquals(1, result.length);
+    }
+
+    /**
+     * Test of setActions method, of class org.openoffice.extensions.util.datamodel.IdlEnum.
+     */
+    public void testSetActions() {
+        System.out.println("setActions");
+        
+        BaseAction baseAction = null;
+        IdlEnum instance = new IdlEnum("name", m_objectHelper.getMockNbNodeObject());
+        
+        instance.setActions(baseAction);
+    }
+
+    /**
+     * Test of getActions method, of class org.openoffice.extensions.util.datamodel.IdlEnum.
+     */
+    public void testGetActions() {
+        System.out.println("getActions");
+        
+        boolean b = true;
+        IdlEnum instance = new IdlEnum("name", m_objectHelper.getMockNbNodeObject());
+        
+        Action[] result = instance.getActions(b);
+        assertNull(result);
+    }
+
+    /**
+     * Test of hasActions method, of class org.openoffice.extensions.util.datamodel.IdlEnum.
+     */
+    public void testHasActions() {
+        System.out.println("hasActions");
+        
+        int type = 0;
+        IdlEnum instance = new IdlEnum("name", m_objectHelper.getMockNbNodeObject());
+        
+        boolean expResult = false;
+        boolean result = instance.hasActions(type);
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of getParent method, of class org.openoffice.extensions.util.datamodel.IdlEnum.
+     */
+    public void testGetParent() {
+        System.out.println("getParent");
+        
+        NbNodeObject expResult = m_objectHelper.getMockNbNodeObject();
+        IdlEnum instance = new IdlEnum("name", expResult);
+        
+        NbNodeObject result = instance.getParent();
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of getType method, of class org.openoffice.extensions.util.datamodel.IdlEnum.
+     */
+    public void testGetType() {
+        System.out.println("getType");
+        
+        IdlEnum instance = new IdlEnum("name", m_objectHelper.getMockNbNodeObject());
+        
+        int expResult = NbNodeObject.ENUM_TYPE;
+        int result = instance.getType();
+        assertEquals(expResult, result);
+    }
+    
+}

Added: incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/IdlEnumerationTest.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/IdlEnumerationTest.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/IdlEnumerationTest.java (added)
+++ incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/IdlEnumerationTest.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,327 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile: IdlEnumerationTest.java,v $
+ *
+ *  $Revision: 1.1 $
+ *
+ *  last change: $Author: sg $ $Date: 2007/09/04 15:06:45 $
+ *
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
+ *
+ *    This library 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
+ *    Lesser General Public License for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.util.datamodel;
+
+import junit.framework.*;
+import java.beans.PropertyChangeListener;
+import java.util.Enumeration;
+import java.util.Vector;
+import javax.swing.Action;
+import org.openide.nodes.Node;
+import org.openide.nodes.Sheet;
+import org.openide.util.NbBundle;
+import org.openoffice.extensions.projecttemplates.calcaddin.AddinWizardIterator;
+import org.openoffice.extensions.util.LogWriter;
+import org.openoffice.extensions.util.datamodel.actions.BaseAction;
+import org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgProperty;
+import org.openoffice.extensions.util.datamodel.properties.SimpleOpenOfficeOrgProperty;
+import org.openoffice.extensions.util.datamodel.properties.UnknownOpenOfficeOrgLanguageIDException;
+import org.openoffice.extensions.util.datamodel.properties.UnknownOpenOfficeOrgPropertyException;
+
+/**
+ *
+ * @author sg128468
+ */
+public class IdlEnumerationTest extends TestCase {
+    
+    public IdlEnumerationTest(String testName) {
+        super(testName);
+    }
+
+    protected void setUp() throws Exception {
+    }
+
+    protected void tearDown() throws Exception {
+    }
+
+    public static Test suite() {
+        TestSuite suite = new TestSuite(IdlEnumerationTest.class);
+        
+        return suite;
+    }
+
+    /**
+     * Test of getEnum method, of class org.openoffice.extensions.util.datamodel.IdlEnumeration.
+     */
+    public void testGetEnum() {
+        System.out.println("getEnum");
+        
+        IdlEnumeration instance = new IdlEnumeration("name", "a.package");
+        
+        IdlEnum expResult = instance.addEnum();
+        assertNotNull(expResult);
+        String name = null;
+        try {
+            name = expResult.getSimpleProperty(expResult.PROPERTY_CONTAINER_NAME);
+        } catch (UnknownOpenOfficeOrgPropertyException ex) {
+            fail(ex.getMessage());
+        }
+        IdlEnum result = instance.getEnum(name);
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of addEnum method, of class org.openoffice.extensions.util.datamodel.IdlEnumeration.
+     */
+    public void testAddEnum() {
+        System.out.println("addEnum");
+        
+        IdlEnumeration instance = new IdlEnumeration("name", "a.package");
+        
+        IdlEnum result = instance.addEnum();
+        assertNotNull(result);
+    }
+
+    /**
+     * Test of removeEnum method, of class org.openoffice.extensions.util.datamodel.IdlEnumeration.
+     */
+    public void testRemoveEnum() {
+        System.out.println("removeEnum");
+        
+        IdlEnumeration instance = new IdlEnumeration("name", "a.package");
+        
+        IdlEnum expResult = instance.addEnum();
+        assertNotNull(expResult);
+        String name = null;
+        try {
+            name = expResult.getSimpleProperty(expResult.PROPERTY_CONTAINER_NAME);
+        } catch (UnknownOpenOfficeOrgPropertyException ex) {
+            fail(ex.getMessage());
+        }
+        IdlEnum result = instance.getEnum(name);
+        assertEquals(expResult, result);
+
+        instance.removeEnum(name);
+        
+        result = instance.getEnum(name);
+        assertNull(result);
+    }
+
+    /**
+     * Test of getAllSetObjectNames method, of class org.openoffice.extensions.util.datamodel.IdlEnumeration.
+     */
+    public void testGetAllSetObjectNames() {
+        System.out.println("getAllSetObjectNames");
+        
+        IdlEnumeration instance = new IdlEnumeration("name", "a.package");
+        
+        IdlEnum aResult1 = instance.addEnum();
+        IdlEnum aResult2 = instance.addEnum();
+        assertNotNull(aResult1);
+        assertNotNull(aResult2);
+        String name1 = null;
+        String name2 = null;
+        try {
+            name1 = aResult1.getSimpleProperty(aResult1.PROPERTY_CONTAINER_NAME);
+            name2 = aResult2.getSimpleProperty(aResult2.PROPERTY_CONTAINER_NAME);
+        } catch (UnknownOpenOfficeOrgPropertyException ex) {
+            fail(ex.getMessage());
+        }
+        
+        String[] expResult = new String[]{name1, name2};
+        String[] result = instance.getAllSetObjectNames();
+        assertEquals(expResult.length, result.length);
+        for (int i = 0; i < expResult.length; i++) {
+            assertEquals(expResult[i], result[i]); // maybe not the same order?
+        }
+    }
+
+    /**
+     * Test of getSetObject method, of class org.openoffice.extensions.util.datamodel.IdlEnumeration.
+     */
+    public void testGetSetObject() {
+        System.out.println("getSetObject");
+        
+        IdlEnumeration instance = new IdlEnumeration("name", "a.package");
+        
+        IdlEnum expResult = instance.addEnum();
+        assertNotNull(expResult);
+
+        String[] names = instance.getAllSetObjectNames();
+        assertEquals(1, names.length);
+        
+        IdlEnum result = (IdlEnum) instance.getSetObject(names[0]);
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of addSetObject method, of class org.openoffice.extensions.util.datamodel.IdlEnumeration.
+     */
+    public void testAddSetObject() {
+        System.out.println("addSetObject");
+        
+        String internalName = "internalName";
+        IdlEnumeration instance = new IdlEnumeration("name", "a.package");
+        IdlEnum expResult = new IdlEnum("name", instance);
+        
+        instance.addSetObject(internalName, expResult);
+        
+        IdlEnum result = (IdlEnum) instance.getSetObject(internalName);
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of getDisplayName method, of class org.openoffice.extensions.util.datamodel.IdlEnumeration.
+     */
+    public void testGetDisplayName() {
+        System.out.println("getDisplayName");
+        
+        IdlEnumeration instance = new IdlEnumeration("name", "a.package");
+        
+        String expResult = "a.package.name";
+        String result = instance.getDisplayName();
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of getAllSubObjects method, of class org.openoffice.extensions.util.datamodel.IdlEnumeration.
+     */
+    public void testGetAllSubObjects() {
+        System.out.println("getAllSubObjects");
+        
+        IdlEnumeration instance = new IdlEnumeration("name", "a.package");
+        
+        IdlEnum aResult1 = instance.addEnum();
+        IdlEnum aResult2 = instance.addEnum();
+        assertNotNull(aResult1);
+        assertNotNull(aResult2);
+        
+        NbNodeObject[] expResult = new NbNodeObject[]{aResult1, aResult2};
+        NbNodeObject[] result = instance.getAllSubObjects();
+        assertEquals(4, result.length);
+        boolean firstFound = false;
+        boolean secondFound = false;
+        for (int i = 0; i < result.length; i++) {
+            if (result[i].equals(expResult [0])) firstFound = true;
+            if (result[i].equals(expResult [1])) secondFound = true;
+        }
+        assertTrue(firstFound && secondFound);
+    }
+
+    /**
+     * Test of getProperty method, of class org.openoffice.extensions.util.datamodel.IdlEnumeration.
+     */
+    public void testGetProperty() {
+        System.out.println("getProperty");
+        
+        int propertyIndex = 0;
+        IdlEnumeration instance = new IdlEnumeration("name", "a.package");
+        
+        String expResult = "name";
+        OpenOfficeOrgProperty result = instance.getProperty(propertyIndex);
+        try {
+            assertEquals(expResult, result.getValueForLanguage(-1));
+        } catch (UnknownOpenOfficeOrgLanguageIDException ex) {
+            fail(ex.getMessage());
+        }
+    }
+
+    /**
+     * Test of createProperties method, of class org.openoffice.extensions.util.datamodel.IdlEnumeration.
+     */
+    public void testCreateProperties() {
+        System.out.println("createProperties");
+        
+        IdlEnumeration instance = new IdlEnumeration("name", "a.package");
+        
+        Node.Property[] result = instance.createProperties(null, null);
+        assertEquals(2, result.length);
+    }
+
+    /**
+     * Test of hasActions method, of class org.openoffice.extensions.util.datamodel.IdlEnumeration.
+     */
+    public void testHasActions() {
+        System.out.println("hasActions");
+        
+        int type = 0;
+        IdlEnumeration instance = new IdlEnumeration("name", "a.package");
+        
+        boolean expResult = false;
+        boolean result = instance.hasActions(type);
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of getActions method, of class org.openoffice.extensions.util.datamodel.IdlEnumeration.
+     */
+    public void testGetActions() {
+        System.out.println("getActions");
+        
+        boolean b = true;
+        IdlEnumeration instance = new IdlEnumeration("name", "a.package");
+        
+        Action[] result = instance.getActions(b);
+        assertNull(result);
+    }
+
+    /**
+     * Test of setActions method, of class org.openoffice.extensions.util.datamodel.IdlEnumeration.
+     */
+    public void testSetActions() {
+        System.out.println("setActions");
+        
+        IdlEnumeration instance = new IdlEnumeration("name", "a.package");
+        
+        instance.setActions(null); // empty implementation
+    }
+
+    /**
+     * Test of getParent method, of class org.openoffice.extensions.util.datamodel.IdlEnumeration.
+     */
+    public void testGetParent() {
+        System.out.println("getParent");
+        
+        IdlEnumeration instance = new IdlEnumeration("name", "a.package");
+        
+        NbNodeObject result = instance.getParent();
+        assertNull(result);  // not implemented: class is top in chain
+    }
+
+    /**
+     * Test of getType method, of class org.openoffice.extensions.util.datamodel.IdlEnumeration.
+     */
+    public void testGetType() {
+        System.out.println("getType");
+        
+        IdlEnumeration instance = new IdlEnumeration("name", "a.package");
+        
+        int expResult = NbNodeObject.ENUMERATION_TYPE;
+        int result = instance.getType();
+        assertEquals(expResult, result);
+    }
+    
+}

Added: incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/InterfaceTest.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/InterfaceTest.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/InterfaceTest.java (added)
+++ incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/InterfaceTest.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,360 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile: InterfaceTest.java,v $
+ *
+ *  $Revision: 1.1 $
+ *
+ *  last change: $Author: sg $ $Date: 2007/09/04 15:06:45 $
+ *
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
+ *
+ *    This library 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
+ *    Lesser General Public License for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.util.datamodel;
+
+import junit.framework.*;
+import java.beans.PropertyChangeListener;
+import javax.swing.Action;
+import org.openide.nodes.Node;
+import org.openide.nodes.Sheet;
+import org.openoffice.extensions.util.datamodel.actions.BaseAction;
+import org.openoffice.extensions.util.datamodel.localization.LanguageDefinition;
+import org.openoffice.extensions.util.datamodel.properties.ObjectHelperImplementations;
+import org.openoffice.extensions.util.datamodel.properties.UnknownOpenOfficeOrgLanguageIDException;
+import org.openoffice.extensions.util.datamodel.properties.UnknownOpenOfficeOrgPropertyException;
+
+/**
+ *
+ * @author sg128468
+ */
+public class InterfaceTest extends TestCase {
+
+    private ObjectHelperImplementations m_objectHelper;
+    
+    public InterfaceTest(String testName) {
+        super(testName);
+    }
+
+    protected void setUp() throws Exception {
+        m_objectHelper = new ObjectHelperImplementations();
+    }
+
+    protected void tearDown() throws Exception {
+        m_objectHelper = null;
+    }
+
+    public static Test suite() {
+        TestSuite suite = new TestSuite(InterfaceTest.class);
+        
+        return suite;
+    }
+
+    /**
+     * Test of addAggregatedInterface method, of class org.openoffice.extensions.util.datamodel.Interface.
+     */
+    public void testAddAggregatedInterface() {
+        System.out.println("addAggregatedInterface");
+        
+        Interface ifc = new Interface("XAggregatedTestInterface", "a.package");
+        Interface instance = new Interface("XTestInterface", "a.package");
+        
+        instance.addAggregatedInterface(ifc);
+    }
+
+    /**
+     * Test of getAllAggregatedInterfaces method, of class org.openoffice.extensions.util.datamodel.Interface.
+     */
+    public void testGetAllAggregatedInterfaces() {
+        System.out.println("getAllAggregatedInterfaces");
+        
+        Interface ifc = new Interface("XAggregatedTestInterface", "a.package");
+        Interface instance = new Interface("XTestInterface", "a.package");
+        
+        instance.addAggregatedInterface(ifc);
+        
+        Interface[] expResult = new Interface[]{ifc};
+        Interface[] result = instance.getAllAggregatedInterfaces();
+        assertEquals(1, result.length);
+        for (int i = 0; i < expResult.length; i++) {
+            assertEquals(expResult[i], result[i]);
+        }
+    }
+
+    /**
+     * Test of removeAggregatedInterface method, of class org.openoffice.extensions.util.datamodel.Interface.
+     */
+    public void testRemoveAggregatedInterface() {
+        System.out.println("removeAggregatedInterface");
+        
+        String name = "XAggregatedTestInterface";
+        Interface ifc = new Interface("XAggregatedTestInterface", "a.package");
+        Interface instance = new Interface("XTestInterface", "a.package");
+        
+        instance.addAggregatedInterface(ifc);
+        
+        Interface[] results = instance.getAllAggregatedInterfaces();
+        assertEquals(1, results.length);
+        
+        Interface expResult = ifc;
+        Interface result = instance.removeAggregatedInterface(name);
+        assertEquals(expResult, result);
+        
+        results = instance.getAllAggregatedInterfaces();
+        assertEquals(0, results.length);
+    }
+
+    /**
+     * Test of addFunction method, of class org.openoffice.extensions.util.datamodel.Interface.
+     */
+    public void testAddFunction() {
+        System.out.println("addFunction");
+        
+        Interface instance = new Interface("XTestInterface", "a.package");
+        
+        Function result = instance.addFunction();
+        assertNotNull(result);
+    }
+
+    /**
+     * Test of removeFunction method, of class org.openoffice.extensions.util.datamodel.Interface.
+     */
+    public void testRemoveFunction() {
+        System.out.println("removeFunction");
+        
+        Interface instance = new Interface("XTestInterface", "a.package");
+        
+        Function function = instance.addFunction();
+        
+        instance.removeFunction(function);
+    }
+
+    /**
+     * Test of setType method, of class org.openoffice.extensions.util.datamodel.Interface.
+     */
+    public void testSetType() {
+        System.out.println("setType");
+        
+        int type = NbNodeObject.OFFICE_INTERFACE_TYPE;
+        Interface instance = new Interface("XTestInterface", "a.package");
+
+        instance.setType(type);
+        int result = instance.getType();
+        assertEquals(type, result);
+
+        instance.addAggregatedInterface(new Interface("XAggregated", "a.package"));
+        result = instance.getType();
+        assertEquals(NbNodeObject.MULTI_INHERITANCE_INTERFACE_TYPE, result);
+    }
+
+    /**
+     * Test of getType method, of class org.openoffice.extensions.util.datamodel.Interface.
+     */
+    public void testGetType() {
+        System.out.println("getType");
+        
+        Interface instance = new Interface("XTestInterface", "a.package");
+        
+        int expResult = NbNodeObject.INTERFACE_TYPE;
+        int result = instance.getType();
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of getAllSetObjectNames method, of class org.openoffice.extensions.util.datamodel.Interface.
+     */
+    public void testGetAllSetObjectNames() {
+        System.out.println("getAllSetObjectNames");
+        
+        Interface instance = new Interface("XTestInterface", "a.package");
+        instance.addFunction();
+        instance.addFunction();
+        
+        String[] expResult = new String[]{"function0", "function1"};
+        String[] result = instance.getAllSetObjectNames();
+        assertEquals(2, result.length);
+        for (int i = 0; i < expResult.length; i++) {
+            assertEquals(expResult[i], result[i]);
+        }
+    }
+
+    /**
+     * Test of getSetObject method, of class org.openoffice.extensions.util.datamodel.Interface.
+     */
+    public void testGetSetObject() {
+        System.out.println("getSetObject");
+        
+        String internalName = "function1";
+        Interface instance = new Interface("XTestInterface", "a.package");
+        Function f0 = instance.addFunction();
+        Function f1 = instance.addFunction();
+        
+        Object expResult = f1;
+        Object result = instance.getSetObject(internalName);
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of addSetObject method, of class org.openoffice.extensions.util.datamodel.Interface.
+     */
+    public void testAddSetObject() {
+        System.out.println("addSetObject");
+        
+        String internalName = "dideldum";
+        Interface instance = new Interface("XTestInterface", "a.package");
+        Function setObject = new Function("dideldum", "int", instance, null);
+        Function f0 = instance.addFunction();
+        Function f1 = instance.addFunction();
+        
+        instance.addSetObject(internalName, setObject);
+        
+        Function expResult = setObject;
+        Function result = (Function)instance.getSetObject(internalName);
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of addLanguage method, of class org.openoffice.extensions.util.datamodel.Interface.
+     */
+    public void testAddLanguage() {
+        System.out.println("addLanguage");
+        
+        int languageID = LanguageDefinition.LANGUAGE_ID_de;
+        String defaultText = "default text";
+        Interface instance = new Interface("XTestInterface", "a.package");
+
+        Function f0 = instance.addFunction();
+        instance.addLanguage(languageID, defaultText);  // not really supported on interfaces
+    }
+
+    /**
+     * Test of removeLanguage method, of class org.openoffice.extensions.util.datamodel.Interface.
+     */
+    public void testRemoveLanguage() {
+        System.out.println("removeLanguage");
+        
+        int languageID = LanguageDefinition.LANGUAGE_ID_de;
+        String defaultText = "default text";
+        Interface instance = new Interface("XTestInterface", "a.package");
+
+        Function f0 = instance.addFunction();
+        instance.addLanguage(languageID, defaultText);
+        instance.removeLanguage(LanguageDefinition.LANGUAGE_ID_en); // not really supported on interfaces
+    }
+
+    /**
+     * Test of getParent method, of class org.openoffice.extensions.util.datamodel.Interface.
+     */
+    public void testGetParent() {
+        System.out.println("getParent");
+        
+        Interface instance = new Interface("XTestInterface", "a.package");
+        
+        NbNodeObject result = instance.getParent();
+        assertNull(result);  // top class
+    }
+
+    /**
+     * Test of getDisplayName method, of class org.openoffice.extensions.util.datamodel.Interface.
+     */
+    public void testGetDisplayName() {
+        System.out.println("getDisplayName");
+        
+        Interface instance = new Interface("XTestInterface", "a.package");
+        
+        String expResult = "a.package.XTestInterface";
+        String result = instance.getDisplayName();
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of getAllSubObjects method, of class org.openoffice.extensions.util.datamodel.Interface.
+     */
+    public void testGetAllSubObjects() {
+        System.out.println("getAllSubObjects");
+        
+        Interface instance = new Interface("XTestInterface", "a.package");
+        Function f0 = instance.addFunction();
+        
+        NbNodeObject[] result = instance.getAllSubObjects();
+        assertEquals(4, result.length);
+        boolean foundFunction = false;
+        for (int i = 0; i < result.length; i++) {
+            if (result[i].equals(f0)) foundFunction = true;
+        }
+        assertTrue(foundFunction);
+    }
+
+    /**
+     * Test of createProperties method, of class org.openoffice.extensions.util.datamodel.Interface.
+     */
+    public void testCreateProperties() {
+        System.out.println("createProperties");
+        
+        Interface instance = new Interface("XTestInterface", "a.package");
+        
+        Node.Property[] result = instance.createProperties(null, null);
+        assertEquals(3, result.length);
+    }
+
+    /**
+     * Test of hasActions method, of class org.openoffice.extensions.util.datamodel.Interface.
+     */
+    public void testHasActions() {
+        System.out.println("hasActions");
+        
+        int type = 0;
+        Interface instance = new Interface("XTestInterface", "a.package");
+        
+        boolean expResult = false;
+        boolean result = instance.hasActions(type);
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of getActions method, of class org.openoffice.extensions.util.datamodel.Interface.
+     */
+    public void testGetActions() {
+        System.out.println("getActions");
+        
+        boolean context = true;
+        Interface instance = new Interface("XTestInterface", "a.package");
+        
+        Action[] result = instance.getActions(context);
+        assertNull(result);
+    }
+
+    /**
+     * Test of setActions method, of class org.openoffice.extensions.util.datamodel.Interface.
+     */
+    public void testSetActions() {
+        System.out.println("setActions");
+        
+        Interface instance = new Interface("XTestInterface", "a.package");
+        
+        instance.setActions(null); // empty implemented
+    }
+    
+}