blob: c3ac90e668edcb7d85f2bc2f799f7ae30334c3e6 [file] [log] [blame]
/*
* Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0,
* or the Eclipse Distribution License v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
// Contributors:
// dmccann - 1.0M9 - Initial implementation
package org.eclipse.persistence.testing.oxm.events.descriptor;
import java.util.ArrayList;
import org.eclipse.persistence.oxm.platform.XMLPlatform;
import org.eclipse.persistence.testing.oxm.OXTestCase.Platform;
import org.eclipse.persistence.testing.oxm.events.Address;
import org.eclipse.persistence.testing.oxm.events.Employee;
import org.eclipse.persistence.testing.oxm.mappings.XMLMappingTestCases;
import org.w3c.dom.Document;
public class PostBuildEventTestCases extends XMLMappingTestCases {
static Integer EMPLOYEE_POST_BUILD = Integer.valueOf(0);
static Integer ADDRESS_POST_BUILD = Integer.valueOf(1);
EmployeeProject project;
public PostBuildEventTestCases(String name) throws Exception {
super(name);
project = new EmployeeProject();
setProject(project);
setControlDocument("org/eclipse/persistence/testing/oxm/events/composite_object.xml");
}
@Override
public void setUp() throws Exception {
super.setUp();
project.setup();
}
@Override
public void xmlToObjectTest(Object testObject) throws Exception {
super.xmlToObjectTest(testObject);
assertTrue("Employee post build event did not occur as expected", project.events.contains(EMPLOYEE_POST_BUILD));
assertTrue("Address post build event did not occur as expected", project.events.contains(ADDRESS_POST_BUILD));
}
@Override
public Object getControlObject() {
Employee employee = new Employee();
Address address = new Address();
address.street = "2201 Riverside Drive";
employee.address = address;
if (platform == Platform.SAX) {
employee.anyCollection = new ArrayList(); // initialize list for equality check
}
return employee;
}
public static void main(String[] args) {
junit.textui.TestRunner.main(new String[] { "-c", "org.eclipse.persistence.testing.oxm.events.descriptor.PostBuildEventTestCases" });
}
}