diff options
author | Jörg Barfurth <jb@openoffice.org> | 2001-09-28 12:32:56 +0000 |
---|---|---|
committer | Jörg Barfurth <jb@openoffice.org> | 2001-09-28 12:32:56 +0000 |
commit | 4f92b9a429a3a56e69fbc5709038eb0f28708c41 (patch) | |
tree | 0fb867510d93398b3e95e2116561c7a9a061d729 /configmgr | |
parent | ca5ada12b231b55c4bf3debaf0ad0810bf9c7ec2 (diff) |
Adjust to src641, some tests extended
Diffstat (limited to 'configmgr')
-rw-r--r-- | configmgr/workben/apitest/cfgadduser.cxx | 7 | ||||
-rw-r--r-- | configmgr/workben/apitest/cfgadmin.cxx | 10 | ||||
-rw-r--r-- | configmgr/workben/apitest/cfgapi.cxx | 181 | ||||
-rw-r--r-- | configmgr/workben/apitest/cfgapi_timetest.cxx | 16 | ||||
-rw-r--r-- | configmgr/workben/apitest/cfgupdate.cxx | 12 | ||||
-rw-r--r-- | configmgr/workben/apitest/makefile.mk | 8 |
6 files changed, 123 insertions, 111 deletions
diff --git a/configmgr/workben/apitest/cfgadduser.cxx b/configmgr/workben/apitest/cfgadduser.cxx index e13b4246007c..122963a5364d 100644 --- a/configmgr/workben/apitest/cfgadduser.cxx +++ b/configmgr/workben/apitest/cfgadduser.cxx @@ -2,9 +2,9 @@ * * $RCSfile: cfgadduser.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: fs $ $Date: 2000-10-25 06:51:47 $ + * last change: $Author: jb $ $Date: 2001-09-28 13:32:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -96,6 +96,9 @@ #include <cppuhelper/servicefactory.hxx> #endif +#include <iostream> +using std::cout; + using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; diff --git a/configmgr/workben/apitest/cfgadmin.cxx b/configmgr/workben/apitest/cfgadmin.cxx index 32761133274a..f40a5eaf6d98 100644 --- a/configmgr/workben/apitest/cfgadmin.cxx +++ b/configmgr/workben/apitest/cfgadmin.cxx @@ -2,9 +2,9 @@ * * $RCSfile: cfgadmin.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: jb $ $Date: 2001-06-20 20:55:04 $ + * last change: $Author: jb $ $Date: 2001-09-28 13:32:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -477,7 +477,7 @@ int _cdecl main( int argc, char * argv[] ) ); if (!xORB.is()) { - ::flush(cout); + cout.flush(); cerr << "Could not create the service factory !\n\n"; return 1; } @@ -493,7 +493,7 @@ int _cdecl main( int argc, char * argv[] ) if (!xCfgProvider.is()) { - ::flush(cout); + cout.flush(); cerr << "Could not create the configuration provider !\n\n"; return 3; } @@ -543,7 +543,7 @@ int _cdecl main( int argc, char * argv[] ) } catch (Exception& e) { - ::flush(cout); + cout.flush(); cerr << "Caught exception: " << e.Message << endl; return 1; } diff --git a/configmgr/workben/apitest/cfgapi.cxx b/configmgr/workben/apitest/cfgapi.cxx index 09665caa886a..a98ce4eb341d 100644 --- a/configmgr/workben/apitest/cfgapi.cxx +++ b/configmgr/workben/apitest/cfgapi.cxx @@ -2,9 +2,9 @@ * * $RCSfile: cfgapi.cxx,v $ * - * $Revision: 1.14 $ + * $Revision: 1.15 $ * - * last change: $Author: jb $ $Date: 2001-07-19 13:03:20 $ + * last change: $Author: jb $ $Date: 2001-09-28 13:32:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -74,6 +74,7 @@ using namespace std; #include <com/sun/star/container/XNameReplace.hpp> #include <com/sun/star/container/XChild.hpp> #include <com/sun/star/beans/XExactName.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> #ifndef _COM_SUN_STAR_UTIL_XCHANGESBATCH_HPP_ #include <com/sun/star/util/XChangesBatch.hpp> #endif @@ -203,25 +204,15 @@ void commit() // ----------------------------------------------------------------------------- static sal_Bool s_bInitialized = sal_False; -#ifdef LLA_PRIVAT_DEBUG -static const sal_Char* s_pSourcePath = "l:/src625/configmgr/workben/local_io/share"; -static const sal_Char* s_pUpdatePath = "l:/src625/configmgr/workben/local_io/user"; -static const sal_Char* s_pRootNode = "org.openoffice.ucb.Hierarchy"; // "org.openoffice.test"; + +static const sal_Char* s_pSourcePath = "../share"; +static const sal_Char* s_pUpdatePath = "../user"; +static const sal_Char* s_pRootNode = "org.openoffice.Office.Common"; static const sal_Char* s_pServerType = "local"; -static const sal_Char* s_pLocale = "de-DE"; -static const sal_Char* s_pServer = ""; -static const sal_Char* s_pUser = ""; -static const sal_Char* s_pPassword = ""; -#else -static const sal_Char* s_pSourcePath = "g:/src/configmgr/workben/local_io/share"; -static const sal_Char* s_pUpdatePath = "g:/src/configmgr/workben/local_io/user"; -static const sal_Char* s_pRootNode = "org.openoffice.Office.TypeDetection"; -static const sal_Char* s_pServerType = "setup"; -static const sal_Char* s_pLocale = "de-DE"; -static const sal_Char* s_pServer = "lautrec-3108:48205"; +static const sal_Char* s_pLocale = "en-US"; +static const sal_Char* s_pServer = "lautrec:48205"; static const sal_Char* s_pUser = "nobody"; static const sal_Char* s_pPassword = ""; -#endif // ----------------------------------------------------------------------------- @@ -426,7 +417,7 @@ int _cdecl main( int argc, char * argv[] ) ); if (!xORB.is()) { - ::flush(cout); + cout.flush(); cerr << "Could not create the service factory !\n\n"; return 1; } @@ -500,7 +491,7 @@ int _cdecl main( int argc, char * argv[] ) UNO_QUERY); if (!xCfgProvider.is()) { - ::flush(cout); + cout.flush(); cerr << "Could not create the configuration provider !\n\n"; return 3; } @@ -553,7 +544,7 @@ int _cdecl main( int argc, char * argv[] ) } catch (Exception& e) { - ::flush(cout); + cout.flush(); cerr << "Caught exception: " << e.Message << endl; } /* @@ -636,6 +627,7 @@ bool ask(Reference< XInterface >& xIface, Reference< XMultiServiceFactory > &xMS { cout << "\n[ Q ] -> <Quit>"; cout << "\n[ S ] -> <SetValue> "; + cout << "\n[ D ] -> <SetToDefault> "; cout << endl; cout << "\n:> " << flush; @@ -644,6 +636,7 @@ bool ask(Reference< XInterface >& xIface, Reference< XMultiServiceFactory > &xMS { bool bHandled = false; bool bInserted = false; + bool bDefaulted = false; if (cin.getline(buf,sizeof buf)) { @@ -656,31 +649,31 @@ bool ask(Reference< XInterface >& xIface, Reference< XMultiServiceFactory > &xMS { return true; } - else if((buf[0] == 0 || buf[0] == 'o' || buf[0] == 'O') && (0 == buf[1])) + else if( (buf[0] == 's' || buf[0] == 'S') && (0 == buf[1])) { -/* - cout << "work Offline" << endl; - Reference<com::sun::star::configuration::XConfigurationSync> xSync(xMSF, UNO_QUERY); - - Sequence< Any > aArgs2(5); - sal_Int32 n=0; - aArgs2[n++] <<= configmgr::createPropertyValue(ASCII("path"), ASCII("org.openoffice.Setup")); - // aArgs2[n++] <<= configmgr::createPropertyValue(ASCII("path"), ASCII("org.openoffice.Office.Common")); - // aArgs2[n++] <<= configmgr::createPropertyValue(ASCII("path"), ASCII("org.openoffice.Office.Java")); - // aArgs2[n++] <<= configmgr::createPropertyValue(ASCII("path"), ASCII("org.openoffice.Office.Writer")); - // aArgs2[n++] <<= configmgr::createPropertyValue(ASCII("path"), ASCII("org.openoffice.Office.ucb.Hierarchy")); - xSync->offline(aArgs2); - bHandled = true; -*/ + // Replace a Value + Reference< XNameReplace > xAccess(xIface, UNO_QUERY); + + if (xAccess.is()) + { + cout << "Select a Value" << endl; + bInserted = !!(cin.getline(buf,sizeof buf)); + } + else + bHandled = true; } - else if((buf[0] == 0 || buf[0] == 's' || buf[0] == 'S') && (0 == buf[1])) + else if( (buf[0] == 'd' || buf[0] == 'D') && (0 == buf[1])) { // Replace a Value - Reference< XNameAccess > xAccess(xIface, UNO_QUERY); + Reference< XPropertyState > xAccess(xIface, UNO_QUERY); - cout << "SetMode, insert a Number" << endl; - cin.getline(buf,sizeof buf); - bInserted = true; + if (xAccess.is()) + { + cout << "Select a Value" << endl; + bDefaulted = !!(cin.getline(buf,sizeof buf)); + } + else + bHandled = true; } else if ((buf[0] == 'p' || buf[0] == 'P') && (0 == buf[1])) @@ -719,9 +712,9 @@ bool ask(Reference< XInterface >& xIface, Reference< XMultiServiceFactory > &xMS } else if ('0' <= buf[0] && buf[0] <= '9' && xAccess.is()) { - unsigned int n = unsigned(atoi(buf)); + int n = (atoi(buf)); Sequence<OUString> aNames = xAccess->getElementNames(); - if (n < aNames.getLength()) + if (0 <= n && n < aNames.getLength()) aName = aNames[n]; } @@ -833,62 +826,74 @@ bool ask(Reference< XInterface >& xIface, Reference< XMultiServiceFactory > &xMS cout << "Error: ELEMENT '" << aName << "' is of unknown or unrecognized type" << endl; break; } - if (bValue) + if (bDefaulted) { - if (bInserted) + Reference< XPropertyState > xReset(xAccess, UNO_QUERY); + if (xReset.is()) { - if (aElement.getValueTypeClass() == TypeClass_BOOLEAN || - aElement.getValueTypeClass() == TypeClass_VOID) - { - cout << "Set Value (Type=BOOL) to :"; - cout.flush(); - cin.getline(buf,sizeof buf); - OUString aInput = OUString::createFromAscii(buf); - sal_Bool bValue = false; - if (aInput.equalsIgnoreAsciiCase(ASCII("true"))) - bValue = true; - - OUString aStr = ASCII("false"); - Any aValueAny; - aValueAny <<= bValue; - - Reference< XNameReplace > xNameReplace(xAccess, UNO_QUERY); - if (xNameReplace.is()) - { - xNameReplace->replaceByName(aName, aValueAny); - commit(); - } - bInserted = false; - } - else if (aElement.getValueTypeClass() == TypeClass_STRING) + xReset->setPropertyToDefault(aName); + commit(); + } + } + else if (bValue && bInserted) + { + if (aElement.getValueTypeClass() == TypeClass_BOOLEAN || + aElement.getValueTypeClass() == TypeClass_VOID) + { + cout << "Set Value (Type=BOOL) to :"; + cout.flush(); + cin.getline(buf,sizeof buf); + OUString aInput = OUString::createFromAscii(buf); + sal_Bool bValue = false; + if (aInput.equalsIgnoreAsciiCase(ASCII("true"))) + bValue = true; + + OUString aStr = ASCII("false"); + Any aValueAny; + aValueAny <<= bValue; + + Reference< XNameReplace > xNameReplace(xAccess, UNO_QUERY); + if (xNameReplace.is()) { - cout << "set value (type = string) to : "; - cout.flush(); - cin.getline(buf,sizeof buf); - Any aValue; - aValue <<= buf; - - Reference< XNameReplace > xNameReplace(xAccess, UNO_QUERY); - if (xNameReplace.is()) - { - xNameReplace->replaceByName(aName, aValue); - commit(); - } - bInserted = false; + xNameReplace->replaceByName(aName, aValueAny); + commit(); } - else + bInserted = false; + } + else if (aElement.getValueTypeClass() == TypeClass_STRING) + { + cout << "set value (type = string) to : "; + cout.flush(); + cin.getline(buf,sizeof buf); + Any aValue; + aValue <<= buf; + + Reference< XNameReplace > xNameReplace(xAccess, UNO_QUERY); + if (xNameReplace.is()) { - cout << "Sorry, only BOOLEAN Values can changed today." << endl; + xNameReplace->replaceByName(aName, aValue); + commit(); } + bInserted = false; } + else + { + cout << "Sorry, only BOOLEAN Values can changed today." << endl; + } + } + + if (bValue) + { prompt_and_wait(); return bValueOk ? true : false; } - - if (aElement >>= xNext) - cout << "Got an Interface for '" << aName << "'" << endl; else - cout << "Error: Cannot get an Interface for '" << aName << "'" << endl; + { + if (aElement >>= xNext) + cout << "Got an Interface for '" << aName << "'" << endl; + else + cout << "Error: Cannot get an Interface for '" << aName << "'" << endl; + } } else { diff --git a/configmgr/workben/apitest/cfgapi_timetest.cxx b/configmgr/workben/apitest/cfgapi_timetest.cxx index 41079b069ad6..73c2c78ec50b 100644 --- a/configmgr/workben/apitest/cfgapi_timetest.cxx +++ b/configmgr/workben/apitest/cfgapi_timetest.cxx @@ -2,9 +2,9 @@ * * $RCSfile: cfgapi_timetest.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: jb $ $Date: 2001-06-20 20:55:05 $ + * last change: $Author: jb $ $Date: 2001-09-28 13:32:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -461,7 +461,7 @@ int _cdecl main( int argc, char * argv[] ) ); if (!xORB.is()) { - ::flush(cout); + cout.flush(); cerr << "Could not create the service factory !\n\n"; return 1; } @@ -527,7 +527,7 @@ int _cdecl main( int argc, char * argv[] ) UNO_QUERY); if (!xCfgProvider.is()) { - ::flush(cout); + cout.flush(); cerr << "Could not create the configuration provider !\n\n"; return 3; } @@ -566,7 +566,7 @@ int _cdecl main( int argc, char * argv[] ) } catch (Exception& e) { - ::flush(cout); + cout.flush(); cerr << "Caught exception: " << e.Message << endl; return 1; } @@ -606,7 +606,7 @@ void ask_for_a_node_and_test_it(const Reference< XMultiServiceFactory > &xCfgPro } catch (Exception& e) { - ::flush(cout); + cout.flush(); cerr << "Caught exception: " << e.Message << endl; } } @@ -774,9 +774,9 @@ bool ask(Reference< XInterface >& xIface, const Reference< XMultiServiceFactory } else if ('0' <= buf[0] && buf[0] <= '9' && xAccess.is()) { - unsigned int n = unsigned(atoi(buf)); + int n = atoi(buf); Sequence<OUString> aNames = xAccess->getElementNames(); - if (n < aNames.getLength()) + if (0 <= n && n < aNames.getLength()) aName = aNames[n]; } diff --git a/configmgr/workben/apitest/cfgupdate.cxx b/configmgr/workben/apitest/cfgupdate.cxx index daa2d42ec8e6..06f7dcd23453 100644 --- a/configmgr/workben/apitest/cfgupdate.cxx +++ b/configmgr/workben/apitest/cfgupdate.cxx @@ -2,9 +2,9 @@ * * $RCSfile: cfgupdate.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: jb $ $Date: 2001-06-20 20:55:05 $ + * last change: $Author: jb $ $Date: 2001-09-28 13:32:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -361,7 +361,7 @@ void displayTree(Reference< XNameAccess > xIFace, sal_Int32 nLevel) cout << "<" << aNames[i] << "/>"; } - ::flush(cout); + cout.flush(); } // ----------------------------------------------------------------------------- @@ -397,7 +397,7 @@ int _cdecl main( int argc, char * argv[] ) ); if (!xORB.is()) { - ::flush(cout); + cout.flush(); cerr << "Could not create the service factory !\n\n"; return 1; } @@ -428,7 +428,7 @@ int _cdecl main( int argc, char * argv[] ) UNO_QUERY); if (!xCfgProvider.is()) { - ::flush(cout); + cout.flush(); cerr << "Could not create the configuration provider !\n\n"; return 3; } @@ -461,7 +461,7 @@ int _cdecl main( int argc, char * argv[] ) } catch (Exception& e) { - ::flush(cout); + cout.flush(); cerr << "Caught exception: " << e.Message << endl; } /* diff --git a/configmgr/workben/apitest/makefile.mk b/configmgr/workben/apitest/makefile.mk index 85c76bf34424..6936559446f4 100644 --- a/configmgr/workben/apitest/makefile.mk +++ b/configmgr/workben/apitest/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.7 $ +# $Revision: 1.8 $ # -# last change: $Author: jb $ $Date: 2001-06-20 20:55:05 $ +# last change: $Author: jb $ $Date: 2001-09-28 13:32:56 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -84,6 +84,10 @@ ENABLE_EXCEPTIONS=TRUE # --- Files -------------------------------------------------------- CDEFS += -DDLL_VERSION=\"$(UPD)$(DLLPOSTFIX)\" +.IF "$(COM)"=="MSC" +CFLAGS += -Ob0 +.ENDIF + # ... common for all test executables .............................. APPSTDLIBS=\ $(SALLIB) \ |