def __init__(self):
        self.Health = Properties.Health()
        self.Position = Properties.Position()

        #grfx
        self.grfx = "Actor/Zombie/ozzy.jpg"  #"rsz_ozzy.jpg"
        self.width = 36
Example #2
0
    def testHdfs(self):
        # Replik8db Properties...
        Replik8dbProps = Properties("conf/replik8db.properties")
        # Replik8db HDFS Cluster...
        Replik8dbHdfsCluster = Replik8dbProps.getProperty("cluster.hdfs")

        hd = Hdfs(Replik8dbHdfsCluster)
        self.assert_(hd.fileSystem is not None)
Example #3
0
    def testHdfs(self):
        # Replik8db Properties...
        Replik8dbProps = Properties('conf/replik8db.properties')
        # Replik8db HDFS Cluster...
        Replik8dbHdfsCluster = Replik8dbProps.getProperty('cluster.hdfs')

        hd = Hdfs(Replik8dbHdfsCluster)
        self.assert_(hd.fileSystem is not None)
Example #4
0
    def setUp(self):
        # Replik8db Properties...
        Replik8dbProps = Properties('conf/replik8db.properties')
        # Replik8db HDFS Cluster...
        Replik8dbHdfsCluster = Replik8dbProps.getProperty('cluster.hdfs')

        self.logger = Logger.getLogger("TestHdfsUtil")
        # self.logger.setLevel(Level.DEBUG)

        self.hu = HdfsUtil(Replik8dbHdfsCluster)
Example #5
0
    def setUp(self):
        # Replik8db Properties...
        Replik8dbProps = Properties("conf/replik8db.properties")
        # Replik8db HDFS Cluster...
        Replik8dbHdfsCluster = Replik8dbProps.getProperty("cluster.hdfs")

        self.logger = Logger.getLogger("TestHdfsUtil")
        # self.logger.setLevel(Level.DEBUG)

        self.hu = HdfsUtil(Replik8dbHdfsCluster)
Example #6
0
 def summationyy(self, start, stop):
     dist_stringers = Properties.Properties(1).St_plcmnt()
     z_coord, y_coord = Properties.Properties(1).Centroid()
     if start == stop:
         return 0
     B_i = 0
     area_st = (self.hst + self.wst) * self.tst
     for i in dist_stringers[:7]:
         if abs(start) <= abs(i[0]) and abs(i[0]) <= abs(stop):
             B_i += area_st * (i[0] - z_coord)
     return B_i
Example #7
0
    def testHdfsSwallowFile(self):
        # Replik8db Properties...
        Replik8dbProps = Properties('conf/replik8db.properties')
        # Replik8db HDFS Cluster...
        Replik8dbHdfsCluster = Replik8dbProps.getProperty('cluster.hdfs')

        testFile = "/data/UnitTestData/chicle/07-29-2014-eventdata-999037270"
        swf = HdfsSwallowFile(Replik8dbHdfsCluster, testFile)
        # for ln in swf.lines[0:3:1]:
        #    print "--> "+ln
        # print "Line Count: [%d]" % swf.lineCount
        self.assert_(swf.lineCount == 83)
Example #8
0
    def testHdfsSwallowFile(self):
        # Replik8db Properties...
        Replik8dbProps = Properties("conf/replik8db.properties")
        # Replik8db HDFS Cluster...
        Replik8dbHdfsCluster = Replik8dbProps.getProperty("cluster.hdfs")

        testFile = "/data/UnitTestData/chicle/07-29-2014-eventdata-999037270"
        swf = HdfsSwallowFile(Replik8dbHdfsCluster, testFile)
        # for ln in swf.lines[0:3:1]:
        #    print "--> "+ln
        # print "Line Count: [%d]" % swf.lineCount
        self.assert_(swf.lineCount == 83)
Example #9
0
 def __init__(self, plane):
     self.plane = plane
     self.Izz, self.Iyy = Properties.Properties(1).MOI()
     self.z_coord, self.y_coord = Properties.Properties(1).Centroid()
     self.Ca = 0.484  # m
     self.la = 1.691  # m
     self.ha = 0.173  # m
     self.tsk = 1.1 / 1000  # m
     self.tsp = 2.5 / 1000  # m
     self.tst = 1.2 / 1000  # m
     self.hst = 14. / 1000  # m
     self.wst = 18. / 1000  # m
     self.nst = 13  # -
