def execute(self):
        datas = self.getDatas()
        name = datas["name"]

        privates = ""
        for data in self.getProperties():
            privates += "	private %s %s;\n" % (data[1], data[0])

        prefix = ""
        methods = ""
        properties = ""
        requires = ""
        p_list = self.getProperties()
        length = len(p_list)

        for i in range(length):
            last = i == length - 1
            data = p_list[i]

            upper = TemplateUtils.splitUpper(data[0], "")
            properties += "filter.set%s(TestCase.ANY_%s);\n" % (
                upper, data[1].upper())

            methods += prefix
            methods += TemplateUtils.get("filter-method-test").format(
                upper=upper, uppertype=data[1].upper())
            prefix = "\n\n"

            requires += REQUIRE_TEMPLATE.format(upper, str(not last).lower())

        upper = TemplateUtils.splitUpper(name, "")

        return TemplateUtils.get("filter-test").format(packet=datas["package"], interface=upper, \
                                           testunit=methods, properties=properties, requires=requires)
    def execute(self):
        datas = self.getDatas()
        name = datas["name"]

        privates = ""
        for data in self.getProperties():
            privates += "	private %s %s;\n" % (data[1], data[0])

        prefix = ""
        methods = ""
        properties = ""
        requires = ""
        p_list = self.getProperties()
        length = len(p_list)
        
        for i in range(length):
            last = i == length - 1
            data = p_list[i]
            
            upper = TemplateUtils.splitUpper(data[0], "")
            properties += "filter.set%s(TestCase.ANY_%s);\n" % (upper, data[1].upper())
            
            methods += prefix
            methods += TemplateUtils.get("filter-method-test").format(upper=upper, uppertype=data[1].upper())
            prefix = "\n\n"
            
            requires += REQUIRE_TEMPLATE.format(upper, str(not last).lower())

        upper = TemplateUtils.splitUpper(name, "")
        
        return TemplateUtils.get("filter-test").format(packet=datas["package"], interface=upper, \
                                           testunit=methods, properties=properties, requires=requires)
Beispiel #3
0
    def execute(self):
        datas = self.getDatas()
        name = datas["name"]

        privates = ""
        prefix = ""
        methods = ""
        fill = ""
        extract = ""
        labels = ""

        for data in Utils.formProperties(self.getProperties()):
            privates += "        private %s %s;\n" % (data[1], data[0])
            methods += prefix
            if data[1] == "boolean":
                methods += self._generateIsMethod(data[0], data[1])
            else:
                methods += self._generateGetMethod(data[0], data[1])

            prefix = "\n\n"
            methods += prefix
            methods += self._generateSetMethod(data[0], data[1])
            fill += self._generateFill(name, data[0], data[1])
            extract += self._generateExtract(name, data[0], data[1])
            labels += self._generateLabels(data[0], data[1])

        upper = TemplateUtils.splitUpper(name, "")
        lower = TemplateUtils.splitLower(name)
        camel = TemplateUtils.splitCamel(name)
        getterSetter = privates + "\n" + methods

        return TemplateUtils.get("form").format(packet=datas["package"], interface=upper, auther=datas["author"], \
                                           entitykey=datas["key"], variable=getterSetter, name=lower, camel=camel, \
                                           fill=fill, extract=extract, labels=labels)
    def execute(self):
        datas = self.getDatas()

        entityName = datas["name"]

        return TemplateUtils.get("test-repository-hibernate").format(
            entityName)
