geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dschnei...@apache.org
Subject [01/20] incubator-geode git commit: GEODE-14: Imported modules from geode-1.0.0-SNAPSHOT-2.src.tar
Date Mon, 06 Jul 2015 21:46:22 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-14 [created] 4b56f5e45


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4b56f5e4/modules/kraken/lib/log_capture.py
----------------------------------------------------------------------
diff --git a/modules/kraken/lib/log_capture.py b/modules/kraken/lib/log_capture.py
new file mode 100644
index 0000000..9cabb09
--- /dev/null
+++ b/modules/kraken/lib/log_capture.py
@@ -0,0 +1,107 @@
+import sys
+import logging
+
+from StringIO import StringIO as sIO
+
+class LoggingStringIO(sIO):
+    """
+        Class which wraps a logger with a StringIO object. Everything written 
+        to the StringIO instance is also logged to the logger passed into the
+        constructor. The data logged is logged at new line boundaries.
+    """
+
+    def __init__(self, log, level=logging.DEBUG):
+        sIO.__init__(self)
+        self.log = log
+        self.level = level
+        self.buffer = ''
+
+    def write(self, stuff):
+        sIO.write(self, stuff)
+        self.buffer += stuff
+        self.log_buffer()
+
+    def close(self):
+        sIO.close(self)
+        self.log_buffer(True)
+
+    def log_buffer(self, all=False):
+        if all:
+            self.buffer += '\n'
+        n = self.buffer.find('\n')
+        while n >= 0:
+            line = self.buffer[:n]
+            if len(line) > 0:
+                self.log.log(self.level, line)
+            self.buffer = self.buffer[n+1:]
+            n = self.buffer.find('\n')
+
+
+# This is the decorator - @log_capture.wrap
+def wrap(func):
+    def callf(*args, **kwargs):
+        orig_stdout = sys.stdout
+        orig_stderr = sys.stderr
+        sys.stdout = LoggingStringIO(logging.getLogger('stdout'))
+        sys.stderr = LoggingStringIO(logging.getLogger('stderr'))
+        r = ''
+        try:
+            r = func(*args, **kwargs)
+        finally:
+            sys.stdout.close()
+            sys.stderr.close()
+            sys.stdout = orig_stdout
+            sys.stderr = orig_stderr
+        return r
+
+    return callf
+
+
+def setup_logging():
+    # Set up logging
+    p_log = logging.getLogger('paramiko')
+    p_log.setLevel(logging.WARNING)
+
+    debug_handler = logging.FileHandler('debug.log')
+
+    formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
+    debug_handler.setFormatter(formatter)
+    debug_handler.setLevel(logging.DEBUG)
+    r_log = logging.getLogger('')
+    for h in r_log.handlers:
+        h.setLevel(logging.CRITICAL)
+    r_log.addHandler(debug_handler)
+    r_log.setLevel(logging.DEBUG)
+
+
+def dump_logging():
+    d = logging.Logger.manager.loggerDict
+    root = logging.getLogger('')
+    logging.info('... root (%s)', root.level)
+    for h in root.handlers:
+        logging.info('...   %s (%s)', h, h.level)
+    for l in d:
+        if type(d[l]) != logging.PlaceHolder:
+            logging.info('... %s (%s)', l, d[l].level)
+            for h in d[l].handlers:
+                logging.info('...   %s (%s)', h, h.level)
+        else:
+            logging.info('... %s (-)', l)
+
+
+def dump_logging_to_file():
+    f = open('logging-debug.log', 'a')
+    f.write('----------------------------------------------\n')
+    d = logging.Logger.manager.loggerDict
+    root = logging.getLogger('')
+    f.write('... root (%s)\n' % root.level)
+    for h in root.handlers:
+        f.write('...   %s (%s)\n' %(h, h.level))
+    for l in d:
+        if type(d[l]) != logging.PlaceHolder:
+            f.write('... %s (%s)\n' % (l, d[l].level))
+            for h in d[l].handlers:
+                f.write('...   %s (%s)\n' % (h, h.level))
+        else:
+            f.write('... %s (-)\n' % l)
+    f.close()
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4b56f5e4/modules/kraken/test_functions.py
----------------------------------------------------------------------
diff --git a/modules/kraken/test_functions.py b/modules/kraken/test_functions.py
new file mode 100644
index 0000000..cc814e2
--- /dev/null
+++ b/modules/kraken/test_functions.py
@@ -0,0 +1,650 @@
+import Appserver
+import time
+import os
+import os.path
+import errno
+import shutil
+import requests
+import logging
+import zipfile
+import xml.etree.ElementTree as ET
+
+from fabric.api import *
+from fabric.tasks import *
+from fabric.network import *
+from fabric.contrib.files import *
+
+# decorator implementation
+def execute_keyword(func):
+    def callf(*args, **kwargs):
+        return execute(func, *args, **kwargs)
+    return callf
+
+
+########################  Task definitions used by fabric  #########################
+
+def setup():
+    local_setup()
+    remote_setup()
+
+def local_setup():
+    # Make our local scratch dir if it doesn't already exist
+    try:
+        os.makedirs(env.scratch_dir)
+    except OSError as exc:
+        if exc.errno == errno.EEXIST and os.path.isdir(env.scratch_dir):
+            pass
+        else:
+            raise
+
+@execute_keyword
+@task
+#@parallel
+@roles('web_server')
+def remote_setup():
+    run('mkdir -p {0}'.format(env.scratch_dir))
+    run('mkdir -p {0}'.format(env.gemfire_run_dir))
+
+    # Make our local scratch dir if it doesn't already exist
+    try:
+        os.makedirs(env.scratch_dir)
+    except OSError as exc:
+        if exc.errno == errno.EEXIST and os.path.isdir(env.scratch_dir):
+            pass
+        else:
+            raise
+
+
+def cleanup():
+    remote_cleanup()
+    local_cleanup()
+
+
+def local_cleanup():
+    try:
+        shutil.rmtree(env.scratch_dir)
+    except OSError as exc:
+        raise
+
+
+@execute_keyword
+@task
+#@parallel
+@roles('web_server')
+def remote_cleanup():
+    run('rm -rf {0}'.format(env.scratch_dir))
+
+
+@execute_keyword
+@task
+#@parallel
+@roles('web_server')
+def deploy_test_artifact(svr, artifact):
+    f = put(artifact, '/tmp')
+    svr.deploy_test_artifact(f[0])
+
+
+@execute_keyword
+@task
+#@parallel
+@roles('web_server')
+def cleanup_test_artifact(svr):
+    svr.cleanup_test_artifact()
+
+
+@execute_keyword
+@task
+#@parallel
+@roles('web_server')
+def create_instance(svr, template=None, force=False):
+    with cd(svr.home_dir):
+        if force or not exists(svr.instance_name):
+            svr.create_instance(env.gemfire_home, template)
+
+
+@execute_keyword
+@task
+@roles('web_server')
+def destroy_instance(svr):
+    svr.destroy_instance()
+
+
+@execute_keyword
+@task
+@roles('web_server')
+def cleanup_templates(svr):
+    svr.cleanup_templates()
+
+
+@execute_keyword
+@task
+@roles('web_server')
+def customize_instance(svr, flavor, webapp_jar_mode=None):
+    svr.customize_instance(env.resources, flavor, webapp_jar_mode)
+
+
+@execute_keyword
+@task
+@roles('web_server')
+def customize_cache_xml(svr, flavor, region_name, template_id):
+    svr.customize_cache_xml(flavor, region_name, template_id)
+    env.region_name = region_name
+
+
+@execute_keyword
+@task
+@roles('web_server')
+def customize_cache_client_xml(svr, template_id):
+    src = 'cache-client.{0}.xml'.format(template_id)
+    dst = '{0}/conf/cache-client.xml'.format(svr.instance_name)
+
+    with cd(svr.home_dir):
+        upload_template(src, dst,
+                {'host': env.roledefs['gemfire_locator'][0], 'port': env.locator_port},
+                use_jinja=True, template_dir=env.resources)
+
+
+@execute_keyword
+@task
+@roles('web_server')
+def restore_customized_region(svr, flavor):
+    svr.restore_customized_region(flavor)
+
+
+@execute_keyword
+@task
+@roles('web_server')
+def setup_redeploy(svr, flavor):
+    svr.setup_redeploy(flavor)
+
+
+@execute_keyword
+@task
+@roles('web_server')
+def restore_redeploy(svr, flavor):
+    svr.restore_redeploy(flavor)
+
+
+@execute_keyword
+@task
+@roles('gemfire_locator')
+def start_locator(svr):
+    x = run('{0}/bin/gemfire.sh status-locator -dir={1}'.format(svr.gemfire_modules_home,
env.gemfire_run_dir))
+    if x != 'running':
+        run('{0}/bin/gemfire.sh start-locator -dir={1} -port={2}'.format(svr.gemfire_modules_home,
env.gemfire_run_dir, env.locator_port))
+    env.locator_str = '{0}[{1}]'.format(env.host, env.locator_port)
+
+
+@execute_keyword
+@task
+@roles('gemfire_locator')
+def stop_locator(svr):
+    run('{0}/bin/gemfire.sh stop-locator -dir={1} -port={2}'.format(svr.gemfire_modules_home,
env.gemfire_run_dir, env.locator_port), warn_only=True, quiet=True)
+
+
+@execute_keyword
+@task
+@roles('gemfire_server')
+def start_cacheserver(svr):
+    x = run('{0}/bin/cacheserver.sh status -dir={1}'.format(svr.gemfire_modules_home, env.gemfire_run_dir))
+    if x.find('running') < 0:
+        run('{0}/bin/cacheserver.sh start -classpath={0}/lib/{1} -dir={2} locators={3} cache-xml-file={0}/conf/cache-server.xml'.format(
+                svr.gemfire_modules_home,
+                env.json_jar_basename,
+                env.gemfire_run_dir,
+                env.locator_str))
+
+
+@execute_keyword
+@task
+@roles('gemfire_server')
+def stop_cacheserver(svr):
+    run('{0}/bin/cacheserver.sh stop -dir={1}'.format(svr.gemfire_modules_home, env.gemfire_run_dir),
warn_only=True, quiet=True)
+
+
+@execute_keyword
+@task
+@roles('web_server')
+def start_web_server(svr):
+    svr.start()
+    _test_url(svr, "/", 30)
+
+
+@execute_keyword
+@task
+@roles('web_server')
+def stop_web_server(svr):
+    svr.stop()
+
+
+@execute_keyword
+@task
+@serial
+@roles('web_server')
+def deploy_webapp(svr, w, flavor, webapp_jar_mode=None):
+    webapp = w.copy()
+    if flavor == 'gemfire-p2p':
+        add_json_function_listener(webapp)
+    svr.deploy_webapp(env.host, webapp, flavor, webapp_jar_mode)
+    _test_url(svr, webapp['url'], 30)
+
+
+@execute_keyword
+@task
+@roles('web_server')
+def undeploy_webapp(svr, webapp):
+    svr.undeploy_webapp(env.host, webapp['context'])
+
+
+@execute_keyword
+@task
+@roles('web_server')
+def test_url(svr, webapp, tries=1):
+    _test_url(svr, webapp['url'], tries)
+
+def _test_url(svr, path, tries=1):
+    url = 'http://{0}:{1}{2}'.format(env.host, svr.port, path)
+    r = None
+    for i in range(tries):
+        try:
+            r = requests.get(url)
+            if r.status_code == 200:
+                break
+        except requests.exceptions.ConnectionError, e:
+            pass
+
+        if i < tries - 1:
+            time.sleep(2)
+
+    if not r:
+        raise RuntimeError('URL {0} unable to connect'.format(url))
+
+    if r.status_code != 200:
+        raise RuntimeError('URL {0} responded with status: {1}'.format(url, r.status_code))
+    else:
+        logging.info('%s responded with status %s', url, r.status_code)
+
+
+@execute_keyword
+@task
+@roles('web_server')
+def json_contains(svr, path, content=None):
+    url = 'http://{0}:{1}{2}'.format(env.host, env.json_port, path)
+    r = requests.get(url)
+    if r.status_code != 200:
+        print r.text
+        raise RuntimeError('URL {0} responded with status: {1}'.format(url, r.status_code))
+    else:
+        if content:
+            if r.text.find(content) >= 0:
+                logging.info('%s responded with status %s', url, r.status_code)
+            else:
+                print r.text
+                raise RuntimeError('URL {0} did not contain expected content: {1}'.format(url,
content))
+
+
+@execute_keyword
+@task
+def basic_caching_1(svr, webapp):
+    # Attributes to create
+    attr_count = 10
+
+    hosts = env.roledefs['web_server']
+    url = 'http://{0}:{1}{2}'.format(hosts[0], svr.port, webapp['url'])
+
+    session_id = create_attributes(url, attr_count)
+    cookies = {'JSESSIONID' : session_id}
+
+    # Check if our session is visible in the caches
+    for h in hosts:
+        json_url = 'http://{0}:{1}/json/regions/{2}/key/{3}'.format(
+                h, env.json_port, env.region_name, session_id)
+        r = requests.get(json_url)
+        if r.status_code != 200:
+            raise RuntimeError('URL {0} responded with status: {1}'.format(json_url, r.status_code))
+        j = r.json()
+        if len(j['valueNames']) != 10:
+            print r.text
+            raise RuntimeError('URL {0} does not contain {1} attributes, only {2}'.format(json_url,
attr_count, len(j['valueNames'])))
+
+
+    # Check if we get a response from the other web servers using the same session id
+    for h in hosts[1:]:
+        url = 'http://{0}:{1}{2}'.format(h, svr.port, webapp['url'])
+        r = requests.get(url, cookies=cookies)
+        if r.status_code != 200:
+            print r.text
+            raise RuntimeError('URL {0} responded with status: {1}'.format(url, r.status_code))
+        if not r.text.find('Number of attributes in session: {0}'.format(attr_count)) >=
0:
+            print r.text
+            raise RuntimeError('URL {0} does not contain {1} attributes'.format(url, attr_count))
+
+
+@execute_keyword
+@task
+def basic_failover_1(svr, webapp):
+    # Attributes to create
+    attr_count = 10
+
+    hosts = env.roledefs['web_server']
+    url = 'http://{0}:{1}{2}'.format(hosts[0], svr.port, webapp['url'])
+
+    session_id = create_attributes(url, attr_count)
+    cookies = {'JSESSIONID' : session_id}
+
+    env.host_string = hosts[0]
+    svr.kill()
+
+    # Check if our session is visible in the caches
+    for h in hosts[1:]:
+        json_url = 'http://{0}:{1}/json/regions/{2}/key/{3}'.format(
+                h, env.json_port, env.region_name, session_id)
+        r = requests.get(json_url)
+        if r.status_code != 200:
+            raise RuntimeError('URL {0} responded with status: {1}'.format(json_url, r.status_code))
+        j = r.json()
+        if len(j['valueNames']) != 10:
+            print r.text
+            raise RuntimeError('URL {0} does not contain {1} attributes, only {2}'.format(
+                    json_url, attr_count, len(j['valueNames'])))
+
+
+    # Check if we get a response from the other web servers using the same session id
+    for h in hosts[1:]:
+        url = 'http://{0}:{1}{2}'.format(h, svr.port, webapp['url'])
+        r = requests.get(url, cookies=cookies)
+        if r.status_code != 200:
+            print r.text
+            raise RuntimeError('URL {0} responded with status: {1}'.format(url, r.status_code))
+        if not r.text.find('Number of attributes in session: {0}'.format(attr_count)) >=
0:
+            print r.text
+            raise RuntimeError('URL {0} does not contain {1} attributes'.format(url, attr_count))
+
+
+@execute_keyword
+@task
+def webapp_reload_1(svr, webapp, flavor, webapp_jar_mode=None, client_proxy=None):
+    """
+        Very basic reload test that ignores some basic issues - just testing sanity
+    """
+    # Attributes to create
+    attr_count = 10
+
+    hosts = env.roledefs['web_server']
+    url = 'http://{0}:{1}{2}'.format(hosts[0], svr.port, webapp['url'])
+
+    session_id = create_attributes(url, attr_count)
+
+    # Force a reload - this will automagically happen on all web servers
+    deploy_webapp(svr, webapp, flavor, webapp_jar_mode)
+    #svr.deploy_webapp(hosts[1], webapp['context'], webapp['war_file'])
+
+    if client_proxy:
+        # Add an attribute to the session
+        url = 'http://{0}:{1}{2}'.format(hosts[0], svr.port, webapp['url'])
+        add_attributes(url, session_id, attr_count, 1)
+        attr_count += 1
+
+    # Check if our session is visible in the caches
+    json_session_visible(hosts, session_id, attr_count)
+
+    # Check if the session is still OK
+    url = 'http://{0}:{1}{2}'.format('{0}', svr.port, webapp['url'])
+    test_str = 'Number of attributes in session: {0}'.format(attr_count)
+    http_session_visible(hosts, session_id, url, test_str)
+
+
+@execute_keyword
+@task
+def webapp_reload_2(svr, webapp, flavor, webapp_jar_mode=None):
+    """
+        More complex scenario. Here we're unloading on one server and expecting
+        the other server to still have the data.
+
+        This test is dependant on the clocks, between the servers being
+        accurate within 5 seconds of each other, otherwise results may be
+        inaccurate.
+    """
+    # Attributes to create
+    attr_count = 10
+
+    hosts = env.roledefs['web_server']
+    url = 'http://{0}:{1}{2}'.format(hosts[0], svr.port, webapp['url'])
+
+    session_id = create_attributes(url, attr_count)
+
+    # Undeploy on one server
+    svr.undeploy_webapp(hosts[0], webapp['context'])
+    logging.info('### Undeployed webapp on %s', hosts[0])
+
+    # Check if our session is visible in the other caches
+    json_session_visible(hosts[1:], session_id, attr_count)
+
+    # Check if the session is still OK
+    url = 'http://{0}:{1}{2}'.format('{0}', svr.port, webapp['url'])
+    test_str = 'Number of attributes in session: {0}'.format(attr_count)
+    http_session_visible(hosts[1:], session_id, url, test_str)
+
+    # Now sleep to cater for clock discrepancies
+    time.sleep(4)
+
+    # Add an attribute to the session
+    url = 'http://{0}:{1}{2}'.format(hosts[1], svr.port, webapp['url'])
+    add_attributes(url, session_id, attr_count, 2)
+    attr_count += 2
+
+    # Check webapp again
+    url = 'http://{0}:{1}{2}'.format('{0}', svr.port, webapp['url'])
+    test_str = 'Number of attributes in session: {0}'.format(attr_count)
+    http_session_visible(hosts[1:], session_id, url, test_str)
+
+    # Check json again
+    # If we're doing client-server then the json port is in the cache server 
+    # and not tied to the (down) webapp.
+    if flavor == 'gemfire-cs':
+        json_session_visible(hosts, session_id, attr_count)
+    else:
+        json_session_visible(hosts[1:], session_id, attr_count)
+
+    # Redeploy on first server
+    svr.deploy_webapp(hosts[0], webapp, flavor, webapp_jar_mode)
+    logging.info('### Redeployed webapp on %s', hosts[0])
+
+    # Check if our session is visible in ALL the other caches
+    json_session_visible(hosts, session_id, attr_count)
+
+    # Check if the session is still OK on ALL servers
+    url = 'http://{0}:{1}{2}'.format('{0}', svr.port, webapp['url'])
+    test_str = 'Number of attributes in session: {0}'.format(attr_count)
+    http_session_visible(hosts, session_id, url, test_str)
+
+
+@execute_keyword
+@task
+def test_non_sticky_sessions(svr, webapp):
+    attr_count = 1
+    hosts = env.roledefs['web_server']
+    url = 'http://{0}:{1}{2}'.format(hosts[0], svr.port, webapp['url'])
+    session_id = create_attributes(url, 1)
+
+    for i in range(1, 10):
+        url = 'http://{0}:{1}{2}'.format(hosts[attr_count % len(hosts)], svr.port, webapp['url'])
+        add_attributes(url, session_id, attr_count, 1)
+        attr_count += 1
+
+    # Check if our session is visible in the caches
+    json_session_visible(hosts, session_id, attr_count)
+
+    # Check if the session is still OK
+    url = 'http://{0}:{1}{2}'.format('{0}', svr.port, webapp['url'])
+    test_str = 'Number of attributes in session: {0}'.format(attr_count)
+    http_session_visible(hosts, session_id, url, test_str)
+
+
+@execute_keyword
+@task
+def test_set_max_inactive_interval(svr, webapp, interval):
+    attr_count = 1
+    hosts = env.roledefs['web_server']
+    url = 'http://{0}:{1}{2}'.format(hosts[0], svr.port, webapp['url'])
+    session_id = create_attributes(url, 3)
+
+    cookies = {'JSESSIONID' : session_id}
+
+    # set new maxInactiveInterval setting
+    payload = {
+        'showSession' : 'true',
+        'validateSessionContents' : 'true',
+        'maxInactiveInterval' : interval,
+        'command' : 'updateMaxInactiveInterval'
+    }
+
+    r = requests.post(url, data=payload, cookies=cookies)
+    if r.status_code != 200:
+        print r.text
+        raise RuntimeError('url {0} responded with status: {1}'.format(url, r.status_code))
+
+#    for h in hosts:
+#        j = get_json(h, session_id)
+#        print j
+
+    logging.info('maxInactiveInterval updated to %s', interval)
+
+    # Check if the session is still OK
+    url = 'http://{0}:{1}{2}'.format('{0}', svr.port, webapp['url'])
+    test_str = 'session max inactive interval: {0}'.format(interval)
+    http_session_visible(hosts[:1], session_id, url, test_str)
+
+#    for h in hosts:
+#        j = get_json(h, session_id)
+#        print j
+
+    http_session_visible(hosts[1:], session_id, url, test_str)
+
+#######################################################################
+###  Internal helper functions
+
+def add_json_function_listener(webapp):
+    # Copy the war file in preparation of modifying it
+    new_file = os.path.join(env.scratch_dir, os.path.basename(webapp['war_file']))
+    shutil.copyfile(webapp['war_file'], new_file)
+    webapp['war_file'] = new_file
+
+    # Using with causes the opened file to automatically be closed
+    with zipfile.ZipFile(new_file, 'a') as war:
+        # Register default namespace otherwise we get 'ns0' prepended on every element
+        ET.register_namespace('', 'http://java.sun.com/xml/ns/j2ee')
+        web_xml = ET.fromstring(war.read('WEB-INF/web.xml'))
+        listener = ET.Element('listener')
+        ET.SubElement(listener, 'listener-class').text = 'com.vmware.gemfire.rest.JsonFunction'
+        web_xml.insert(0, listener)
+        war.writestr('WEB-INF/web.xml', ET.tostring(web_xml))
+
+
+def get_json(host, session_id):
+    json_url = 'http://{0}:{1}/json/regions/{2}/key/{3}'.format(
+            host, env.json_port, env.region_name, session_id)
+    r = requests.get(json_url)
+    if r.status_code != 200:
+        print r.text
+        raise RuntimeError('URL {0} responded with status: {1}'.format(
+                json_url, r.status_code))
+    return r.json()
+
+
+def json_session_visible(hosts, session_id, attr_count=None):
+    """
+        Check if our session is visible in the caches. Throw exception if not.
+    """
+    for h in hosts:
+        j = get_json(h, session_id)
+        if attr_count and len(j['valueNames']) != attr_count:
+            logging.info(j)
+            raise RuntimeError('JSON request for session {0} on {1} does not contain {2}
attributes, only {3}'.format(
+                    session_id, h, attr_count, len(j['valueNames'])))
+        #logging.info(j)
+        logging.info('{0} creationTime {1}'.format(h, j['creationTime']))
+        logging.info('{0} lastAccessedTime {1}'.format(h, j['lastAccessedTime']))
+
+
+def http_session_visible(hosts, session_id, url, test_str=None):
+    """
+        Check if we can get a page containing a particular string.
+        The url passed in is just a template with a placeholder for the host.
+    """
+    cookies = {'JSESSIONID' : session_id}
+    for h in hosts:
+        u = url.format(h)
+        r = requests.get(u, cookies=cookies)
+        if r.status_code != 200:
+            print r.text
+            raise RuntimeError('URL {0} responded with status: {1} [{2}]'.format(
+                    u, r.status_code, session_id))
+        if test_str and not r.text.find(test_str) >= 0:
+            print r.text
+            raise RuntimeError('URL {0} with session id {1} does not contain desired test
string "{2}"'.format(
+                    u, session_id, test_str))
+
+
+
+def create_attributes(url, count):
+    """ 
+        Create a number of attributes and return the session id.
+    """
+    r = requests.get(url)
+
+    session_id = r.cookies['JSESSIONID']
+    cookies = {'JSESSIONID' : session_id}
+
+    # create new attributes in our session which should be visible on the other servers
+    for i in range(count):
+        payload = {
+            'showSession' : 'true',
+            'validateSessionContents' : 'true',
+            'attr' : 'attrName' + str(i),
+            'stringSize' : '1',
+            'mapSize' : '1',
+            'command' : 'add'
+        }
+
+        r = requests.post(url, data=payload, cookies=cookies)
+        if r.status_code != 200:
+            print r.text
+            raise RuntimeError('url {0} responded with status: {1}'.format(url, r.status_code))
+
+    logging.info('%s attributes created for session %s', count, session_id)
+    return session_id
+
+
+def add_attributes(url, session_id, start, count):
+    """ 
+        Add a number of attributes to an existing session
+    """
+    cookies = {'JSESSIONID' : session_id}
+
+    # create new attributes in our session
+    for i in range(start, start + count):
+        payload = {
+            'showSession' : 'true',
+            'validateSessionContents' : 'true',
+            'attr' : 'attrName' + str(i),
+            'stringSize' : '1',
+            'mapSize' : '1',
+            'command' : 'add'
+        }
+
+        r = requests.post(url, data=payload, cookies=cookies)
+        if r.status_code != 200:
+            print r.text
+            raise RuntimeError('url {0} responded with status: {1}'.format(url, r.status_code))
+
+    logging.info('%s attribute(s) added to existing session %s', count, session_id)
+    return session_id
+
+
+if __name__ == '__main__':
+    import global_env
+
+    env.scratch_dir = '/tmp/module-tests-{0}'.format(os.getpid())
+
+    add_json_function_listener(env.webapps['basic'])

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4b56f5e4/modules/pom.xml
----------------------------------------------------------------------
diff --git a/modules/pom.xml b/modules/pom.xml
new file mode 100644
index 0000000..b735985
--- /dev/null
+++ b/modules/pom.xml
@@ -0,0 +1,343 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>com.gemstone</groupId>
+  <artifactId>gemfire-modules-parent</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <name>gemfire-modules-parent</name>
+  <url>http://maven.apache.org</url>
+
+  <modules>
+    <module>gemfire-modules</module>
+    <module>gemfire-modules-tomcat7</module>
+    <module>gemfire-modules-session</module>
+    <module>gemfire-modules-session-external</module>
+    <module>gemfire-modules-session-integration-test</module>
+    <module>gemfire-modules-slf4j-weblogic</module>
+    <module>gemfire-modules-hibernate</module>
+    <module>gemfire-modules-assembly</module>
+  </modules>
+
+  <!--
+    Versions should be defined here. This makes script filtering possible
+    where we have explicit versions of jar referenced.
+  -->
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <gemfire.version>8.1.0</gemfire.version>
+    <gemfire.modules.version>8.1.0</gemfire.modules.version>
+    <slf4j.version>1.7.7</slf4j.version>
+    <log4j.version>2.1</log4j.version>
+    <servlet-api.version>2.5</servlet-api.version>
+    <httpunit.version>1.7.2</httpunit.version>
+    <tomcat.version>6.0.29</tomcat.version>
+    <s3-url>s3://dist.gemstone.com/maven/release</s3-url>
+  </properties>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>com.gemstone</groupId>
+        <artifactId>gemfire-modules</artifactId>
+        <version>${gemfire.modules.version}</version>
+      </dependency>
+
+      <dependency>
+        <groupId>com.gemstone</groupId>
+        <artifactId>gemfire-modules-tomcat7</artifactId>
+        <version>${gemfire.modules.version}</version>
+      </dependency>
+
+      <dependency>
+        <groupId>com.gemstone</groupId>
+        <artifactId>gemfire-modules-hibernate</artifactId>
+        <version>${gemfire.modules.version}</version>
+      </dependency>
+
+      <dependency>
+        <groupId>com.gemstone</groupId>
+        <artifactId>gemfire-modules-session</artifactId>
+        <version>${gemfire.modules.version}</version>
+      </dependency>
+
+      <dependency>
+        <groupId>com.gemstone</groupId>
+        <artifactId>gemfire-modules-session-external</artifactId>
+        <version>${gemfire.modules.version}</version>
+      </dependency>
+
+      <dependency>
+        <groupId>com.gemstone</groupId>
+        <artifactId>gemfire-modules-slf4j-weblogic</artifactId>
+        <version>${gemfire.modules.version}</version>
+      </dependency>
+
+      <dependency>
+        <groupId>junit</groupId>
+        <artifactId>junit</artifactId>
+        <version>4.10</version>
+        <scope>test</scope>
+      </dependency>
+
+      <dependency>
+        <groupId>org.apache.tomcat</groupId>
+        <artifactId>catalina</artifactId>
+        <version>${tomcat.version}</version>
+        <scope>provided</scope>
+      </dependency>
+
+      <dependency>
+        <groupId>com.gemstone.gemfire</groupId>
+        <artifactId>gemfire</artifactId>
+        <version>${gemfire.version}</version>
+        <scope>compile</scope>
+        <exclusions>
+          <exclusion>
+            <groupId>antlr</groupId>
+            <artifactId>antlr</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>commons-modeler</groupId>
+            <artifactId>commons-modeler</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.eclipse.jdt.core.compiler</groupId>
+            <artifactId>ecj</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-annotations</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-databind</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.apache.tomcat.embed</groupId>
+            <artifactId>tomcat-embed-core</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.apache.tomcat.embed</groupId>
+            <artifactId>tomcat-embed-jasper</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.apache.tomcat.embed</groupId>
+            <artifactId>tomcat-embed-logging-juli</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.fusesource.jansi</groupId>
+            <artifactId>jansi</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>net.sourceforge.jline</groupId>
+            <artifactId>jline</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.xerial.snappy</groupId>
+            <artifactId>snappy-java</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-aop</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context-support</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.springframework.data</groupId>
+            <artifactId>spring-data-gemfire</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.springframework.data</groupId>
+            <artifactId>spring-expression</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.springframework.shell</groupId>
+            <artifactId>spring-shell</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-tx</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-web</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.apache.tomcat.embed</groupId>
+            <artifactId>tomcat-embed-jasper</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.apache.tomcat.embed</groupId>
+            <artifactId>tomcat-embed-logging-juli</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>xom</groupId>
+            <artifactId>xom</artifactId>
+          </exclusion>
+        </exclusions>
+      </dependency>
+
+      <dependency>
+        <groupId>javax.servlet</groupId>
+        <artifactId>servlet-api</artifactId>
+        <version>${servlet-api.version}</version>
+        <scope>provided</scope>
+      </dependency>
+
+      <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-api</artifactId>
+        <version>${slf4j.version}</version>
+      </dependency>
+
+      <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-jdk14</artifactId>
+        <version>${slf4j.version}</version>
+        <scope>provided</scope>
+      </dependency>
+
+      <dependency>
+        <groupId>org.apache.tomcat</groupId>
+        <artifactId>coyote</artifactId>
+        <version>${tomcat.version}</version>
+        <scope>test</scope>
+      </dependency>
+
+      <dependency>
+        <groupId>org.httpunit</groupId>
+        <artifactId>httpunit</artifactId>
+        <version>${httpunit.version}</version>
+        <scope>test</scope>
+      </dependency>
+
+      <dependency>
+        <groupId>rhino</groupId>
+        <artifactId>js</artifactId>
+        <version>1.7R2</version>
+        <scope>test</scope>
+      </dependency>
+
+    </dependencies>
+  </dependencyManagement>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>2.3.1</version>
+        <configuration>
+          <source>1.6</source>
+          <target>1.6</target>
+        </configuration>
+      </plugin>
+
+      <plugin>
+        <artifactId>maven-clean-plugin</artifactId>
+        <version>2.4.1</version>
+        <configuration>
+          <filesets>
+            <fileset>
+              <directory>${java.io.tmpdir}/gemfire_modules-${user.name}
+              </directory>
+              <includes>
+                <include>**</include>
+              </includes>
+              <followSymlinks>false</followSymlinks>
+            </fileset>
+          </filesets>
+        </configuration>
+      </plugin>
+      <!--
+        Only a subset of the artifacts need to be pushed to S3 for Cloud Foundry
+        Java Buildpack consumption. Thus each relevant module needs a profile section
+        where this plugin is NOT skipped.
+      -->
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-deploy-plugin</artifactId>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+      </plugin>
+    </plugins>
+
+    <extensions>
+      <extension>
+        <groupId>org.springframework.build</groupId>
+        <artifactId>aws-maven</artifactId>
+        <version>5.0.0.RELEASE</version>
+      </extension>
+    </extensions>
+  </build>
+
+  <repositories>
+    <repository>
+      <id>gemstone-nexus</id>
+      <name>Internal Gemstone Maven Repository</name>
+      <url>http://nexus.gemstone.com:8081/nexus/content/groups/public/</url>
+      <releases>
+        <enabled>true</enabled>
+        <updatePolicy>never</updatePolicy>
+        <checksumPolicy>warn</checksumPolicy>
+      </releases>
+      <snapshots>
+        <enabled>true</enabled>
+      </snapshots>
+    </repository>
+    <repository>
+      <id>aws-gemstone-release-repo</id>
+      <name>AWS Gemstone Release Repository</name>
+      <url>http://dist.gemstone.com/maven/release</url>
+    </repository>
+  </repositories>
+
+  <!--
+    In order to deploy to S3, you need to use the 's3' profile. run maven with:
+      mvn -P s3 deploy
+  -->
+  <profiles>
+    <profile>
+      <id>default</id>
+      <distributionManagement>
+        <repository>
+          <id>gemstone-internal-release</id>
+          <name>Internal Gemstone Maven Release Repository</name>
+          <url>http://nexus.gemstone.com:8081/nexus/content/repositories/releases/</url>
+        </repository>
+        <snapshotRepository>
+          <id>gemstone-internal-snapshot</id>
+          <name>Internal Gemstone Maven Snapshot Repository</name>
+          <url>http://nexus.gemstone.com:8081/nexus/content/repositories/snapshots/</url>
+        </snapshotRepository>
+      </distributionManagement>
+    </profile>
+    <profile>
+      <id>s3</id>
+      <distributionManagement>
+        <repository>
+          <id>modules-s3-release</id>
+          <name>AWS S3 Gemstone Maven Release Repository</name>
+          <url>${s3-url}</url>
+        </repository>
+      </distributionManagement>
+    </profile>
+  </profiles>
+
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4b56f5e4/modules/settings.gradle
----------------------------------------------------------------------
diff --git a/modules/settings.gradle b/modules/settings.gradle
new file mode 100644
index 0000000..cce3424
--- /dev/null
+++ b/modules/settings.gradle
@@ -0,0 +1,10 @@
+rootProject.name = 'gemfire-modules'
+
+include 'gemfire-modules'
+include 'gemfire-modules-tomcat7'
+include 'gemfire-modules-session'
+include 'gemfire-modules-session-external'
+include 'gemfire-modules-session-integration-test'
+include 'gemfire-modules-slf4j-weblogic'
+include 'gemfire-modules-hibernate'
+include 'gemfire-modules-assembly'



Mime
View raw message