Example #10
0
def read_properties():
    prop = Properties()
    if env.deploy_prop_file is not None:
        if os.path.exists(env.deploy_prop_file):
            prop.load(open(env.deploy_prop_file))
            props = prop.getPropertyDict()
            keys = props.keys()
            for key in keys:
                env[key] = props[key]
        else:
            print "Could not find properties file: " + str(env.deploy_prop_file) + " Exiting..."
            sys.exit(1)
        # print env
    else:
        "env.deploy_prop_file is not set Exiting..."
        sys.exit(1)
Example #11
0
 def summation(self, start, stop):
     dist_stringers = Properties.Properties(1).St_plcmnt()
     if start < 0:
         return 0
     B_i = 0
     area_st = (self.hst + self.wst) * self.tst
     for i in dist_stringers[:7]:
         if abs(start) <= abs(i[0]) and abs(i[0]) <= abs(stop):
             B_i += area_st * i[1]
     return B_i
Example #12
0
    def BuildTube(self):
        self.tubeFilter = vtk.vtkTubeFilter()
        self.tubeFilter.SetInput(self.polyData)
        self.tubeFilter.SetRadius(0.1)
        self.Properties.append(
            Properties.FloatProperty("tube radius", self.tubeFilter.SetRadius,
                                     self.tubeFilter.GetRadius))
        self.tubeFilter.SetNumberOfSides(12)
        self.tubeFilter.CappingOn()

        map = vtk.vtkPolyDataMapper()
        map.SetInput(self.tubeFilter.GetOutput())

        self.lineActor = vtk.vtkActor()
        self.lineActor.SetMapper(map)
        self.lineActor.GetProperty().SetColor(1, .2, .2)
        self.Properties.append(
            Properties.ColorProperty("tube color",
                                     self.lineActor.GetProperty().SetColor,
                                     self.lineActor.GetProperty().GetColor))
    def load_properties(self, fn):
        self.logIt('Loading Properties %s' % fn)
        p = Properties.Properties()
        try:
            p.load(open(fn))
            properties_list = p.keys()
            for prop in properties_list:
                #                update components[] here according to the properties
                print ""
#                try:
#                    self.__dict__[prop] = p[prop]
#                except:
#                    self.logIt("Error loading property %s" % prop)
#                    prepareUpdateObject.logIt(traceback.format_exc(), True)
        except:
            self.logIt("Error loading properties", True)
            self.logIt(traceback.format_exc(), True)
Example #14
0
def get_coeff():
    p = Properties.Properties()
    p.load('dbcon.properties')
    conn = pyodbc.connect(DRIVER='{ODBC Driver 13 for SQL Server}',
                          server=p.getProperty("host"),
                          user=p.getProperty("user"),
                          password=p.getProperty("password"),
                          database=p.getProperty("database"))
    cursor = conn.cursor()
    cursor.execute(
        "SELECT avg(coeff) FROM Coefficients WHERE BATCH_ID in (select BATCH_ID from sessionMap where toUse like "
        "'Extreme1%s' and slaBW=%s and slaDel=%s and bandwidth=%s and session='%s');"
        % ('%1000%', slaBW, slaDel, bandwidth, session))
    row = str(cursor.fetchone()).strip('(, )')
    if row == "None":
        row = "1"
    print(row)
    conn.close()
    return float(re.sub("[^0-9.]", "", row))
Example #15
0
    def __init__(self):
        self.num = Properties.Properties(1)
        self.num.changevar(Ca, la, x1, x2, x3, xa, ha, tsk, tsp, tst, hst, wst,
                           nst, d1, d3, theta, P)
        self.nst = nst
        self.crosssection = Stiffness.Crosssection(nst, Ca, ha, tsk, tsp, tst,
                                                   hst, wst)
        self.crosssection.compute_bending_properties()

        self.stringers = self.crosssection.stcoord  # array containing stringer coordinates
        self.tot_area = self.crosssection.totarea  # total cross-section area
        self.y = self.crosssection.yc  # y-coordinate of the centroid
        self.z = self.crosssection.zc  # z-coordinate of the centroid
        self.Iyy_corr = self.crosssection.Iyy  # moment of inertia about y-axis
        self.Izz_corr = self.crosssection.Izz
        self.crosssection.compute_shearcenter()  # Run the calculations
        self.crosssection.compute_torsionalstiffness()

        self.ysc = self.crosssection.ysc  # y-coordinate of the centroid
        self.zsc = self.crosssection.zsc  # z-coordinate of the centroid
        self.J = self.crosssection.J
