Commit 15d6994c authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

remove trailing whitespaces.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@43120 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e1fadb90
......@@ -6,15 +6,15 @@
- Removed the configurationmanager.py.
0.5
===
- Removed the possibility of infinite loop in getAvailableOO.
- Corrected the problem when the document in file system isn't
- Removed the possibility of infinite loop in getAvailableOO.
- Corrected the problem when the document in file system isn't
found(IllegalArgumentException).
- Implemented in oohandler to when not exist OOo Instance free. If don't exist,
the requisition is locked.
0.4
===
Created class to manipulate the configuration file(ConfigurationManager).
Created class to manipulate the configuration file(ConfigurationManager).
Now, all paths are taken by this object and in configuration file is possible
set the number of OOo instance that you want. The OOFactory object was implemented
to start the max number of OOo instance and get the instance available to use.
......@@ -22,7 +22,7 @@ to start the max number of OOo instance and get the instance available to use.
0.3
===
Split start.py into openoffice.py and xvfb.py. The classes openoffice and xvfb have
methods to control the process(start,stop and status about the process). Created one class
methods to control the process(start,stop and status about the process). Created one class
and one object for it, for easier reload the configuration.
0.2
......
Install Cloudooo
================
$ python2.6 setup.py install
Warnings:
- you must have installed setuptools>=0.6c11 in this python.
Install Dependencies in Mandriva
================================
$ urpmi xvfb # System Dependencies
Install OpenOffice.org
======================
Was used for testing the package's official openoffice.org. Follow these steps to install:
Download Package from the official site
---------------------------------------
x86_32
----
$ wget http://download.services.openoffice.org/files/stable/3.2.0/OOo_3.2.0_LinuxIntel_install_wJRE_en-US.tar.gz
x86_64
------
$ wget http://download.services.openoffice.org/files/stable/3.2.0/OOo_3.2.0_LinuxX86-64_install_wJRE_en-US.tar.gz
......@@ -32,12 +32,12 @@ Install OpenOffice.org
$ tar zxvf OOo_3.2.0_LinuxX86-64_install_wJRE_en-US.tar.gz
$ cd OOO320_m12_native_packed-1_en-US.9483/RPMS
$ rpm -i *.rpm # install all packages together
The instalation is in /opt
Create Configuration File
=========================
The configuration file is used to start the application using paster.
$ cp ./cloudooo/samples/samples.conf . # Copy to current folder
......@@ -52,9 +52,9 @@ Run Application
$ paster serve ./cloudooo.conf
or run as a daemon:
$ paster serve ./cloudoo.conf --daemon
Stop Application
===============
......@@ -82,7 +82,7 @@ Xvfb and OpenOffice
- configure and start Xvfb;
- Use a single Xvfb;
- the xvfb will be started with the XMLRPC Server;
- When start the Daemon(cloudooo), it configures Xvfb, next opens the openoffice(with pyuno) and start XMLRPC Server;
- When start the Daemon(cloudooo), it configures Xvfb, next opens the openoffice(with pyuno) and start XMLRPC Server;
- control Xvfb;
- start openoffice;
- Pyuno start the openoffice processes and the communication is through sockets;
......
......@@ -42,16 +42,16 @@ usage: unoconverter [options]
Options:
-h, --help this help screen
--test Test if the Openoffice works correctly
--hostname=STRING OpenOffice Instance address
--port=STRING OpenOffice Instance port
--document_url=STRING_URL
--document_url=STRING_URL
URL of document to load in OpenOffice
--office_binary_path=STRING_URL
Folder path were is the binary openoffice
--uno_path=STRING_URL
......@@ -78,7 +78,7 @@ class UnoConverter(object):
self.document_dir_path = dirname(document_url)
self.source_format = kw.get('source_format')
self.refresh = kw.get('refresh')
self._setUpUnoEnvironment(kw.get("uno_path"),
self._setUpUnoEnvironment(kw.get("uno_path"),
kw.get("office_binary_path"))
self._load()
......@@ -109,7 +109,7 @@ class UnoConverter(object):
property = PropertyValue()
property.Name = name
property.Value = value
return property
return property
def _createSpecificProperty(self, filter_name):
"""Creates a property according to the filter"""
......@@ -234,7 +234,7 @@ class UnoConverter(object):
def setMetadata(self, metadata):
"""Returns a document with new metadata.
Keyword arguments:
metadata -- expected an dictionary with metadata.
"""
......@@ -270,16 +270,16 @@ def main():
try:
opt_list, arg_list = getopt(sys.argv[1:], "h", ["help", "test",
"convert", "getmetadata", "setmetadata",
"uno_path=", "office_binary_path=",
"uno_path=", "office_binary_path=",
"hostname=", "port=", "source_format=",
"document_url=", "destination_format=",
"document_url=", "destination_format=",
"mimemapper=", "metadata=", "refresh=",
"unomimemapper_bin="])
except GetoptError, msg:
msg = msg.msg + help_msg
print >> sys.stderr, msg
sys.exit(2)
param_list = [tuple[0] for tuple in iter(opt_list)]
try:
......@@ -313,19 +313,19 @@ def main():
metadata = json.loads(arg)
elif opt == '--mimemapper':
mimemapper = json.loads(arg)
kw = {}
if "uno_path" in locals():
kw['uno_path'] = uno_path
if "office_binary_path" in locals():
kw['office_binary_path'] = office_binary_path
if 'source_format' in locals():
kw['source_format'] = source_format
if refresh:
kw['refresh'] = refresh
unoconverter = UnoConverter(hostname, port, document_url, **kw)
if "--convert" in param_list and not '--getmetadata' in param_list \
and 'destination_format' not in locals():
......@@ -344,6 +344,6 @@ def main():
output = document_url
print output
if "__main__" == __name__:
main()
......@@ -44,9 +44,9 @@ usage: unomimemapper [options]
Options:
-h, --help this help screen
--hostname=STRING OpenOffice Instance address
--port=STRING OpenOffice Instance port
--office_binary_path=STRING_URL
Folder path were is the binary openoffice
--uno_path=STRING_URL
......@@ -59,7 +59,7 @@ class UnoMimemapper(object):
def __init__(self, hostname, port, **kw):
""" Receives hostname and port from openoffice and create a service manager"""
self._setUpUnoEnvironment(kw.get("uno_path"),
self._setUpUnoEnvironment(kw.get("uno_path"),
kw.get("office_binary_path"))
self.service_manager = helper_utils.getServiceManager(hostname, port)
......@@ -128,7 +128,7 @@ def main():
msg = msg.msg + "\nUse --help or -h"
print >> sys.stderr, msg
sys.exit(2)
if not opt_list:
help()
......@@ -143,7 +143,7 @@ def main():
hostname = arg
elif opt == "--port":
port = arg
mimemapper = UnoMimemapper(hostname, port, **dict(environ))
filter_dict = mimemapper.getFilterDict()
type_dict = mimemapper.getTypeDict()
......
......@@ -108,7 +108,7 @@ class MimeMapper(object):
"--office_binary_path=%s" % office_binary_path,
"--hostname=%s" % hostname,
"--port=%s" % port]
stdout, stderr = Popen(command,
stdout=PIPE,
close_fds=True).communicate()
......
......@@ -36,7 +36,7 @@ from time import ctime, time
from base64 import encodestring
__doc__ = """
usage: python HighTestLoad.py [options]
usage: python HighTestLoad.py [options]
Options:
-h, --help this help screen
......@@ -72,14 +72,14 @@ class Log(object):
class Client(Process):
"""Represents a client that sends requests to the server. The log file by
default is created in current path, but can be created in another path.
In log are stored:
- Date and time that the client initiated the test;
- Duration of each request;
- Total time of all requets;
- Data and time that the client finished the test;
"""
def __init__(self, address, number_request, folder, **kw):
"""Client constructor
......@@ -126,7 +126,7 @@ class Client(Process):
def main():
help_msg = "\nUse --help or -h"
try:
opt_list, arg_list = getopt(sys.argv[1:], "hc:n:f:s:l:", ["help"])
......@@ -153,7 +153,7 @@ def main():
client_list = []
for num in range(number_client):
kw['log_filename'] = "client%s.log" % num
kw['log_filename'] = "client%s.log" % num
client = Client(server_address, number_request, document_folder, **kw)
client_list.append(client)
client.start()
......
......@@ -88,17 +88,17 @@ def startFakeEnvironment(start_openoffice=True, conf_path=None):
virtual_display_id,
virtual_screen='1')
xvfb.start()
waitStartDaemon(xvfb, 10)
waitStartDaemon(xvfb, 10)
if start_openoffice:
default_language = config.get('app:main',
'openoffice_user_interface_language', False,
{'openoffice_user_interface_language': 'en'})
openoffice.loadSettings(hostname,
openoffice_port,
openoffice_port,
working_path,
virtual_display_id,
office_binary_path,
office_binary_path,
uno_path,
default_language)
openoffice.start()
......@@ -110,7 +110,7 @@ def startFakeEnvironment(start_openoffice=True, conf_path=None):
mimemapper.loadFilterList(hostname, port, **kw)
openoffice.release()
return openoffice, xvfb
return xvfb
......@@ -124,7 +124,7 @@ def stopFakeEnvironment(stop_openoffice=True):
class CloudoooTestCase(unittest.TestCase):
"""Test Case to load cloudooo conf."""
def setUp(self):
"""Creates a environment to run the tests. Is called always before the
tests."""
......
......@@ -40,7 +40,7 @@ references to <a href="#server">server-side techniques needed</a>,
<a href="#moz">Mozilla</a>,
<a href="#opera">Opera</a>,
<a href="#safari">Safari</a>;
<a href="#warn">users&#8217; problems with file input</a>;
<a href="#warn">users&#8217; problems with file input</a>;
<a href="#present">appearance of the Browse button and the filename box</a>
</li><li><a href="#acc">accessibility problems: file input is a challenge to many users</a>
</li><li> <a href="#alt">suggestions for allowing
......@@ -99,7 +99,7 @@ don&#8217;t even dream about using
in this context or otherwise!
</li><li> it has the attribute
<a href="http://www.cs.tut.fi/%7Ejkorpela/forms/methods.html" title="Methods GET and POST in HTML forms&#8212;what&#8217;s the difference?">
<code>method="post"</code></a>
<code>method="post"</code></a>
</li><li> it has the attribute
<code><a href="#enctype">enctype</a>="multipart/form-data"</code>
</li><li> it contains a field
......@@ -126,7 +126,7 @@ box in current browsers is rather narrow for typical filenames.
<p><small>Minimally, the form needs to contain a
<a title="Description of INPUT TYPE=SUBMIT in WDG&#8217;s HTML 4.0 reference" href="http://www.htmlhelp.com/reference/html40/forms/input.html#submit">
a submit element</a> too. It may also contain any other fields you like,
and explanatory texts, images, etc.</small></p>
and explanatory texts, images, etc.</small></p>
<p class="warning"><a name="goofs">A common problem with file input
in forms</a> is that form data gets sent but only the <em>name</em>
......@@ -134,7 +134,7 @@ of the file is included. The reason is typically that the <code>form</code>
element does not contain the attributes mentioned above.</p>
<p>Since <a href="#support">browser support</a> to file input
is still problematic, consider
is still problematic, consider
<a href="#alt"><strong>providing alternative methods</strong></a>
of submitting data, too.</p>
......@@ -368,7 +368,7 @@ file, Opera discards the current selection and replaces it with a <em>range</em>
</li></ul>
<p>It isn&#8217;t perfect though. The Browse window is rather small, and it is
impossible to pick up several ranges, i.e. you must click on the files individually
unless you want to select just one contiguous range.
unless you want to select just one contiguous range.
And the box for file names is quite small too, and its size is not
affected by the <code>size</code> attribute.
See also <a href="#value">notes on setting the default filename</a>.
......@@ -432,7 +432,7 @@ the instructions apply to.</small></p>
<p>The technical problems discussed here are one reason why
authors should consider providing <em>alternatives</em> to file input.
There&#8217;s a section on <a href="#acc" title="File input is a challenge to many users">accessibility problems</a> below,
discussing some additional reasons.</p>
discussing some additional reasons.</p>
<h3><a name="present">The appearance of the Browse button and the filename box</a></h3>
......@@ -511,7 +511,7 @@ increase the font size and set the font to Courier. Specifically,
this happened on Netscape&nbsp;4 but not on most other browsers.
(As a side effect, on Netscape&nbsp;4, such
a font size change affected the dimensions of the Browse
button but not the font size of the the text &#8220;Browse&#8221;.
button but not the font size of the the text &#8220;Browse&#8221;.
Note that
if you included a <code>color</code> attribute there,
Netscape&nbsp; ignored it.)</small></p>
......@@ -528,7 +528,7 @@ textual content of the HTML document)
should be formatted according to the font properties of the
<code>input</code> element. (For example, IE&nbsp;4 and Mozilla seem to
apply the font-size property but not the font-family property when
rendering the button text. IE&nbsp;6 applies font-family too.</p>
rendering the button text. IE&nbsp;6 applies font-family too.</p>
<p>The following example demonstrates how your browser treats a file
input element where we suggest presentational properties both in HTML
and in CSS:</p>
......@@ -565,7 +565,7 @@ problems in file input. For an overview of what accessibility is and
why it is important, please refer to the
<cite><a href="http://web.archive.org/web/20030605114512/http://www.diffuse.org/accessibility.html">Guide to Web Accessibility and Design for All</a></cite>.</p>
<p>It has been reported that some
<p>It has been reported that some
special-purpose browsing software,
such as some versions of the
<a href="http://www.freedomscientific.com/fs_products/software_jaws.asp">JAWS</a> screen reader, have serious difficulties in file input.
......@@ -575,7 +575,7 @@ is oriented towards visual interaction.</p>
<p>Even the &#8220;normal&#8221; browsers have serious difficulties in file
input without using a mouse. (There are different reasons, including
physiological and neurological problems, why the user may need to work
without a mouse or other pointing devide.)
without a mouse or other pointing devide.)
In Internet Explorer&nbsp;6, you can select the
Browse button by tabbing, but if you try to use
the keyboard to activate it, hitting the Enter key, the browser
......@@ -587,16 +587,16 @@ the file selection dialogue.
Netscape&nbsp;7 skips over the browse button
entirely when tabbing&#8212;it cannot be selected without a mouse.</p>
<p><small>Not surprisingly, on Opera things work reasonably.
The user can
The user can
select the Browse button using the tab key and activate it
by pressing the enter key, then select a file for upload from the
file system; you would use the arrow keys move around in the file
selection.</small></p>
selection.</small></p>
<p>On the <a href="http://lynx.browser.org/">Lynx</a>
text browser, at least on Lynx&nbsp;2.8.4 on Unix,
there is no Browse button, and there is no dialogue
for accessing the computer&#8217;s
there is no Browse button, and there is no dialogue
for accessing the computer&#8217;s
file system. Thus, the user needs to know the exact path name and syntax to
type in the file name for upload, as is apparently also the case for
IE and Netscape.</p>
......@@ -625,14 +625,14 @@ should be submitted.</p>
<p>For example, the explanation could say: &#8220;Please specify, if possible,
an image
file containing your photo in JPEG format.&#8221;
Such a note may not help much when a user
encounters such a field for the first time in his life,
Such a note may not help much when a user
encounters such a field for the first time in his life,
but it helps him to associate the eventual problems with a concept
of file input and to explain his problems when seeking for help.
And if he has tried to use file input before,
it tells him to stay tuned to something special, and
perhaps at this point, before entering the file input field, to access the
file system outside the browser and find the exact path name of the file
file system outside the browser and find the exact path name of the file
he wants to submit.</p>
<h2><a name="alt">How to provide alternatives</a></h2>
......@@ -790,7 +790,7 @@ This type was originally defined in
<p><small>Browsers
may support other values too, but are not required to, and it is
generally unsafe to use them.
generally unsafe to use them.
Sometimes people use <code>enctype="text/plain"</code>,
and <code>text/plain</code> is <i>per se</i> a well-defined media type;
but there is no specification of the exact method of encoding
......@@ -865,7 +865,7 @@ must then be somehow prepared to handle zipped files.
<p>The HTML 4.01 specification
<a href="http://www.w3.org/TR/html4/interact/forms.html#h-17.4.1">describes
the <code>value</code> attribute</a>
the <code>value</code> attribute</a>
for a file input field by saying that browsers (user agents)
&#8220;may use the value of the <code>value</code>
attribute as the initial file name.&#8221; This however is
......@@ -951,7 +951,7 @@ in the <code>value</code> attribute.
</p><p>The following form contains a file input field with
<code>value="C:\.emacs"</code>. Your browser probably just ignores
that attribute, but some browsers may use it to set the initial
file name:</p>
file name:</p>
<form action="http://www.cs.tut.fi/cgi-bin/run/~jkorpela/echo.cgi" enctype="multipart/form-data" method="post">
<div><input name="datafile" value="C:\.emacs" type="file"></div>
<div><input value="Send" type="submit"></div>
......@@ -1062,7 +1062,7 @@ clicking on it, the browser puts the filename into the filename box,
and the name is a full pathname which can be quite long.
It may confuse users if they see the name badly truncated.</p>
<p><a href="http://www.w3.org/TR/REC-html32#input">Definition of
<p><a href="http://www.w3.org/TR/REC-html32#input">Definition of
<code>input type="file"</code> in the HTML 3.2 specification</a>
said:</p>
<blockquote>
......@@ -1117,7 +1117,7 @@ by ignorance, or by misclicking, or by malevolence.
See section
<cite><a href="http://cpan.uwinnipeg.ca/htdocs/CGI.pm/CGI.html#avoiding_denial_of_service_attacks">Avoiding Denial of Service Attacks</a></cite> in the
<a href="http://theoryx5.uwinnipeg.ca/CPAN/data/CGI.pm/CGI.html">documentation of CGI.pm</a>; even if it isn&#8217;t directly applicable
to you since you use other techniques than CGI and Perl, it
to you since you use other techniques than CGI and Perl, it
gives some food for thought in general.</p>
<p>The server-side form handler can be coded to do whatever the
programmer wants, and imposing <em>some</em> upper limit is clearly a must.
......@@ -1143,11 +1143,11 @@ specifications. On the contrary, the
<a href="http://www.w3.org/TR/REC-html32#input">HTML 3.2 specification says</a> something quite different:
</p><blockquote>
You can set an upper limit to the length of file names using the
<code>maxlength</code> attribute.
<code>maxlength</code> attribute.
</blockquote>
<p>Thus, it is better not to use the <code>maxlength</code> attribute,
because it currently does nothing and, worse still,
because it currently does nothing and, worse still,
in the future it might be interpreted in two incompatible ways.
The HTML&nbsp;4 specification takes no position on this: it describes
<code>maxlength</code> as defined for <code>input type="text"</code>
......@@ -1287,7 +1287,7 @@ officially, i.e. to make it explicit that work on HTML specifications
has been moved from IETF to W3C. It explicitly obsoletes RFC 1867,
together with some other HTML related RFCs. But note that there is
very little in HTML specifications by the W3C that defines
what file input really is; they refer to RFC 1867 instead.</p>
what file input really is; they refer to RFC 1867 instead.</p>
<p>RFC 1867 contains much more <strong>detailed</strong> information about
&#8220;file upload&#8221; than HTML specifications. It explains the original
......@@ -1311,5 +1311,5 @@ the free information site
by
<a href="http://www.cs.tut.fi/%7Ejkorpela/personal.html" title="Jukka K. Korpela, an IT generalist and specialist (personal home page)"><span lang="fi">Jukka</span> &#8220;Yucca&#8221; <span lang="fi">Korpela</span></a>.
</div></div>
</body></html>
\ No newline at end of file
......@@ -24,7 +24,7 @@ def wait_use_port(pid, timeout_limit=30):
def exit(msg):
sys.stderr.write(msg)
sys.exit(0)
sys.exit(0)
def run():
......@@ -50,7 +50,7 @@ def run():
python_extension = '.py'
if test_name[-3:] == python_extension:
test_name = test_name[:-3]
if not path.exists(path.join(ENVIRONMENT_PATH,
if not path.exists(path.join(ENVIRONMENT_PATH,
'%s%s' % (test_name, python_extension))):
exit("%s not exists\n" % test_name)
......
......@@ -32,7 +32,7 @@ from cloudoooTestCase import make_suite
class TestApplication(unittest.TestCase):
def setUp(self):
"""Instantiate one application object and load settings on object"""
self.application = Application()
......@@ -44,7 +44,7 @@ class TestApplication(unittest.TestCase):
self.assertEquals(self.application.port, 9999)
self.assertEquals(self.application.path_run_dir, '/tmp/')
self.assertEquals(self.application.display_id, '99')
def testStartTimeout(self):
"""Test if the attribute timeout is defined correctly"""
self.assertEquals(self.application.timeout, 20)
......
......@@ -99,7 +99,7 @@ class TestFileSystemDocument(unittest.TestCase):
self.assertEquals(self.fsdocument.getContent(), self.data)
self.fsdocument.trash()
self.assertEquals(path.exists(url), False)
def testZipDocumentList(self):
"""Tests if the zip file is returned correctly"""
open(path.join(self.fsdocument.directory_name, 'document2'), 'w').write('test')
......
......@@ -55,15 +55,15 @@ class TestMonitorInit(CloudoooTestCase):
def testMonitorLoadOnlyMonitorRequest(self):
"""Check if the monitors are started"""
monitor.load(self.load_config)
self.assertEquals(isinstance(monitor.monitor_request,
self.assertEquals(isinstance(monitor.monitor_request,
MonitorRequest),
True)
def testMonitorLoadMonitorMemory(self):
"""Check if the MemoryMemory is started"""
self.load_config['enable_memory_monitor'] = True
monitor.load(self.load_config)
self.assertEquals(isinstance(monitor.monitor_request,
self.assertEquals(isinstance(monitor.monitor_request,
MonitorRequest),
True)
self.assertEquals(isinstance(monitor.monitor_memory,
......
......@@ -39,7 +39,7 @@ OPENOFFICE = True
class TestMonitorMemory(unittest.TestCase):
"""Test case to see if the MonitorMemory is properly managing the
openoffice."""
interval = 3
def setUp(self):
......
......@@ -36,7 +36,7 @@ OPENOFFICE = True
class TestMonitorTimeout(unittest.TestCase):
"""Test all features of a monitor following the interface"""
def _createMonitor(self, interval):
"""Returns an MonitorTimeout instance"""
return MonitorTimeout(openoffice, interval)
......
......@@ -84,7 +84,7 @@ class TestOOHandler(CloudoooTestCase):
doc_exported = handler.convert("odt")
self._assert_document_output(doc_exported,
"application/vnd.oasis.opendocument.text")
def testGetMetadata(self):
"""Test getMetadata"""
data = encodestring(open("data/test.odt").read())
......@@ -96,7 +96,7 @@ class TestOOHandler(CloudoooTestCase):
self.assertTrue(metadata.has_key('Data'))
self.assertEquals(metadata.get('MIMEType'),
'application/vnd.oasis.opendocument.text')
handler.document.restoreOriginal()
handler.document.restoreOriginal()
metadata = handler.getMetadata(True)
self.assertNotEquals(metadata.get('Data'), '')
......@@ -132,7 +132,7 @@ class TestOOHandler(CloudoooTestCase):
doc_exported = handler.convert("odt")
self._assert_document_output(doc_exported,
"application/vnd.oasis.opendocument.text")
def testGetMetadataWithOpenOfficeStopped(self):
"""Test getMetadata with openoffice stopped"""
openoffice.stop()
......@@ -144,7 +144,7 @@ class TestOOHandler(CloudoooTestCase):
self.assertEquals(metadata.get('Title'), 'title')
self.assertEquals(metadata.get('MIMEType'),
'application/vnd.oasis.opendocument.text')
def testSetMetadataWithOpenOfficeStopped(self):
"""Test setMetadata with openoffice stopped"""
openoffice.stop()
......
......@@ -35,7 +35,7 @@ OPENOFFICE = True
class TestOpenOffice(CloudoooTestCase):
"""Test OpenOffice object and manipulation of OOo Instance"""
def afterSetUp(self):
"""Instantiate one OpenOffice"""
self.openoffice = OpenOffice()
......
......@@ -39,33 +39,33 @@ DAEMON = True
class TestServer(CloudoooTestCase):
"""Test XmlRpc Server. Needs cloudooo server started"""
def afterSetUp(self):
"""Creates a connection with cloudooo server"""
self.proxy = ServerProxy("http://%s:%s/RPC2" % \
(self.hostname, self.cloudooo_port), allow_none=True)
# XXX Duplicated list of filters
self.text_expected_list = [['doc', 'Microsoft Word 6.0'],
['doc', 'Microsoft Word 95'],
['doc', 'Microsoft Word 97/2000/XP'],
self.text_expected_list = [['doc', 'Microsoft Word 6.0'],
['doc', 'Microsoft Word 95'],
['doc', 'Microsoft Word 97/2000/XP'],
['docx', 'Microsoft Word 2007 XML'],
['docx', 'Office Open XML Text'],
['htm', 'HTML Document (OpenOffice.org Writer)'],
['html', 'HTML Document (OpenOffice.org Writer)'],
['html', 'XHTML'], ['odt', 'ODF Text Document'],
['ott', 'ODF Text Document Template'],
['pdf', 'PDF - Portable Document Format'],
['rtf', 'Rich Text Format'], ['sdw', 'StarWriter 3.0'],
['sdw', 'StarWriter 4.0'], ['sdw', 'StarWriter 5.0'],
['sxw', 'OpenOffice.org 1.0 Text Document'],
['htm', 'HTML Document (OpenOffice.org Writer)'],
['html', 'HTML Document (OpenOffice.org Writer)'],
['html', 'XHTML'], ['odt', 'ODF Text Document'],
['ott', 'ODF Text Document Template'],
['pdf', 'PDF - Portable Document Format'],
['rtf', 'Rich Text Format'], ['sdw', 'StarWriter 3.0'],
['sdw', 'StarWriter 4.0'], ['sdw', 'StarWriter 5.0'],
['sxw', 'OpenOffice.org 1.0 Text Document'],
['txt', 'Text'], ['txt', 'Text Encoded'],
['xhtml', 'XHTML'], ['pdb', 'AportisDoc (Palm)'],
['psw', 'Pocket Word']]
self.text_expected_list.sort()
self.presentation_expected_list = [['bmp', 'BMP - Windows Bitmap'],
self.presentation_expected_list = [['bmp', 'BMP - Windows Bitmap'],
['emf', 'EMF - Enhanced Metafile'],
['eps', 'EPS - Encapsulated PostScript'],
['gif', 'GIF - Graphics Interchange Format'],
......@@ -80,7 +80,7 @@ class TestServer(CloudoooTestCase):
['odp', 'ODF Presentation'],
['otp', 'ODF Presentation Template'],
['pbm', 'PBM - Portable Bitmap'], ['pct', 'PCT - Mac Pict'],
['pdf', 'PDF - Portable Document Format'],
['pdf', 'PDF - Portable Document Format'],
['pgm', 'PGM - Portable Graymap'], ['pict', 'PCT - Mac Pict'],
['png', 'PNG - Portable Network Graphic'],
['pot', 'Microsoft PowerPoint 97/2000/XP Template'],
......@@ -91,13 +91,13 @@ class TestServer(CloudoooTestCase):
['sda', 'StarDraw 5.0 (OpenOffice.org Impress)'],
['sdd', 'StarDraw 3.0 (OpenOffice.org Impress)'],
['sdd', 'StarImpress 4.0'], ['sdd', 'StarImpress 5.0'],
['svg', 'SVG - Scalable Vector Graphics'],
['svm', 'SVM - StarView Metafile'],
['svg', 'SVG - Scalable Vector Graphics'],
['svm', 'SVM - StarView Metafile'],
['sxd', 'OpenOffice.org 1.0 Drawing (OpenOffice.org Impress)'],
['sxi', 'OpenOffice.org 1.0 Presentation'],
['tif', 'TIFF - Tagged Image File Format'],
['tiff', 'TIFF - Tagged Image File Format'],
['wmf', 'WMF - Windows Metafile'],
['wmf', 'WMF - Windows Metafile'],
['xhtml', 'XHTML'], ['xpm', 'XPM - X PixMap']]
self.presentation_expected_list.sort()
......@@ -126,22 +126,22 @@ class TestServer(CloudoooTestCase):
text_allowed_list = self.proxy.getAllowedExtensionList(text_request)
text_allowed_list.sort()
for arg in text_allowed_list:
self.assertTrue(arg in self.text_expected_list,
self.assertTrue(arg in self.text_expected_list,
"%s not in %s" % (arg, self.text_expected_list))
request_dict = {'document_type': "presentation"}
presentation_allowed_list = self.proxy.getAllowedExtensionList(request_dict)
presentation_allowed_list.sort()
for arg in presentation_allowed_list:
self.assertTrue(arg in self.presentation_expected_list,
self.assertTrue(arg in self.presentation_expected_list,
"%s not in %s" % (arg, self.presentation_expected_list))
def testGetAllowedExtensionListByExtension(self):
def testGetAllowedExtensionListByExtension(self):
"""Call getAllowedExtensionList and verify if the returns is a list with
extension and ui_name. The request is by extension"""
doc_allowed_list = self.proxy.getAllowedExtensionList({'extension': "doc"})
doc_allowed_list.sort()
for arg in doc_allowed_list:
self.assertTrue(arg in self.text_expected_list,
self.assertTrue(arg in self.text_expected_list,
"%s not in %s" % (arg, self.text_expected_list))
def testGetAllowedExtensionListByMimetype(self):
......@@ -151,7 +151,7 @@ class TestServer(CloudoooTestCase):
msword_allowed_list = self.proxy.getAllowedExtensionList(request_dict)
msword_allowed_list.sort()
for arg in msword_allowed_list:
self.assertTrue(arg in self.text_expected_list,
self.assertTrue(arg in self.text_expected_list,
"%s not in %s" % (arg, self.text_expected_list))
def testConvertDocToOdt(self):
......@@ -172,7 +172,7 @@ class TestServer(CloudoooTestCase):
def testgetFileMetadataItemListWithoutData(self):
"""Test server using method getFileMetadataItemList. Without data
converted"""
converted"""
data = open(join('data','testMetadata.odt'),'r').read()
metadata_dict = self.proxy.getFileMetadataItemList(encodestring(data),
'odt')
......@@ -288,7 +288,7 @@ class TestServer(CloudoooTestCase):
'png',
'svg',
'image/svg+xml')
def testConvertPPTXToODP(self):
"""Test export pptx to odp"""
self._testConvertFile("data/test.pptx",
......@@ -304,7 +304,7 @@ class TestServer(CloudoooTestCase):
'docx',
'odt',
'application/vnd.oasis.opendocument.text')
def testConvertPyToPDF(self):
"""Test export python to pdf"""
self._testConvertFile("cloudoooTestCase.py",
......@@ -321,7 +321,7 @@ class TestServer(CloudoooTestCase):
res = self.proxy.getFileMetadataItemList(data, '')
self.assertEquals(res['MIMEType'], "text/plain")
res = decodestring(self.proxy.updateFileMetadata(data, '',
res = decodestring(self.proxy.updateFileMetadata(data, '',
{"Subject": "subject"}))
self.assertEquals(decodestring(res), '')
......@@ -358,7 +358,7 @@ class TestServer(CloudoooTestCase):
self.assertEquals(type(response_dict), DictType)
self.assertEquals(response_dict, {})
msg = "This document can not be loaded or is empty\n"
self.assertTrue(response_message.endswith(msg),
self.assertTrue(response_message.endswith(msg),
"%s != %s" % (response_message, msg))
def testRunGenerateMethod(self):
......@@ -404,7 +404,7 @@ class TestServer(CloudoooTestCase):
data = open(join('data', 'test_png.odp'),'r').read()
generate_result = self.proxy.run_generate('test_png.odp',
encodestring(data),
None, 'html',
None, 'html',
'application/vnd.oasis.opendocument.presentation')
response_code, response_dict, response_message = generate_result
self.assertEquals(response_code, 200)
......@@ -433,7 +433,7 @@ class TestServer(CloudoooTestCase):
data = open(join('data','test.odp'),'r').read()
generate_result = self.proxy.run_generate('test.odp',
encodestring(data),
None, 'html',
None, 'html',
'application/vnd.oasis.opendocument.presentation')
response_code, response_dict, response_message = generate_result
self.assertEquals(response_code, 200)
......@@ -467,35 +467,35 @@ class TestServer(CloudoooTestCase):
def testRunSetMetadata(self):
"""Test run_setmetadata method"""
data = open(join('data','testMetadata.odt'),'r').read()
setmetadata_result = self.proxy.run_setmetadata('testMetadata.odt',
setmetadata_result = self.proxy.run_setmetadata('testMetadata.odt',
encodestring(data),
{"Title":"testSetMetadata", "Description": "Music"})
response_code, response_dict, response_message = setmetadata_result
self.assertEquals(response_code, 200)
self.assertNotEquals(response_dict['data'], '')
getmetadata_result = self.proxy.run_getmetadata('testMetadata.odt',
getmetadata_result = self.proxy.run_getmetadata('testMetadata.odt',
response_dict['data'])
response_code, response_dict, response_message = getmetadata_result
self.assertEquals(response_code, 200)
self.assertEquals(response_dict['meta']['MIMEType'],
'application/vnd.oasis.opendocument.text')
self.assertEquals(response_dict['meta']['MIMEType'],
'application/vnd.oasis.opendocument.text')
self.assertEquals(response_dict['meta']['Description'], "Music")
setmetadata_result = self.proxy.run_setmetadata('testMetadata.odt',
setmetadata_result = self.proxy.run_setmetadata('testMetadata.odt',
encodestring(data),
{"Title":"Namie's working record",
{"Title":"Namie's working record",
"Description": "Music"})
response_code, response_dict, response_message = setmetadata_result
getmetadata_result = self.proxy.run_getmetadata('testMetadata.odt',
getmetadata_result = self.proxy.run_getmetadata('testMetadata.odt',
response_dict['data'])
response_code, response_dict, response_message = getmetadata_result
self.assertEquals(response_code, 200)
self.assertEquals(response_dict['meta']['title'],
"Namie's working record")
self.assertEquals(response_dict['meta']['title'],
"Namie's working record")
def testRunSetMetadataFailResponse(self):
"""Test run_setmetadata method with invalid document"""
data = open(join('data','testMetadata.odt'),'r').read()[:100]
setmetadata_result = self.proxy.run_setmetadata('testMetadata.odt',
setmetadata_result = self.proxy.run_setmetadata('testMetadata.odt',
encodestring(data),
{"Title":"testSetMetadata", "Description": "Music"})
response_code, response_dict, response_message = setmetadata_result
......
......@@ -56,14 +56,14 @@ class TestUnoConverter(CloudoooTestCase):
def testUnoConverterOdtToDoc(self):
"""Test script unoconverter"""
mimemapper = dict(filter_list=[('doc',
mimemapper = dict(filter_list=[('doc',
'com.sun.star.text.TextDocument',
'MS Word 97')],
doc_type_list_by_extension=dict(doc=['com.sun.star.text.TextDocument']))
mimemapper_pickled = json.dumps(mimemapper)
python = join(self.office_binary_path, "python")
command = [exists(python) and python or "python",
pkg_resources.resource_filename("cloudooo",
pkg_resources.resource_filename("cloudooo",
"handler/ooo/helper/unoconverter.py"),
"--convert",
"--uno_path=%s" % self.uno_path,
......@@ -74,7 +74,7 @@ class TestUnoConverter(CloudoooTestCase):
"--destination_format=%s" % "doc",
"--source_format=%s" % "odt",
"--mimemapper=%s" % mimemapper_pickled]
stdout, stderr = Popen(command,
stdout, stderr = Popen(command,
stdout=PIPE,
stderr=PIPE).communicate()
self.assertEquals(stderr, '')
......
......@@ -61,7 +61,7 @@ class TestUnoMimeMapper(CloudoooTestCase):
"--office_binary_path=%s" % self.office_binary_path,
"--hostname=%s" % self.hostname,
"--port=%s" % self.openoffice_port]
stdout, stderr = Popen(command,
stdout, stderr = Popen(command,
stdout=PIPE,
stderr=PIPE).communicate()
self.assertEquals(stderr, '')
......@@ -78,7 +78,7 @@ class TestUnoMimeMapper(CloudoooTestCase):
""" Test call unomimemapper without uno_path and office_binary_path"""
hostname, host = openoffice.getAddress()
command = [path.join(self.office_binary_path, "python"),
pkg_resources.resource_filename("cloudooo",
pkg_resources.resource_filename("cloudooo",
"handler/ooo/helper/unomimemapper.py"),
"--hostname=%s" % self.hostname,
"--port=%s" % self.openoffice_port]
......@@ -102,7 +102,7 @@ class TestUnoMimeMapper(CloudoooTestCase):
openoffice.stop()
python = path.join(self.office_binary_path, "python")
command = [path.exists(python) and python or "python",
pkg_resources.resource_filename("cloudooo",
pkg_resources.resource_filename("cloudooo",
"handler/ooo/helper/unomimemapper.py"),
"--uno_path=%s" % self.uno_path,
"--office_binary_path=%s" % self.office_binary_path,
......
......@@ -4,8 +4,8 @@ use = egg:cloudooo
## System config
#
debug_mode = True
# Folder where pid files, lock files and virtual frame buffer mappings
# are stored. In this folder is necessary create a folder tmp, because this
# Folder where pid files, lock files and virtual frame buffer mappings
# are stored. In this folder is necessary create a folder tmp, because this
# folder is used to create all temporary documents.
working_path = /hd/cloudooo/run
# Folder where OpenOffice Uno interpreter is installed
......@@ -15,7 +15,7 @@ office_binary_path = /opt/openoffice.org3/program
#
## Monitor Settings
#
# Limit to use the Openoffice Instance. if pass of the limit, the instance is
# Limit to use the Openoffice Instance. if pass of the limit, the instance is
# stopped and another is started.
limit_number_request = 100
# Interval to check the factory
......
......@@ -4,8 +4,8 @@ use = egg:cloudooo
## System config
#
debug_mode = True
# Folder where pid files, lock files and virtual frame buffer mappings
# are stored. In this folder is necessary create a folder tmp, because this
# Folder where pid files, lock files and virtual frame buffer mappings
# are stored. In this folder is necessary create a folder tmp, because this
# folder is used to create all temporary documents.
working_path = /hd/cloudooo/run
# Folder where OpenOffice Uno interpreter is installed
......@@ -15,7 +15,7 @@ office_binary_path = /opt/openoffice.org3/program
#
## Monitor Settings
#
# Limit to use the Openoffice Instance. if pass of the limit, the instance is
# Limit to use the Openoffice Instance. if pass of the limit, the instance is
# stopped and another is started.
limit_number_request = 100
# Interval to check the factory
......
......@@ -6,8 +6,8 @@ version = '1.2.1'
folder_path = path.abspath(path.dirname(__file__)) + "/cloudooo"
long_description = "%s\n%s" % (open(path.join(folder_path, "README.txt")).read(),
open(path.join(folder_path, "CHANGES.txt")).read())
long_description = "%s\n%s" % (open(path.join(folder_path, "README.txt")).read(),
open(path.join(folder_path, "CHANGES.txt")).read())
install_require_list = [
# -*- Extra requirements: -*-
'zope.interface',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment