You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@etch.apache.org by fi...@apache.org on 2012/08/02 17:15:58 UTC

svn commit: r1368518 - in /incubator/etch/trunk/binding-cpp/runtime: include/common/ include/serialization/ src/main/ src/main/serialization/ src/test/ src/test/serialization/

Author: fitzner
Date: Thu Aug  2 15:15:58 2012
New Revision: 1368518

URL: http://svn.apache.org/viewvc?rev=1368518&view=rev
Log:
ETCH-185 Implementation Validators

EtchValidatorCustom is implemented

Change-Id: Ifdd9fce222bb4574d56b3c41575f1f418d52f968

Added:
    incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorCustom.h
    incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorCustom.cpp
    incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorCustomTest.cpp
Modified:
    incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObjectType.h
    incubator/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt
    incubator/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt

Modified: incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObjectType.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObjectType.h?rev=1368518&r1=1368517&r2=1368518&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObjectType.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObjectType.h Thu Aug  2 15:15:58 2012
@@ -68,7 +68,9 @@ enum EtchObjectTypeIds {
   EOTID_QUEUEDPOOL,
   EOTID_WAIT_UP,
   EOTID_WAIT_DOWN,
-  EOTID_STUBHELPER
+  EOTID_STUBHELPER,
+  EOTID_VALIDATOR_CUSTOM,
+  EOTID_VALIDATOR_CUSTOM_KEY,
 };
 
 class EtchObjectType : public EtchObject {

Added: incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorCustom.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorCustom.h?rev=1368518&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorCustom.h (added)
+++ incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorCustom.h Thu Aug  2 15:15:58 2012
@@ -0,0 +1,122 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __ETCHVALIDATORCUSTOM_H__
+#define __ETCHVALIDATORCUSTOM_H__
+
+#include "common/EtchByte.h"
+#include "common/EtchShort.h"
+#include "common/EtchInt32.h"
+#include "common/EtchLong.h"
+#include "common/EtchNativeArray.h"
+#include "common/EtchHashTable.h"
+
+#include "serialization/EtchTypeValidator.h"
+#include "serialization/EtchTypeCodes.h"
+
+class EtchValidatorCustomKey : public EtchObject {
+public:
+
+  /**
+   * EtchObjectType for EtchValidatorCustomKey.
+   */
+  static const EtchObjectType* TYPE();
+
+  /**
+   * Constructs the key
+   */
+  EtchValidatorCustomKey();
+
+  /**
+   * Destructor
+   */
+  virtual ~EtchValidatorCustomKey();
+
+  /**
+   * Constructs the key
+   * @param type EtchObject type
+   * @param dim dimensions
+   * @param sub is subclass ok
+   */
+  EtchValidatorCustomKey(const EtchObjectType* type, capu::int32_t dim, capu::bool_t sub);
+
+  /**
+   * Returns hash code
+   */
+  capu::uint32_t getHashCode() const;
+
+  /**
+   * @return true if two object is equal
+   *         false otherwise
+   */
+  capu::bool_t equals(const EtchObject * other) const;
+
+  const EtchObjectType *mType;
+  capu::int32_t mDims;
+  capu::bool_t mSubclassOk;
+};
+
+
+class EtchValidatorCustom : public EtchTypeValidator {
+public:
+
+  /**
+   * EtchObjectType for EtchValidatorCustom.
+   */
+  static const EtchObjectType* TYPE();
+
+  /**
+   * Destructor
+   */
+  virtual ~EtchValidatorCustom();
+
+  /**
+   * @see EtchValidator
+   */
+  virtual status_t getElementValidator(capu::SmartPointer<EtchValidator> &val);
+
+  /**
+   * @see EtchValidator
+   */
+  virtual capu::bool_t validate(capu::SmartPointer<EtchObject> value);
+
+  /**
+   * @see EtchValidator
+   */
+  virtual status_t validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>& result);
+
+  /**
+   * @see EtchValidator
+   */
+  static status_t Get(capu::uint32_t ndim, const EtchObjectType *type, capu::bool_t sub, capu::SmartPointer<EtchValidator> &val);
+
+protected:
+
+  /**
+   * Constructs the validator instance
+   * @param type EtchObject type
+   * @param dim dimensions
+   * @param sub is subclass ok
+   */
+  EtchValidatorCustom(const EtchObjectType *type, capu::uint32_t ndim, capu::bool_t sub);
+
+private:
+  static EtchHashTable<EtchValidatorCustomKey, capu::SmartPointer<EtchValidator> > mValidators;
+};
+
+#endif /* ETCHVALIDATORCUSTOM_H */

Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt?rev=1368518&r1=1368517&r2=1368518&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt Thu Aug  2 15:15:58 2012
@@ -86,6 +86,7 @@ SET(MAIN_INCLUDES
     ${PROJECT_SOURCE_DIR}/include/serialization/EtchValidatorLong.h
     ${PROJECT_SOURCE_DIR}/include/serialization/EtchValidatorString.h
     ${PROJECT_SOURCE_DIR}/include/serialization/EtchValidatorNone.h
+    ${PROJECT_SOURCE_DIR}/include/serialization/EtchValidatorCustom.h
     ${PROJECT_SOURCE_DIR}/include/serialization/EtchComboValidator.h
     ${PROJECT_SOURCE_DIR}/include/serialization/EtchField.h
     ${PROJECT_SOURCE_DIR}/include/serialization/EtchValidatorObject.h
@@ -180,6 +181,7 @@ SET(MAIN_SOURCES
     serialization/EtchValidatorLong.cpp
     serialization/EtchValidatorString.cpp
     serialization/EtchValidatorNone.cpp
+    serialization/EtchValidatorCustom.cpp
     serialization/EtchComboValidator.cpp
     serialization/EtchField.cpp
     serialization/EtchValidatorObject.cpp
@@ -210,6 +212,7 @@ SET(MAIN_SOURCES
     support/EtchRemoteBase.cpp
     support/EtchTransportHelper.cpp
     support/EtchMonitor.cpp
+    support/EtchPool.cpp
     util/EtchCircularQueue.cpp
     util/EtchUtil.cpp
     util/EtchIdGenerator.cpp

Added: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorCustom.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorCustom.cpp?rev=1368518&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorCustom.cpp (added)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorCustom.cpp Thu Aug  2 15:15:58 2012
@@ -0,0 +1,113 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "serialization/EtchValidatorCustom.h"
+
+
+const EtchObjectType* EtchValidatorCustomKey::TYPE() {
+  const static EtchObjectType TYPE(EOTID_VALIDATOR_CUSTOM_KEY, NULL);
+  return &TYPE;
+}
+
+EtchValidatorCustomKey::EtchValidatorCustomKey()
+: EtchObject(EtchValidatorCustomKey::TYPE())
+, mType(NULL)
+, mDims(0)
+, mSubclassOk(false) {
+}
+
+EtchValidatorCustomKey::EtchValidatorCustomKey(const EtchObjectType * type, capu::int32_t dim, capu::bool_t sub)
+: EtchObject(EtchValidatorCustomKey::TYPE())
+, mType(type)
+, mDims(dim)
+, mSubclassOk(sub) {
+}
+
+EtchValidatorCustomKey::~EtchValidatorCustomKey() {
+}
+
+capu::bool_t EtchValidatorCustomKey::equals(const EtchObject * other) const {
+  if (other == NULL)
+    return false;
+  else if (!other->getObjectType()->equals(EtchValidatorCustomKey::TYPE()))
+    return false;
+  EtchValidatorCustomKey * a = (EtchValidatorCustomKey *) other;
+  return ((a->mDims == this->mDims) && (a->mType->equals(this->mType)) && (a->mSubclassOk == this->mSubclassOk));
+}
+
+capu::uint32_t EtchValidatorCustomKey::getHashCode() const {
+  return ((capu::uint32_t) mType->getTypeId()) ^ mDims * 9131 ^ (mSubclassOk ? 21357 : 8547);
+}
+
+const EtchObjectType* EtchValidatorCustom::TYPE() {
+  const static EtchObjectType TYPE(EOTID_VALIDATOR_CUSTOM, NULL);
+  return &TYPE;
+}
+
+EtchValidatorCustom::EtchValidatorCustom(const EtchObjectType *type, capu::uint32_t ndim, capu::bool_t sub)
+  : EtchTypeValidator(EtchValidatorCustom::TYPE(), type, type, ndim) {
+  // TODO refacotor type hierarchy
+  mSubclass = sub;
+}
+
+EtchValidatorCustom::~EtchValidatorCustom() {
+}
+
+capu::bool_t EtchValidatorCustom::validate(capu::SmartPointer<EtchObject> value) {
+  if(value.get() == NULL) {
+    return false;
+  }
+  if(mExpectedType == NULL) {
+    return false;
+  }
+  if(value->getObjectType()->equals(mExpectedType)) {
+    return true;
+  }
+  // return ((dynamic_cast<T*> (value.get()) != NULL) && (mSubclass));
+  // TODO: add object hierarchy fix
+
+  return false;
+}
+
+status_t EtchValidatorCustom::validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>& result) {
+  if (validate(value)) {
+    result = value;
+    return ETCH_OK;
+  } else {
+    return ETCH_ERROR;
+  }
+}
+
+status_t EtchValidatorCustom::Get(capu::uint32_t ndim, const EtchObjectType *type, capu::bool_t sub, capu::SmartPointer<EtchValidator> &val) {
+  if (ndim > MAX_NDIMS) {
+    return ETCH_EINVAL;
+  }
+
+  EtchValidatorCustomKey key(type, ndim, sub);
+  if (mValidators.get(key, &val) == ETCH_ENOT_EXIST) {
+    val = new EtchValidatorCustom(type, ndim, sub);
+    mValidators.put(key, val);
+  }
+  return ETCH_OK;
+}
+
+status_t EtchValidatorCustom::getElementValidator(capu::SmartPointer<EtchValidator> &val) {
+  return EtchValidatorCustom::Get(mNDims - 1, mExpectedType->getObjectComponentType(), mSubclass, val);
+}
+
+EtchHashTable<EtchValidatorCustomKey, capu::SmartPointer<EtchValidator> > EtchValidatorCustom::mValidators;

Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt?rev=1368518&r1=1368517&r2=1368518&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt Thu Aug  2 15:15:58 2012
@@ -84,6 +84,7 @@ add_executable (etch-cpp-test
     serialization/EtchDefaultValueFactoryTest.cpp
     serialization/EtchValidatorStructValueTest.cpp
     serialization/EtchBinaryTaggedDataInputOutputTest.cpp
+    serialization/EtchValidatorCustomTest.cpp
     support/EtchFreePoolTest.cpp
     support/EtchQueuedPoolTest.cpp
     support/EtchPlainMailboxTest.cpp

Added: incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorCustomTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorCustomTest.cpp?rev=1368518&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorCustomTest.cpp (added)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorCustomTest.cpp Thu Aug  2 15:15:58 2012
@@ -0,0 +1,190 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+#include "serialization/EtchValidatorCustom.h"
+#include "capu/util/SmartPointer.h"
+#include "common/EtchString.h"
+
+
+
+class MockGeneratedClass : public EtchObject {
+public:
+
+  MockGeneratedClass()
+  : EtchObject(MockGeneratedClass::TYPE()) {
+  }
+
+  virtual ~MockGeneratedClass() {
+  }
+
+  /**
+   * EtchObjectType for EtchString.
+   */
+  static const EtchObjectType* TYPE();
+};
+
+const EtchObjectType* MockGeneratedClass::TYPE() {
+  const static EtchObjectType TYPE(99, NULL);
+  return &TYPE;
+}
+
+
+TEST(EtchValidatorCustomTest, createTest) {
+  EtchValidatorCustom *ptr = NULL;
+
+  status_t status;
+  capu::SmartPointer<EtchValidator> val;
+  status = EtchValidatorCustom::Get(0, MockGeneratedClass::TYPE(), true, val);
+  EXPECT_EQ(ETCH_OK, status);
+
+  ptr = (EtchValidatorCustom*)val.get();
+  EXPECT_TRUE(ptr != NULL);
+  EXPECT_TRUE(ptr->getExpectedType()->equals(MockGeneratedClass::TYPE()));
+  EXPECT_TRUE(ptr->getNDims() == 0);
+
+  EtchObjectType type1(99, NULL);
+  EtchObjectType type2(EOTID_NATIVE_ARRAY, &type1);
+  status = EtchValidatorCustom::Get(2, MockGeneratedClass::TYPE(), true, val);
+  EXPECT_EQ(ETCH_OK, status);
+
+  ptr = (EtchValidatorCustom*) val.get();
+  EXPECT_TRUE(ptr != NULL);
+  EXPECT_TRUE(ptr->getExpectedType()->equals(&type2));
+  EXPECT_TRUE(ptr->getNDims() == 2);
+}
+
+TEST(EtchValidatorCustomTest, validateTest) {
+  status_t status;
+  capu::SmartPointer<EtchObject> byte = NULL;
+
+  capu::SmartPointer<EtchObject> integer = new EtchInt32(-128);
+  capu::SmartPointer<EtchObject> integer2 = new EtchInt32(5);
+  capu::SmartPointer<EtchObject> integer3 = new EtchInt32(127);
+  //exceed limit of byte
+  capu::SmartPointer<EtchObject> integer4 = new EtchInt32(897);
+  capu::SmartPointer<EtchObject> longInteger = new EtchLong(-128);
+  capu::SmartPointer<EtchObject> longInteger2 = new EtchLong(5);
+  capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(127);
+  capu::SmartPointer<EtchObject> longInteger4 = new EtchLong(897);
+  //exceed limit of byte
+  capu::SmartPointer<EtchObject> shortInteger = new EtchShort(-128);
+  capu::SmartPointer<EtchObject> shortInteger2 = new EtchShort(5);
+  capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(127);
+  //Exceed limit of byte
+  capu::SmartPointer<EtchObject> shortInteger4 = new EtchShort(897);
+  capu::SmartPointer<EtchObject> str = new EtchString();
+  capu::SmartPointer<EtchObject> byte2 = new EtchByte(3);
+
+  capu::SmartPointer<EtchObject> generatedClass = new MockGeneratedClass();
+
+  capu::SmartPointer<EtchValidator> val;
+  status = EtchValidatorCustom::Get(0, MockGeneratedClass::TYPE(), true, val);
+  EXPECT_EQ(ETCH_OK, status);
+
+  EXPECT_FALSE(val->validate(byte));
+  EXPECT_FALSE(val->validate(integer));
+  EXPECT_FALSE(val->validate(integer2));
+  EXPECT_FALSE(val->validate(integer3));
+  EXPECT_FALSE(val->validate(longInteger));
+  EXPECT_FALSE(val->validate(longInteger2));
+  EXPECT_FALSE(val->validate(longInteger3));
+  EXPECT_FALSE(val->validate(shortInteger));
+  EXPECT_FALSE(val->validate(shortInteger2));
+  EXPECT_FALSE(val->validate(shortInteger3));
+  EXPECT_FALSE(val->validate(byte2));
+  EXPECT_FALSE(val->validate(integer4));
+  EXPECT_FALSE(val->validate(longInteger4));
+  EXPECT_FALSE(val->validate(shortInteger4));
+  EXPECT_FALSE(val->validate(str));
+  EXPECT_TRUE(val->validate(generatedClass));
+}
+
+TEST(EtchValidatorCustomTest, validateValueTest) {
+  status_t status;
+  capu::SmartPointer<EtchObject> byte = NULL;
+  capu::SmartPointer<EtchObject> result;
+  capu::SmartPointer<EtchObject> integer = new EtchInt32(-128);
+  capu::SmartPointer<EtchObject> integer2 = new EtchInt32(5);
+  capu::SmartPointer<EtchObject> integer3 = new EtchInt32(127);
+  capu::SmartPointer<EtchObject> byte2 = new EtchByte(3);
+  
+  capu::SmartPointer<EtchValidator> ptr = NULL;
+  capu::SmartPointer<EtchObject> generatedClass = new MockGeneratedClass();
+
+  capu::SmartPointer<EtchValidator> val;
+  status = EtchValidatorCustom::Get(0, MockGeneratedClass::TYPE(), true, val);
+  EXPECT_EQ(ETCH_OK, status);
+
+  EXPECT_TRUE(val->validateValue(byte, result) == ETCH_ERROR);
+  EXPECT_TRUE(val->validateValue(integer, result) == ETCH_ERROR);
+  EXPECT_TRUE(val->validateValue(integer2, result) == ETCH_ERROR);
+  EXPECT_TRUE(val->validateValue(integer3, result) == ETCH_ERROR);
+  EXPECT_TRUE(val->validateValue(byte2, result) == ETCH_ERROR);
+  EXPECT_TRUE(val->validateValue(generatedClass, result) == ETCH_OK);
+}
+
+
+
+TEST(EtchValidatorCustomTest, elementValidatorTest) {
+  status_t status;
+  capu::SmartPointer<EtchValidator> ptr = NULL;
+  
+  status = EtchValidatorCustom::Get(1, MockGeneratedClass::TYPE(), true, ptr);
+  EXPECT_EQ(ETCH_OK, status);
+
+  capu::SmartPointer<EtchValidator> element_validator;
+  ptr->getElementValidator(element_validator);
+
+  capu::SmartPointer<EtchObject> integer = new EtchInt32(-128);
+  capu::SmartPointer<EtchObject> integer2 = new EtchInt32(5);
+  capu::SmartPointer<EtchObject> integer3 = new EtchInt32(127);
+  //exceed limit of byte
+  capu::SmartPointer<EtchObject> integer4 = new EtchInt32(897);
+  capu::SmartPointer<EtchObject> longInteger = new EtchLong(-128);
+  capu::SmartPointer<EtchObject> longInteger2 = new EtchLong(5);
+  capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(127);
+  //exceed limit of byte
+  capu::SmartPointer<EtchObject> longInteger4 = new EtchLong(897);
+  capu::SmartPointer<EtchObject> shortInteger = new EtchShort(-128);
+  capu::SmartPointer<EtchObject> shortInteger2 = new EtchShort(5);
+  capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(127);
+  //Exceed limit of byte
+  capu::SmartPointer<EtchObject> shortInteger4 = new EtchShort(897);
+  capu::SmartPointer<EtchObject> str = new EtchString();
+  capu::SmartPointer<EtchObject> byte2 = new EtchByte(3);
+  capu::SmartPointer<EtchObject> generatedClass = new MockGeneratedClass();
+
+  EXPECT_FALSE(element_validator->validate(integer));
+  EXPECT_FALSE(element_validator->validate(integer2));
+  EXPECT_FALSE(element_validator->validate(integer3));
+  EXPECT_FALSE(element_validator->validate(longInteger));
+  EXPECT_FALSE(element_validator->validate(longInteger2));
+  EXPECT_FALSE(element_validator->validate(longInteger3));
+  EXPECT_FALSE(element_validator->validate(shortInteger));
+  EXPECT_FALSE(element_validator->validate(shortInteger2));
+  EXPECT_FALSE(element_validator->validate(shortInteger3));
+  EXPECT_FALSE(element_validator->validate(byte2));
+  EXPECT_FALSE(element_validator->validate(integer4));
+  EXPECT_FALSE(element_validator->validate(longInteger4));
+  EXPECT_FALSE(element_validator->validate(shortInteger4));
+  EXPECT_FALSE(element_validator->validate(str));
+  EXPECT_TRUE(element_validator->validate(generatedClass));
+
+}