Beispiel #5
0
 def execute(self):
     datas = self.getDatas()
     name = datas["name"]
     
     labels = ""
     fill = ""
     fillForm = ""
     assertForm = ""
     create = ""
     assertNotForm = ""
     properties = Utils.formProperties(self.getProperties())  
     for data in properties:
         labels += self._generateLabels(data[0], data[1])
         
         fill += self._generateFill(name, data[0], data[1])
         fillForm += self._generateFillForm(data[0], data[1])
         assertForm += self._generateAssertForm(name, data[0], data[1])
         create += self._generateCreate(name, data[0], data[1])
         assertNotForm += self._generateAssertNotForm(name, data[0], data[1])
     
     upper = TemplateUtils.splitUpper(name, "")
     camel = TemplateUtils.splitCamel(name)
     
     return TemplateUtils.get("form-test").format(packet=datas["package"], entitykey=datas["key"], interface=upper, labelAmount=len(properties), \
                                                   camel=camel, labels=labels, fill=fill, fillForm=fillForm, assertForm=assertForm, \
                                                   create=create, assertNotForm=assertNotForm)
Beispiel #6
0
    def execute(self):
        datas = self.getDatas()
        name = datas["name"]

        labels = ""
        fill = ""
        fillForm = ""
        assertForm = ""
        create = ""
        assertNotForm = ""
        properties = Utils.formProperties(self.getProperties())
        for data in properties:
            labels += self._generateLabels(data[0], data[1])

            fill += self._generateFill(name, data[0], data[1])
            fillForm += self._generateFillForm(data[0], data[1])
            assertForm += self._generateAssertForm(name, data[0], data[1])
            create += self._generateCreate(name, data[0], data[1])
            assertNotForm += self._generateAssertNotForm(
                name, data[0], data[1])

        upper = TemplateUtils.splitUpper(name, "")
        camel = TemplateUtils.splitCamel(name)

        return TemplateUtils.get("form-test").format(packet=datas["package"], entitykey=datas["key"], interface=upper, labelAmount=len(properties), \
                                                      camel=camel, labels=labels, fill=fill, fillForm=fillForm, assertForm=assertForm, \
                                                      create=create, assertNotForm=assertNotForm)
Beispiel #7
0
    def execute(self):
        datas = self.getDatas()
        name = datas["name"]

        privates = ""
        for data in self.getProperties():
            privates += "	private %s %s;\n" % (data[1], data[0])

        prefix = ""
        methods = ""
        
        for data in self.getProperties():
            methods += prefix
            if data[1] == "boolean":
                methods += self._generateIsMethod(data[0], data[1])
            else:
                methods += self._generateGetMethod(data[0], data[1])

            prefix = "\n\n"
            methods += prefix
            methods += self._generateSetMethod(data[0], data[1])

        upper = TemplateUtils.splitUpper(name, "")
        
        return TemplateUtils.get("implement") % (datas["package"], upper, datas["author"], upper, \
                                                 datas["abstract"], datas["key"], upper, privates, methods)
Beispiel #8
0
    def execute(self):
        datas = self.getDatas()
        name = datas["name"]

        privates = ""
        prefix = ""
        methods = ""
        fill = ""
        extract = ""
        labels = ""
        
        for data in Utils.formProperties(self.getProperties()):
            privates += "        private %s %s;\n" % (data[1], data[0])
            methods += prefix
            if data[1] == "boolean":
                methods += self._generateIsMethod(data[0], data[1])
            else:
                methods += self._generateGetMethod(data[0], data[1])

            prefix = "\n\n"
            methods += prefix
            methods += self._generateSetMethod(data[0], data[1])
            fill += self._generateFill(name, data[0], data[1])
            extract += self._generateExtract(name, data[0], data[1])
            labels += self._generateLabels(data[0], data[1])

        upper = TemplateUtils.splitUpper(name, "")
        lower = TemplateUtils.splitLower(name)
        camel = TemplateUtils.splitCamel(name)
        getterSetter = privates + "\n" + methods
        
        return TemplateUtils.get("form").format(packet=datas["package"], interface=upper, auther=datas["author"], \
                                           entitykey=datas["key"], variable=getterSetter, name=lower, camel=camel, \
                                           fill=fill, extract=extract, labels=labels)
Beispiel #9
0
    def _generateSetMethod(self, name, t):
        upper = TemplateUtils.splitUpper(name, "")
        lower = TemplateUtils.splitLower(name)

        return TemplateUtils.get("form-set-method-impl").format(ftype=t,
                                                                upper=upper,
                                                                name=name,
                                                                callname=lower)
