From 420c58ec5633cf8ca81829bbf86581e7f61d3623 Mon Sep 17 00:00:00 2001
From: davidely <davidely@localhost>
Date: Fri, 27 Jul 2007 19:20:42 +0000
Subject: [PATCH] Altered test code to get around build failures with pre-1.5.0_08 JVMs. This problem especially affected Mac users since 1.5.0_08 JVM is not available on that platform.
---
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/MockLDAPProfile.java | 34 +++++++++++++++++++---------------
1 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/MockLDAPProfile.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/MockLDAPProfile.java
index c23bc6a..399c4df 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/MockLDAPProfile.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/MockLDAPProfile.java
@@ -30,6 +30,9 @@
/**
* A mock LDAP profile wrapper for testing purposes.
+ *
+ * NOTE: The seemingly unnecessary casts throughout this class are
+ * required to work around a bug in JDK versions prior to 1.5.0_08.
*/
public final class MockLDAPProfile extends LDAPProfile.Wrapper {
@@ -40,43 +43,43 @@
// No implementation required.
}
-
-
/**
* {@inheritDoc}
*/
@Override
public String getAttributeName(AbstractManagedObjectDefinition<?, ?> d,
PropertyDefinition<?> pd) {
- if (d == TestParentCfgDefn.getInstance()) {
+
+ // These casts throughout are required to work around a bug in JDK versions prior to 1.5.0_08.
+ if (d == (AbstractManagedObjectDefinition<?, ?>)TestParentCfgDefn.getInstance()) {
TestParentCfgDefn td = TestParentCfgDefn.getInstance();
- if (pd == td.getMandatoryBooleanPropertyPropertyDefinition()) {
+ if (pd == (PropertyDefinition<?>)td.getMandatoryBooleanPropertyPropertyDefinition()) {
return "ds-cfg-virtual-attribute-enabled";
- } else if (pd == td.getMandatoryClassPropertyPropertyDefinition()) {
+ } else if (pd == (PropertyDefinition<?>)td.getMandatoryClassPropertyPropertyDefinition()) {
return "ds-cfg-virtual-attribute-class";
- } else if (pd == td
+ } else if (pd == (PropertyDefinition<?>)td
.getMandatoryReadOnlyAttributeTypePropertyPropertyDefinition()) {
return "ds-cfg-virtual-attribute-type";
- } else if (pd == td.getOptionalMultiValuedDNPropertyPropertyDefinition()) {
+ } else if (pd == (PropertyDefinition<?>)td.getOptionalMultiValuedDNPropertyPropertyDefinition()) {
return "ds-cfg-virtual-attribute-base-dn";
} else {
throw new RuntimeException("Unexpected test-parent property"
+ pd.getName());
}
- } else if (d == TestChildCfgDefn.getInstance()) {
+ } else if (d == (AbstractManagedObjectDefinition<?, ?>)TestChildCfgDefn.getInstance()) {
TestChildCfgDefn td = TestChildCfgDefn.getInstance();
- if (pd == td.getMandatoryBooleanPropertyPropertyDefinition()) {
+ if (pd == (PropertyDefinition<?>)td.getMandatoryBooleanPropertyPropertyDefinition()) {
return "ds-cfg-virtual-attribute-enabled";
- } else if (pd == td.getMandatoryClassPropertyPropertyDefinition()) {
+ } else if (pd == (PropertyDefinition<?>)td.getMandatoryClassPropertyPropertyDefinition()) {
return "ds-cfg-virtual-attribute-class";
- } else if (pd == td
+ } else if (pd == (PropertyDefinition<?>)td
.getMandatoryReadOnlyAttributeTypePropertyPropertyDefinition()) {
return "ds-cfg-virtual-attribute-type";
- } else if (pd == td.getOptionalMultiValuedDNProperty1PropertyDefinition()) {
+ } else if (pd == (PropertyDefinition<?>)td.getOptionalMultiValuedDNProperty1PropertyDefinition()) {
return "ds-cfg-virtual-attribute-base-dn";
- } else if (pd == td.getOptionalMultiValuedDNProperty2PropertyDefinition()) {
+ } else if (pd == (PropertyDefinition<?>)td.getOptionalMultiValuedDNProperty2PropertyDefinition()) {
return "ds-cfg-virtual-attribute-group-dn";
} else {
throw new RuntimeException("Unexpected test-child property"
@@ -112,9 +115,10 @@
*/
@Override
public String getObjectClass(AbstractManagedObjectDefinition<?, ?> d) {
- if (d == TestParentCfgDefn.getInstance()) {
+ // These casts throughout are required to work around a bug in JDK versions prior to 1.5.0_08.
+ if (d == (AbstractManagedObjectDefinition<?, ?>)TestParentCfgDefn.getInstance()) {
return "ds-cfg-virtual-attribute";
- } else if (d == TestChildCfgDefn.getInstance()) {
+ } else if (d == (AbstractManagedObjectDefinition<?, ?>)TestChildCfgDefn.getInstance()) {
return "ds-cfg-virtual-attribute";
} else {
// Not known.
--
Gitblit v1.10.0