Example #16
0
def get_pipeline_metadata(clusterName, instanceId):
    p = Properties.Properties()
    p.load(open(os.path.expanduser('~/.soc/' + clusterName + '.properties')))

    dbDriverClass = p.getProperty('hibernate.connection.driver_class')
    dbUrl = p.getProperty('hibernate.connection.url')
    dbUser = p.getProperty('hibernate.connection.username')
    dbPassword = p.getProperty('hibernate.connection.password')

    mtprint(dbDriverClass, dbUrl, dbUser)

    # start JVM
    jar = os.path.expanduser('/path/to/java/jars/runtime/oracle/ojdbc6.jar')
    jpype.startJVM('/usr/java/latest/jre/lib/amd64/server/libjvm.so',
                   '-Djava.class.path=%s' % jar)

    conn = jaydebeapi.connect(dbDriverClass, dbUrl, dbUser, dbPassword)
    curs = conn.cursor()
    curs.execute(
        'SELECT ID,PI_PIPELINE_INSTANCE_ID,STATE,WORKER_HOST from PI_PIPELINE_TASK WHERE PI_PIPELINE_INSTANCE_ID='
        + instanceId)
    results = curs.fetchall()

    return results
Example #17
0
from java.text         import SimpleDateFormat
from org.apache.log4j  import Logger, Level
from org.boon.Boon     import *
from org.boon.json     import JsonFactory, JsonSerializerFactory

from threading import Thread, Lock, RLock, Condition, Semaphore, BoundedSemaphore, Event, Timer

import unittest, sys, time as pytime, Queue, socket

# To enable the python debugger...
# Add the following function to break into debugging at that point
# in the code: pdb.set_trace()
import pdb, traceback

# Chicle Properties...
ChicleProps = Properties('./conf/ElasticSearchTest.properties') 
# Testing or not testing... 
ChicleTesting = ChicleProps.getBoolProperty('esTest.testing') 
# Global list of hosts which will run the process... 
HostListCsv = ChicleProps.getBoolProperty('esTest.hosts') 
# Cluster to join...
ChicleCluster = ChicleProps.getProperty('esTest.cluster')
# Test Cluster to join...
ChicleTestCluster = ChicleProps.getProperty('esTest.test.cluster')
# Save Indexation  Failures to the BitBucket?
BitBktIndexationFailures = ChicleProps.getBoolProperty('esTest.bitbkt.indexation,failures', default = False)

