| | |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | | import static org.assertj.core.api.Assertions.assertThat; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | |
| | | import org.opends.server.types.FilterType; |
| | | import org.opends.server.types.SearchFilter; |
| | | import org.opends.server.util.TimeThread; |
| | | import org.testng.annotations.AfterClass; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.assertj.core.api.Assertions.*; |
| | | import static org.opends.server.schema.GeneralizedTimeSyntax.*; |
| | | import static org.opends.server.schema.SchemaConstants.*; |
| | | import static org.testng.Assert.*; |
| | |
| | | private static final String TIME_ATTR = "test-time"; |
| | | private static final String DATE_ATTR = "test-date"; |
| | | |
| | | private static final String TEST_TIME_DEF = "( test-time-oid NAME 'test-time' DESC 'Test time attribute' EQUALITY " |
| | | + "generalizedTimeMatch ORDERING generalizedTimeOrderingMatch " |
| | | + "SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE )"; |
| | | private static final String TEST_DATE_DEF = "( test-date-oid NAME 'test-date' DESC 'Test date attribute' EQUALITY " |
| | | + "generalizedTimeMatch ORDERING generalizedTimeOrderingMatch " |
| | | + "SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE )"; |
| | | private static final String TEST_OC_DEF = "( testoc-oid NAME 'testOC' SUP top AUXILIARY MUST test-time)"; |
| | | private static final String TEST_OC2_DEF = "( testoc2-oid NAME 'testOC2' SUP top AUXILIARY MUST test-date)"; |
| | | |
| | | |
| | | /** |
| | | * Ensures that the Directory Server is running before executing the |
| | |
| | | "dn: cn=schema", |
| | | "changetype: modify", |
| | | "add: attributeTypes", |
| | | "attributeTypes: ( test-time-oid NAME 'test-time' DESC 'Test time attribute' EQUALITY " + |
| | | "generalizedTimeMatch ORDERING generalizedTimeOrderingMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE )", |
| | | "attributeTypes: ( test-date-oid NAME 'test-date' DESC 'Test date attribute' EQUALITY " + |
| | | "generalizedTimeMatch ORDERING generalizedTimeOrderingMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE )", |
| | | "attributeTypes: " + TEST_TIME_DEF, |
| | | "attributeTypes: " + TEST_DATE_DEF, |
| | | "-", |
| | | "add: objectclasses", |
| | | "objectclasses: ( testoc-oid NAME 'testOC' SUP top AUXILIARY MUST test-time)", |
| | | "objectclasses: ( testoc2-oid NAME 'testOC2' SUP top AUXILIARY MUST test-date)" |
| | | "objectclasses: " + TEST_OC_DEF, |
| | | "objectclasses: " + TEST_OC2_DEF |
| | | ); |
| | | assertEquals(0, resultCode); |
| | | } |
| | | |
| | | @AfterClass |
| | | public void cleanup() throws Exception |
| | | { |
| | | int resultCode = TestCaseUtils.applyModifications(true, |
| | | "dn: cn=schema", |
| | | "changetype: modify", |
| | | "delete: objectclasses", |
| | | "objectclasses: " + TEST_OC_DEF, |
| | | "objectclasses: " + TEST_OC2_DEF, |
| | | "-", |
| | | "delete: attributetypes", |
| | | "attributeTypes: " + TEST_TIME_DEF, |
| | | "attributeTypes: " + TEST_DATE_DEF |
| | | ); |
| | | assertThat(resultCode).isEqualTo(0); |
| | | } |
| | | |
| | | @DataProvider |
| | | public Object[][] relativeTime() |
| | | { |