Beispiel #10
0
 def execute(self):
     datas = self.getDatas()
     name = datas["name"]
     
     camel = TemplateUtils.splitCamel(name)
     entityName = TemplateUtils.splitUpper(name, "-").lower()
     upper = TemplateUtils.splitUpper(name, "")
     lower = TemplateUtils.splitLower(name)
     
     return TemplateUtils.get("web-model").format(packet=datas["package"], key=datas["key"], \
                                                         camel=camel, interface=upper, entityName=entityName, name=lower)
    def execute(self):
        datas = self.getDatas()
        name = datas["name"]

        camel = TemplateUtils.splitCamel(name)
        entityName = TemplateUtils.splitUpper(name, "-").lower()
        upper = TemplateUtils.splitUpper(name, "")
        lower = TemplateUtils.splitLower(name)

        return TemplateUtils.get("web-model-test").format(packet=datas["package"], key=datas["key"], \
                                                            camel=camel, interface=upper, entityName=entityName, name=lower)
Beispiel #12
0
 def execute(self):
     datas = self.getDatas()
     name = datas["name"]
     
     columns = "\"entity.id\""
     
     for data in self.getProperties():
         columns += ", \"entity.%s\"" % data[0]
     
     camel = TemplateUtils.splitCamel(name)
     entityName = TemplateUtils.splitUpper(name, "-").lower()
     upper = TemplateUtils.splitUpper(name, "")
     lower = TemplateUtils.splitLower(name)
     
     return TemplateUtils.get("admin-controller-test").format(packet=datas["package"], key=datas["key"], columns=columns, \
                                                         camel=camel, interface=upper, entityName=entityName, name=lower)
Beispiel #13
0
    def execute(self):
        datas = self.getDatas()
        name = datas["name"]

        privates = ""
        for data in self.getProperties():
            privates += "	private %s %s;\n" % (data[1], data[0])

        prefix = ""
        methods = ""
        requires = ""
        hashAppends = ""
        equalsAppends = ""
        
        for data in self.getProperties():
            upper = TemplateUtils.splitUpper(data[0], "")
            lower = TemplateUtils.splitCamel(data[0])
            if requires != "":
                requires += " || "
            requires += "has%s()" % upper
            
            hashAppends += ".append(%s)" % lower
            equalsAppends += "\t\t\tb.append(%s, rhs.%s);\n" % (lower, lower)
            
            methods += prefix
            methods += self._generateHasMethod(data[0], data[1])
            prefix = "\n\n"
            
            methods += prefix
            if data[1] == "boolean":
                methods += self._generateIsMethod(data[0], data[1])
            else:
                methods += self._generateGetMethod(data[0], data[1])

            methods += prefix
            methods += self._generateSetMethod(data[0], data[1])

        upper = TemplateUtils.splitUpper(name, "")
        lower = TemplateUtils.splitLower(name)
        camel = TemplateUtils.splitCamel(name)
        getterSetter = privates + "\n" + methods
        
        return TemplateUtils.get("filter").format(packet=datas["package"], interface=upper, auther=datas["author"], \
                                           entitykey=datas["key"], variable=getterSetter, name=lower, camel=camel, \
                                           required=requires, hashAppends=hashAppends, equalsAppends=equalsAppends)
Beispiel #14
0
    def execute(self):
        datas = self.getDatas()
        name = datas["name"]

        prefix = ""
        methods = ""

        for data in self.getProperties():
            methods += prefix
            if data[1] == "boolean":
                methods += self._generateIsMethod(data[0], data[1])
            else:
                methods += self._generateGetMethod(data[0], data[1])

            prefix = "\n\n"
            methods += prefix
            methods += self._generateSetMethod(data[0], data[1])

        upperName = TemplateUtils.splitUpper(name)
        upper = TemplateUtils.splitUpper(name, "")

        return TemplateUtils.get("interface") % \
              (datas["package"], upperName, datas["author"], upper, datas["super"], datas["key"], methods)