''' =================================================================
    =================================================================
    TODO: 
    - Add Classes for Delete
Example #18
0
 def __init__(self, root=None, NIL=None):
     self.root = Properties.createNode(None)
     self.NIL = Properties.createNILNode()
     self.root = self.NIL
  def setUp(self):

    self.prop = Properties(defaults_str=configsample_spec)
class TestProperties(unittest.TestCase) :

  def setUp(self):

    self.prop = Properties(defaults_str=configsample_spec)

  def tearDown(self):
    OpenRTM_aist.Manager.instance().shutdownManager()
    return
  
  def test_getName(self):
    self.assertEqual(self.prop.getName(), "", "Result failed.")


  def test_getVlue(self):
    self.assertEqual(self.prop.getValue(), "", "Result failed.")
  

  def test_getDefaultValue(self):
    self.assertEqual(self.prop.getDefaultValue(), "", "Result failed.")



  def test_getLeaf(self):
    #print self.prop.getLeaf()[0].getName()
    #print self.prop.getLeaf()[0].getValue()

    self.assertEqual(self.prop.getLeaf()[0].getName(), "implementation_id", "Result failed.")
    self.assertEqual(self.prop.getLeaf()[1].getName(), "type_name", "Result failed.")
    self.assertEqual(self.prop.getLeaf()[2].getName(), "description", "Result failed.")
    self.assertEqual(self.prop.getLeaf()[3].getName(), "version", "Result failed.")
    self.assertEqual(self.prop.getLeaf()[4].getName(), "vendor", "Result failed.")
    self.assertEqual(self.prop.getLeaf()[5].getName(), "category", "Result failed.")
    self.assertEqual(self.prop.getLeaf()[6].getName(), "activity_type", "Result failed.")
    self.assertEqual(self.prop.getLeaf()[7].getName(), "max_instance", "Result failed.")
    self.assertEqual(self.prop.getLeaf()[8].getName(), "language", "Result failed.")
    self.assertEqual(self.prop.getLeaf()[9].getName(), "lang_type", "Result failed.")
    self.assertEqual(self.prop.getLeaf()[10].getLeaf()[0].getLeaf()[0].getName(), "int_param0", "Result failed.")
    self.assertEqual(self.prop.getLeaf()[10].getLeaf()[0].getLeaf()[1].getName(), "int_param1", "Result failed.")
    self.assertEqual(self.prop.getLeaf()[10].getLeaf()[0].getLeaf()[2].getName(), "double_param0", "Result failed.")
    self.assertEqual(self.prop.getLeaf()[10].getLeaf()[0].getLeaf()[3].getName(), "double_param1", "Result failed.")
    self.assertEqual(self.prop.getLeaf()[10].getLeaf()[0].getLeaf()[4].getName(), "str_param0", "Result failed.")
    self.assertEqual(self.prop.getLeaf()[10].getLeaf()[0].getLeaf()[5].getName(), "str_param1", "Result failed.")
    self.assertEqual(self.prop.getLeaf()[10].getLeaf()[0].getLeaf()[6].getName(), "vector_param0", "Result failed.")

    # Failed Patern
    # self.assertEqual(self.prop.getLeaf()[10].getName(), "conf.default.int_param0", "Result failed.")


  def test_getRoot(self):
    self.assertEqual(self.prop.getRoot(), None, "Result failed.")
    self.assertEqual(self.prop.getLeaf()[10].getRoot().getRoot(), None, "Result failed.")
    self.assertEqual(self.prop.getLeaf()[10].getLeaf()[0].getRoot().getName(), "conf", "Result failed.")
    self.assertEqual(self.prop.getLeaf()[10].getLeaf()[0].getLeaf()[0].getRoot().getName(), "default", "Result failed.")
  

  def test_getProperty(self):
    self.assertEqual(self.prop.getProperty("implementation_id"), "ConfigSample", "Result failed.")
    self.assertEqual(self.prop.getProperty("type_name"),  "ConfigSample", "Result failed.")
    self.assertEqual(self.prop.getProperty("description"), "Configuration example component","Result failed.")
    self.assertEqual(self.prop.getProperty("version"), "1.0","Result failed.")
    self.assertEqual(self.prop.getProperty("vendor"),"Shinji Kurihara, AIST", "Result failed.")
    self.assertEqual(self.prop.getProperty("category"), "example","Result failed.")
    self.assertEqual(self.prop.getProperty("activity_type"), "DataFlowComponent", "Result failed.")
    self.assertEqual(self.prop.getProperty("max_instance"), "10", "Result failed.")
    self.assertEqual(self.prop.getProperty("language"), "C++", "Result failed.")
    self.assertEqual(self.prop.getProperty("lang_type"), "compile", "Result failed.")
    self.assertEqual(self.prop.getProperty("conf.default.int_param0"), "0", "Result failed.")
    self.assertEqual(self.prop.getProperty("conf.default.int_param1"), "1", "Result failed.")
    self.assertEqual(self.prop.getProperty("conf.default.double_param0"), "0.11", "Result failed.")
    self.assertEqual(self.prop.getProperty("conf.default.double_param1"), "9.9", "Result failed.")
    self.assertEqual(self.prop.getProperty("conf.default.str_param0"), "hoge", "Result failed.")
    self.assertEqual(self.prop.getProperty("conf.default.str_param1"), "dara", "Result failed.")
    self.assertEqual(self.prop.getProperty("conf.default.vector_param0"), "0.0,1.0,2.0,3.0,4.0","Result failed.")

    # Failed Pattern
    # self.assertEqual(self.prop.getProperty("int_param0"), "0", "Result failed.")
    # self.assertEqual(self.prop.getProperty("int_param1"), "1", "Result failed.")
    # self.assertEqual(self.prop.getProperty("double_param0"), "0.11", "Result failed.")
    # self.assertEqual(self.prop.getProperty("double_param1"), "9.9", "Result failed.")
    # self.assertEqual(self.prop.getProperty("str_param0"), "hoge", "Result failed.")
    # self.assertEqual(self.prop.getProperty("str_param1"), "dara", "Result failed.")
    # self.assertEqual(self.prop.getProperty("vector_param0"), "0.0,1.0,2.0,3.0,4.0","Result failed.")

  
  def test_getDefault(self):
    self.assertEqual(self.prop.getDefault("implementation_id"), "ConfigSample", "Result failed.")
    self.assertEqual(self.prop.getDefault("type_name"),  "ConfigSample", "Result failed.")
    self.assertEqual(self.prop.getDefault("description"), "Configuration example component","Result failed.")
    self.assertEqual(self.prop.getDefault("version"), "1.0","Result failed.")
    self.assertEqual(self.prop.getDefault("vendor"),"Shinji Kurihara, AIST", "Result failed.")
    self.assertEqual(self.prop.getDefault("category"), "example","Result failed.")
    self.assertEqual(self.prop.getDefault("activity_type"), "DataFlowComponent", "Result failed.")
    self.assertEqual(self.prop.getDefault("max_instance"), "10", "Result failed.")
    self.assertEqual(self.prop.getDefault("language"), "C++", "Result failed.")
    self.assertEqual(self.prop.getDefault("lang_type"), "compile", "Result failed.")
    self.assertEqual(self.prop.getDefault("conf.default.int_param0"), "0", "Result failed.")
    self.assertEqual(self.prop.getDefault("conf.default.int_param1"), "1", "Result failed.")
    self.assertEqual(self.prop.getDefault("conf.default.double_param0"), "0.11", "Result failed.")
    self.assertEqual(self.prop.getDefault("conf.default.double_param1"), "9.9", "Result failed.")
    self.assertEqual(self.prop.getDefault("conf.default.str_param0"), "hoge", "Result failed.")
    self.assertEqual(self.prop.getDefault("conf.default.str_param1"), "dara", "Result failed.")
    self.assertEqual(self.prop.getDefault("conf.default.vector_param0"), "0.0,1.0,2.0,3.0,4.0","Result failed.")
    
  
  def test_setProperty(self):
    self.prop.setProperty("implementation_id", "ConfigSample_test")
    self.prop.setProperty("type_name",  "ConfigSample_test")
    self.prop.setProperty("description", "Configuration example component test")
    self.prop.setProperty("version", "2.0")
    self.prop.setProperty("vendor","Shinji Kurihara")
    self.prop.setProperty("category", "example_test")
    self.prop.setProperty("activity_type", "DataFlowComponent")
    self.prop.setProperty("max_instance", "1")
    self.prop.setProperty("language", "C++")
    self.prop.setProperty("lang_type", "compile")
    self.prop.setProperty("conf.default.int_param0", "111")
    self.prop.setProperty("conf.default.int_param1", "222")
    self.prop.setProperty("conf.default.double_param0", "2.22")
    self.prop.setProperty("conf.default.double_param1", "9.99")
    self.prop.setProperty("conf.default.str_param0", "hogehoge")
    self.prop.setProperty("conf.default.str_param1", "daradara")
    self.prop.setProperty("conf.default.vector_param0", "0.0,1.1,2.2,3.3,4.4")

    self.assertEqual(self.prop.getProperty("implementation_id"), "ConfigSample_test", "Result failed.")
    self.assertEqual(self.prop.getProperty("type_name"),  "ConfigSample_test", "Result failed.")
    self.assertEqual(self.prop.getProperty("description"), "Configuration example component test","Result failed.")
    self.assertEqual(self.prop.getProperty("version"), "2.0","Result failed.")
    self.assertEqual(self.prop.getProperty("vendor"),"Shinji Kurihara", "Result failed.")
    self.assertEqual(self.prop.getProperty("category"), "example_test","Result failed.")
    self.assertEqual(self.prop.getProperty("activity_type"), "DataFlowComponent", "Result failed.")
    self.assertEqual(self.prop.getProperty("max_instance"), "1", "Result failed.")
    self.assertEqual(self.prop.getProperty("language"), "C++", "Result failed.")
    self.assertEqual(self.prop.getProperty("lang_type"), "compile", "Result failed.")
    self.assertEqual(self.prop.getProperty("conf.default.int_param0"), "111", "Result failed.")
    self.assertEqual(self.prop.getProperty("conf.default.int_param1"), "222", "Result failed.")
    self.assertEqual(self.prop.getProperty("conf.default.double_param0"), "2.22", "Result failed.")
    self.assertEqual(self.prop.getProperty("conf.default.double_param1"), "9.99", "Result failed.")
    self.assertEqual(self.prop.getProperty("conf.default.str_param0"), "hogehoge", "Result failed.")
    self.assertEqual(self.prop.getProperty("conf.default.str_param1"), "daradara", "Result failed.")
    self.assertEqual(self.prop.getProperty("conf.default.vector_param0"), "0.0,1.1,2.2,3.3,4.4","Result failed.")
  

  def test_setDefault(self):
    self.prop.setDefault("implementation_id", "ConfigSample")
    self.prop.setDefault("type_name",  "ConfigSample")
    self.prop.setDefault("description", "Configuration example component")
    self.prop.setDefault("version", "1.0")
    self.prop.setDefault("vendor","Shinji Kurihara")
    self.prop.setDefault("category", "example")
    self.prop.setDefault("activity_type", "DataFlowComponent")
    self.prop.setDefault("max_instance", "10")
    self.prop.setDefault("language", "C++")
    self.prop.setDefault("lang_type", "compile")
    self.prop.setDefault("conf.default.int_param0", "0")
    self.prop.setDefault("conf.default.int_param1", "1")
    self.prop.setDefault("conf.default.double_param0", "0.11")
    self.prop.setDefault("conf.default.double_param1", "9.9")
    self.prop.setDefault("conf.default.str_param0", "hoge")
    self.prop.setDefault("conf.default.str_param1", "dara")
    self.prop.setDefault("conf.default.vector_param0", "0.0,1.0,2.0,3.0,4.0")

    self.assertEqual(self.prop.getDefault("implementation_id"), "ConfigSample", "Result failed.")
    self.assertEqual(self.prop.getDefault("type_name"),  "ConfigSample", "Result failed.")
    self.assertEqual(self.prop.getDefault("description"), "Configuration example component","Result failed.")
    self.assertEqual(self.prop.getDefault("version"), "1.0","Result failed.")
    self.assertEqual(self.prop.getDefault("vendor"),"Shinji Kurihara", "Result failed.")
    self.assertEqual(self.prop.getDefault("category"), "example","Result failed.")
    self.assertEqual(self.prop.getDefault("activity_type"), "DataFlowComponent", "Result failed.")
    self.assertEqual(self.prop.getDefault("max_instance"), "10", "Result failed.")
    self.assertEqual(self.prop.getDefault("language"), "C++", "Result failed.")
    self.assertEqual(self.prop.getDefault("lang_type"), "compile", "Result failed.")
    self.assertEqual(self.prop.getDefault("conf.default.int_param0"), "0", "Result failed.")
    self.assertEqual(self.prop.getDefault("conf.default.int_param1"), "1", "Result failed.")
    self.assertEqual(self.prop.getDefault("conf.default.double_param0"), "0.11", "Result failed.")
    self.assertEqual(self.prop.getDefault("conf.default.double_param1"), "9.9", "Result failed.")
    self.assertEqual(self.prop.getDefault("conf.default.str_param0"), "hoge", "Result failed.")
    self.assertEqual(self.prop.getDefault("conf.default.str_param1"), "dara", "Result failed.")
    self.assertEqual(self.prop.getDefault("conf.default.vector_param0"), "0.0,1.0,2.0,3.0,4.0","Result failed.")

  
  def test_setDefaults(self):
    self.prop.setDefaults(configsample_spec)
  
    self.assertEqual(self.prop.getDefault("implementation_id"), "ConfigSample", "Result failed.")
    self.assertEqual(self.prop.getDefault("type_name"),  "ConfigSample", "Result failed.")
    self.assertEqual(self.prop.getDefault("description"), "Configuration example component","Result failed.")
    self.assertEqual(self.prop.getDefault("version"), "1.0","Result failed.")
    self.assertEqual(self.prop.getDefault("vendor"),"Shinji Kurihara, AIST", "Result failed.")
    self.assertEqual(self.prop.getDefault("category"), "example","Result failed.")
    self.assertEqual(self.prop.getDefault("activity_type"), "DataFlowComponent", "Result failed.")
    self.assertEqual(self.prop.getDefault("max_instance"), "10", "Result failed.")
    self.assertEqual(self.prop.getDefault("language"), "C++", "Result failed.")
    self.assertEqual(self.prop.getDefault("lang_type"), "compile", "Result failed.")
    self.assertEqual(self.prop.getDefault("conf.default.int_param0"), "0", "Result failed.")
    self.assertEqual(self.prop.getDefault("conf.default.int_param1"), "1", "Result failed.")
    self.assertEqual(self.prop.getDefault("conf.default.double_param0"), "0.11", "Result failed.")
    self.assertEqual(self.prop.getDefault("conf.default.double_param1"), "9.9", "Result failed.")
    self.assertEqual(self.prop.getDefault("conf.default.str_param0"), "hoge", "Result failed.")
    self.assertEqual(self.prop.getDefault("conf.default.str_param1"), "dara", "Result failed.")
    self.assertEqual(self.prop.getDefault("conf.default.vector_param0"), "0.0,1.0,2.0,3.0,4.0","Result failed.")


  def test_list(self):
    #self.prop.list(sys.stdout)
    pass
  

  def test_load(self):
    fp = file("configsample.conf","r")
    self.prop.load(fp)
    self.assertEqual(self.prop.getProperty("conf.mode0.int_param0"), "12345", "Result failed.")
    self.assertEqual(self.prop.getProperty("conf.mode0.int_param1"), "98765", "Result failed.")
    self.assertEqual(self.prop.getProperty("conf.mode0.double_param0"), "3.141592653589793238462643383279")
    self.assertEqual(self.prop.getProperty("conf.mode0.double_param1"), "2.718281828459045235360287471352", "Result failed.")
    self.assertEqual(self.prop.getProperty("conf.mode0.str_param0"), "bar", "Result failed.")
    self.assertEqual(self.prop.getProperty("conf.mode0.str_param1"), "foo", "Result failed.")
    self.assertEqual(self.prop.getProperty("conf.mode0.vector_param0"), "0.0,0.1,0.2,0.3,0.4","Result failed.")


  def test_save(self):
    fp = file("test_save.data","w")
    self.prop.save(fp,"test Properties")


  def test_store(self):
    fp = file("test_store.data","w")
    self.prop.store(fp,"test Properties")

  
  def test_propertyNames(self):
    keys = self.prop.propertyNames()
    self.assertEqual(keys[0],"implementation_id", "Result failed.")
    self.assertEqual(keys[1],"type_name", "Result failed.")
    self.assertEqual(keys[2],"description","Result failed.")
    self.assertEqual(keys[3],"version","Result failed.")
    self.assertEqual(keys[4],"vendor", "Result failed.")
    self.assertEqual(keys[5],"category","Result failed.")
    self.assertEqual(keys[6],"activity_type", "Result failed.")
    self.assertEqual(keys[7],"max_instance", "Result failed.")
    self.assertEqual(keys[8],"language", "Result failed.")
    self.assertEqual(keys[9],"lang_type", "Result failed.")
    self.assertEqual(keys[10],"conf.default.int_param0", "Result failed.")
    self.assertEqual(keys[11],"conf.default.int_param1", "Result failed.")
    self.assertEqual(keys[12],"conf.default.double_param0", "Result failed.")
    self.assertEqual(keys[13],"conf.default.double_param1", "Result failed.")
    self.assertEqual(keys[14],"conf.default.str_param0", "Result failed.")
    self.assertEqual(keys[15],"conf.default.str_param1", "Result failed.")
    self.assertEqual(keys[16],"conf.default.vector_param0","Result failed.")
    

  def test_size(self):
    self.assertEqual(self.prop.size(),17,"Result failed.")
  
  
  def test_findNode(self):
    self.assertEqual(self.prop.findNode("implementation_id").getDefaultValue(), "ConfigSample", "Result failed.")
  
  def test_getNode(self):
    self.assertEqual(self.prop.getNode("implementation_id").getDefaultValue(), "ConfigSample", "Result failed.")
    self.assertEqual(self.prop.getNode("type_name").getDefaultValue(),  "ConfigSample", "Result failed.")
    self.assertEqual(self.prop.getNode("description").getDefaultValue(), "Configuration example component","Result failed.")
    self.assertEqual(self.prop.getNode("version").getDefaultValue(), "1.0","Result failed.")
    self.assertEqual(self.prop.getNode("vendor").getDefaultValue(),"Shinji Kurihara, AIST", "Result failed.")
    self.assertEqual(self.prop.getNode("category").getDefaultValue(), "example","Result failed.")
    self.assertEqual(self.prop.getNode("activity_type").getDefaultValue(), "DataFlowComponent", "Result failed.")
    self.assertEqual(self.prop.getNode("max_instance").getDefaultValue(), "10", "Result failed.")
    self.assertEqual(self.prop.getNode("language").getDefaultValue(), "C++", "Result failed.")
    self.assertEqual(self.prop.getNode("lang_type").getDefaultValue(), "compile", "Result failed.")
    self.assertEqual(self.prop.getNode("conf.default.int_param0").getDefaultValue(), "0", "Result failed.")
    self.assertEqual(self.prop.getNode("conf.default.int_param1").getDefaultValue(), "1", "Result failed.")
    self.assertEqual(self.prop.getNode("conf.default.double_param0").getDefaultValue(), "0.11", "Result failed.")
    self.assertEqual(self.prop.getNode("conf.default.double_param1").getDefaultValue(), "9.9", "Result failed.")
    self.assertEqual(self.prop.getNode("conf.default.str_param0").getDefaultValue(), "hoge", "Result failed.")
    self.assertEqual(self.prop.getNode("conf.default.str_param1").getDefaultValue(), "dara", "Result failed.")
    self.assertEqual(self.prop.getNode("conf.default.vector_param0").getDefaultValue(), "0.0,1.0,2.0,3.0,4.0","Result failed.")


  def test_createNode(self):
    self.assertEqual(self.prop.createNode("conf.default.int_param.0"),True, "Result failed.")
    self.assertEqual(self.prop.createNode("conf.add.int_param1"),True, "Result failed.")
    self.assertEqual(len(self.prop.getNode("conf.default").leaf), 8, "Result failed.")
    self.assertEqual(len(self.prop.getNode("conf.add").leaf), 1, "Result failed.")

  
  def test_removeNode(self):
    node = self.prop.getNode("conf.default")
    node.removeNode("int_param0")
    self.assertEqual( len(self.prop.getNode("conf.default").leaf),6, "Result failed.")
  
    node = self.prop.getNode("conf")
    node.removeNode("default")
    self.assertEqual( len(self.prop.getNode("conf").leaf),0, "Result failed.")


  def test_hasKey(self):
    node = self.prop.getNode("conf")
    self.assertEqual(len(node.hasKey("default").leaf),7, "Result failed.")

    self.assertEqual(self.prop.hasKey("default"),None, "Result failed.")


  def test_clear(self):
    self.prop.clear()
    self.assertEqual(self.prop.getProperty("implementation_id"), "", "Result failed.")

    # Failed Pattern
    # self.assertEqual(self.prop.getProperty("implementation_id"), "ConfigSample", "Result failed.")


  def test_splitKeyValue(self):
    key=[]
    val=[]
    self.prop.splitKeyValue("key:value",key,val)
    self.assertEqual(key[0],"key")
    self.assertEqual(val[0],"value")


  def test_split(self):
    val=[]
    self.prop.split("test.split,hoge",".",val)
    
    self.assertEqual(val, ["test","split,hoge"])


  def test_mergeProperties(self):
    self.prop.mergeProperties(self.prop)
    self.assertEqual(self.prop.getProperty("implementation_id"), "ConfigSample", "Result failed.")

  
  def test_dump(self):
    print self.prop
Example #21
0
def unregister():

    RenderEngine.unregister()
    Properties.unregister()
Example #22
0
def register():

    RenderEngine.register()
    Properties.register()
Example #23
0
l_a = 1.691  #[m]
x_1 = 0.149  #[m]
x_2 = 0.554  #[m]
x_3 = 1.541  #[m]
x_a = 0.272  #[m]
h_a = 0.173  #[m]
d_1 = 0.00681  #[m]
d_3 = 0.0203  #[m]
theta = 26 * np.pi / 180  #[rad]
P = 37900  #[N]
E = 73100000000  #[Pa] http://asm.matweb.com/search/SpecificMaterial.asp?bassnum=MA2024T3
G = 28000000000  #[Pa] http://asm.matweb.com/search/SpecificMaterial.asp?bassnum=MA2024T3

#Parameters that should be taken from others code:

I_zz, I_yy = Properties.Properties(1).MOI()
J = Properties.Properties(1).torsional_stiffness()  #[m^4]
z_tilde = Properties.Properties(1).Shear_center()[0]  #[m]

#So, rows are equations and columns are variables, just like in linear algebra.

#The variables will go in this order:
#R_1,z  R_I  R_2,z  R_3,z  R_1,y  R_2,y  R_3,y  c_1  c_2  c_3  c_4  c_5   and ocasionally  P  int
#  1     2      3    4      5       6       7    8    9    10   11   12                   13    14
#  0     1      2    3      4       5       6    7    8    9    10   11                   12    13

#Please reffer to the latex for more information.

#Additional assumptions:
#- The change in theta from actuator I to actuator II is negligible for the P components calculation