Beispiel #15
0
    def execute(self):
        datas = self.getDatas()
        name = datas["name"]

        prefix = ""
        methods = ""
        
        for data in self.getProperties():
            methods += prefix
            if data[1] == "boolean":
                methods += self._generateIsMethod(data[0], data[1])
            else:
                methods += self._generateGetMethod(data[0], data[1])

            prefix = "\n\n"
            methods += prefix
            methods += self._generateSetMethod(data[0], data[1])

        upperName = TemplateUtils.splitUpper(name)
        upper = TemplateUtils.splitUpper(name, "")
        
        return TemplateUtils.get("interface") % \
              (datas["package"], upperName, datas["author"], upper, datas["super"], datas["key"], methods)
Beispiel #16
0
 def _generateHasMethod(self, name, t):
     upper = TemplateUtils.splitUpper(name, "")
     lower = TemplateUtils.splitLower(name)
     
     return TemplateUtils.get("filter-has-method").format(ftype=t, upper=upper, name=name, callname=lower)
Beispiel #17
0
 def _generateSetMethod(self, name, t):
     upper = TemplateUtils.splitUpper(name, "")
     lower = TemplateUtils.splitLower(name)
     
     return TemplateUtils.get("form-set-method-impl").format(ftype=t, upper=upper, name=name, callname=lower)
Beispiel #18
0
 def _generateIsMethod(self, name, data_type):
     upper = TemplateUtils.splitUpper(name, "")
     
     return TemplateUtils.get("is-method-impl") % (data_type, upper, name)
Beispiel #19
0
 def _generateIsMethod(self, name, t):
     upper = TemplateUtils.splitUpper(name, "")
     
     return TemplateUtils.get("test-is-method") % (upper, upper, upper, upper)
Beispiel #20
0
 def _generateGetMethod(self, name, t):
     upper = TemplateUtils.splitUpper(name, "")
     full = TemplateUtils.splitFull(name)
     
     return TemplateUtils.get("test-method") % (upper, upper, upper, full, upper, full)
Beispiel #21
0
 def _generateSetMethod(self, name, data_type):
     lower = TemplateUtils.splitLower(name)
     upper = TemplateUtils.splitUpper(name, "")
     
     return TemplateUtils.get("set-method") % (lower, name, lower, upper, data_type, name)
Beispiel #22
0
 def execute(self):
     datas = self.getDatas()
     upper = TemplateUtils.splitUpper(datas["name"], "")
     
     return TemplateUtils.get("create-form").format(packet=datas["package"], interface=upper)
Beispiel #23
0
    def execute(self):
        datas = self.getDatas()
        upper = TemplateUtils.splitUpper(datas["name"], "")

        return TemplateUtils.get("update-form-test").format(
            packet=datas["package"], interface=upper)
Beispiel #24
0
 def _generateSetMethod(self, name, data_type):
     upper = TemplateUtils.splitUpper(name, "")
     
     return TemplateUtils.get("set-method-impl") % (upper, data_type, name, name, name)
Beispiel #25
0
    def _generateGetMethod(self, name, t):
        upper = TemplateUtils.splitUpper(name, "")
        full = TemplateUtils.splitFull(name)

        return TemplateUtils.get("test-method") % (upper, upper, upper, full,
                                                   upper, full)
    def execute(self):
        datas = self.getDatas()

        entityName = datas["name"]

        return TemplateUtils.get("test-repository-hibernate").format(entityName)
Beispiel #27
0
    def _generateIsMethod(self, name, t):
        upper = TemplateUtils.splitUpper(name, "")

        return TemplateUtils.get("test-is-method") % (upper, upper, upper,
                                                      upper)
Beispiel #28
0
    def _generateSetMethod(self, name, data_type):
        lower = TemplateUtils.splitLower(name)
        upper = TemplateUtils.splitUpper(name, "")

        return TemplateUtils.get("set-method") % (lower, name, lower, upper,
                                                  data_type, name)