<commit_before>package dbws.testing.plsqlcollection;

//javase imports
import java.io.StringReader;
import java.lang.reflect.Field;
import java.sql.Array;
import org.w3c.dom.Document;

//Java extension libraries

//JUnit4 imports
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

//EclipseLink imports
import org.eclipse.persistence.descriptors.ClassDescriptor;
import org.eclipse.persistence.internal.databaseaccess.Platform;
import org.eclipse.persistence.internal.descriptors.TransformerBasedFieldTransformation;
import org.eclipse.persistence.internal.helper.ConversionManager;
import org.eclipse.persistence.internal.helper.NonSynchronizedVector;
import org.eclipse.persistence.internal.sessions.factories.ObjectPersistenceWorkbenchXMLProject;
import org.eclipse.persistence.internal.xr.ProjectHelper;
import org.eclipse.persistence.internal.xr.XRDynamicClassLoader;
import org.eclipse.persistence.mappings.structures.ObjectRelationalDataTypeDescriptor;
import org.eclipse.persistence.mappings.transformers.ConstantTransformer;
import org.eclipse.persistence.oxm.XMLContext;
import org.eclipse.persistence.oxm.XMLMarshaller;
import org.eclipse.persistence.oxm.mappings.XMLTransformationMapping;
import org.eclipse.persistence.platform.database.jdbc.JDBCTypes;
import org.eclipse.persistence.platform.database.oracle.Oracle10Platform;
import org.eclipse.persistence.platform.database.oracle.plsql.PLSQLStoredProcedureCall;
import org.eclipse.persistence.platform.database.oracle.plsql.PLSQLCollection;
import org.eclipse.persistence.platform.xml.XMLComparer;
import org.eclipse.persistence.platform.xml.XMLParser;
import org.eclipse.persistence.platform.xml.XMLPlatformFactory;
import org.eclipse.persistence.queries.DataModifyQuery;
import org.eclipse.persistence.queries.DatabaseQuery;
import org.eclipse.persistence.sessions.DatabaseLogin;
import org.eclipse.persistence.sessions.DatabaseSession;
import org.eclipse.persistence.sessions.DatasourceLogin;
import org.eclipse.persistence.sessions.Project;
import org.eclipse.persistence.sessions.Session;
import org.eclipse.persistence.sessions.factories.XMLProjectReader;

public class PLSQLcollectionTestSuite {

    static final String CONSTANT_PROJECT_BUILD_VERSION =
        "Eclipse Persistence Services - some version (some build date)";
    static final String QUERY_NAME = "PLSQLcollectionQuery";

    static final String DATABASE_USERNAME_KEY = "db.user";
    static final String DATABASE_PASSWORD_KEY = "db.pwd";
    static final String DATABASE_URL_KEY = "db.url";

    static XMLComparer comparer = new XMLComparer();
    static XMLParser xmlParser = XMLPlatformFactory.getInstance().getXMLPlatform().newXMLParser();

    // testsuite fixture(s)
    static Project project = null;
    static Session session = null;
    static String username = null;
    static String password = <PASSWORD>;
    static String url = null;

    @BeforeClass
    public static void setUpProject() {
        username = System.getProperty(DATABASE_USERNAME_KEY);
        if (username == null) {
            fail("error retrieving database username");
        }
        password = System.getProperty(DATABASE_PASSWORD_KEY);
        if (password == null) {
            fail("error retrieving database password");
        }
        url = System.getProperty(DATABASE_URL_KEY);
        if (url == null) {
            fail("error retrieving database url");
        }
        project = new Project();
        project.setName("PLSQLcollectionTestSuite");
        ObjectRelationalDataTypeDescriptor t1Descriptor = new ObjectRelationalDataTypeDescriptor();
        t1Descriptor.setAlias("T1");
        t1Descriptor.setJavaClassName("org.eclipse.persistence.testing.tests.plsqlcollection.T1");
        t1Descriptor.descriptorIsAggregate();
        t1Descriptor.getQueryManager();
        project.addDescriptor(t1Descriptor);
        PLSQLCollection simplArray = new PLSQLCollection();
        simplArray.setTypeName("SOMEPACKAGE.TBL1");
        simplArray.setCompatibleType("SOMEPACKAGE_TBL1");
        simplArray.setNestedType(JDBCTypes.VARCHAR_TYPE);
        PLSQLStoredProcedureCall call = new PLSQLStoredProcedureCall();
        call.setProcedureName("SOMEPACKAGE.P1");
        call.addNamedArgument("SIMPLARRAY", simplArray);
        call.addNamedArgument("FOO", JDBCTypes.VARCHAR_TYPE, 10);
        DataModifyQuery query = new DataModifyQuery();
        query.addArgument("SIMPLARRAY", Array.class);
        query.addArgument("FOO", String.class);
        query.setCall(call);
        t1Descriptor.getQueryManager().addQuery(QUERY_NAME, query);
    }

    @AfterClass
    public static void tearDown() {
        if (session != null) {
            ((DatabaseSession)session).logout();
        }
    }

    static final String TEST_PROJECT_CONTROL_DOC =
        "<?xml version = '1.0' encoding = 'UTF-8'?>" +
        "<object-persistence version=\"" + CONSTANT_PROJECT_BUILD_VERSION + "\" " +
           "xmlns=\"http://www.eclipse.org/eclipselink/xsds/persistence\" " +
           "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " +
           "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
           "xmlns:eclipselink=\"http://www.eclipse.org/eclipselink/xsds/persistence\">" +
           "<name>PLSQLcollectionTestSuite</name>" +
           "<class-mapping-descriptors>" +
                 "<class-mapping-descriptor xsi:type=\"object-relational-class-mapping-descriptor\">" +
                    "<class>org.eclipse.persistence.testing.tests.plsqlcollection.T1</class>" +
                    "<alias>T1</alias>" +
                    "<events/>" +
                    "<querying>" +
                       "<queries>" +
                          "<query name=\"PLSQLcollectionQuery\" xsi:type=\"data-modify-query\">" +
                             "<arguments>" +
                                "<argument name=\"SIMPLARRAY\">" +
                                   "<type>java.sql.Array</type>" +
                                "</argument>" +
                                "<argument name=\"FOO\">" +
                                   "<type>java.lang.String</type>" +
                                "</argument>" +
                             "</arguments>" +
                             "<call xsi:type=\"plsql-stored-procedure-call\">" +
                                "<procedure-name>SOMEPACKAGE.P1</procedure-name>" +
                                "<arguments>" +
                                    "<argument xsi:type=\"plsql-collection\">" +
                                       "<name>SIMPLARRAY</name>" +
                                       "<index>0</index>" +
                                       "<type-name>SOMEPACKAGE.TBL1</type-name>" +
                                       "<compatible-type>SOMEPACKAGE_TBL1</compatible-type>" +<commit_msg>test fix<commit_after>package dbws.testing.plsqlcollection;

//javase imports
import java.io.StringReader;
import java.lang.reflect.Field;
import java.sql.Array;
import org.w3c.dom.Document;

//Java extension libraries

//JUnit4 imports
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

//EclipseLink imports
import org.eclipse.persistence.descriptors.ClassDescriptor;
import org.eclipse.persistence.internal.databaseaccess.Platform;
import org.eclipse.persistence.internal.descriptors.TransformerBasedFieldTransformation;
import org.eclipse.persistence.internal.helper.ConversionManager;
import org.eclipse.persistence.internal.helper.NonSynchronizedVector;
import org.eclipse.persistence.internal.sessions.factories.ObjectPersistenceWorkbenchXMLProject;
import org.eclipse.persistence.internal.xr.ProjectHelper;
import org.eclipse.persistence.internal.xr.XRDynamicClassLoader;
import org.eclipse.persistence.mappings.structures.ObjectRelationalDataTypeDescriptor;
import org.eclipse.persistence.mappings.transformers.ConstantTransformer;
import org.eclipse.persistence.oxm.XMLContext;
import org.eclipse.persistence.oxm.XMLMarshaller;
import org.eclipse.persistence.oxm.mappings.XMLTransformationMapping;
import org.eclipse.persistence.platform.database.jdbc.JDBCTypes;
import org.eclipse.persistence.platform.database.oracle.Oracle10Platform;
import org.eclipse.persistence.platform.database.oracle.plsql.PLSQLStoredProcedureCall;
import org.eclipse.persistence.platform.database.oracle.plsql.PLSQLCollection;
import org.eclipse.persistence.platform.xml.XMLComparer;
import org.eclipse.persistence.platform.xml.XMLParser;
import org.eclipse.persistence.platform.xml.XMLPlatformFactory;
import org.eclipse.persistence.queries.DataModifyQuery;
import org.eclipse.persistence.queries.DatabaseQuery;
import org.eclipse.persistence.sessions.DatabaseLogin;
import org.eclipse.persistence.sessions.DatabaseSession;
import org.eclipse.persistence.sessions.DatasourceLogin;
import org.eclipse.persistence.sessions.Project;
import org.eclipse.persistence.sessions.Session;
import org.eclipse.persistence.sessions.factories.XMLProjectReader;

public class PLSQLcollectionTestSuite {

    static final String CONSTANT_PROJECT_BUILD_VERSION =
        "Eclipse Persistence Services - some version (some build date)";
    static final String QUERY_NAME = "PLSQLcollectionQuery";

    static final String DATABASE_USERNAME_KEY = "db.user";
    static final String DATABASE_PASSWORD_KEY = "db.pwd";
    static final String DATABASE_URL_KEY = "db.url";

    static XMLComparer comparer = new XMLComparer();
    static XMLParser xmlParser = XMLPlatformFactory.getInstance().getXMLPlatform().newXMLParser();

    // testsuite fixture(s)
    static Project project = null;
    static Session session = null;
    static String username = null;
    static String password = null;
    static String url = null;

    @BeforeClass
    public static void setUpProject() {
        username = System.getProperty(DATABASE_USERNAME_KEY);
        if (username == null) {
            fail("error retrieving database username");
        }
        password = System.getProperty(DATABASE_PASSWORD_KEY);
        if (password == null) {
            fail("error retrieving database password");
        }
        url = System.getProperty(DATABASE_URL_KEY);
        if (url == null) {
            fail("error retrieving database url");
        }
        project = new Project();
        project.setName("PLSQLcollectionTestSuite");
        ObjectRelationalDataTypeDescriptor t1Descriptor = new ObjectRelationalDataTypeDescriptor();
        t1Descriptor.setAlias("T1");
        t1Descriptor.setJavaClassName("org.eclipse.persistence.testing.tests.plsqlcollection.T1");
        t1Descriptor.descriptorIsAggregate();
        t1Descriptor.getQueryManager();
        project.addDescriptor(t1Descriptor);
        PLSQLCollection simplArray = new PLSQLCollection();
        simplArray.setTypeName("SOMEPACKAGE.TBL1");
        simplArray.setCompatibleType("SOMEPACKAGE_TBL1");
        simplArray.setNestedType(JDBCTypes.VARCHAR_TYPE);
        PLSQLStoredProcedureCall call = new PLSQLStoredProcedureCall();
        call.setProcedureName("SOMEPACKAGE.P1");
        call.addNamedArgument("SIMPLARRAY", simplArray);
        call.addNamedArgument("FOO", JDBCTypes.VARCHAR_TYPE, 10);
        DataModifyQuery query = new DataModifyQuery();
        query.addArgument("SIMPLARRAY", Array.class);
        query.addArgument("FOO", String.class);
        query.setCall(call);
        t1Descriptor.getQueryManager().addQuery(QUERY_NAME, query);
    }

    @AfterClass
    public static void tearDown() {
        if (session != null) {
            ((DatabaseSession)session).logout();
        }
    }

    static final String TEST_PROJECT_CONTROL_DOC =
        "<?xml version = '1.0' encoding = 'UTF-8'?>" +
        "<object-persistence version=\"" + CONSTANT_PROJECT_BUILD_VERSION + "\" " +
           "xmlns=\"http://www.eclipse.org/eclipselink/xsds/persistence\" " +
           "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " +
           "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
           "xmlns:eclipselink=\"http://www.eclipse.org/eclipselink/xsds/persistence\">" +
           "<name>PLSQLcollectionTestSuite</name>" +
           "<class-mapping-descriptors>" +
                 "<class-mapping-descriptor xsi:type=\"object-relational-class-mapping-descriptor\">" +
                    "<class>org.eclipse.persistence.testing.tests.plsqlcollection.T1</class>" +
                    "<alias>T1</alias>" +
                    "<events/>" +
                    "<querying>" +
                       "<queries>" +
                          "<query name=\"PLSQLcollectionQuery\" xsi:type=\"data-modify-query\">" +
                             "<arguments>" +
                                "<argument name=\"SIMPLARRAY\">" +
                                   "<type>java.sql.Array</type>" +
                                "</argument>" +
                                "<argument name=\"FOO\">" +
                                   "<type>java.lang.String</type>" +
                                "</argument>" +
                             "</arguments>" +
                             "<call xsi:type=\"plsql-stored-procedure-call\">" +
                                "<procedure-name>SOMEPACKAGE.P1</procedure-name>" +
                                "<arguments>" +
                                    "<argument xsi:type=\"plsql-collection\">" +
                                       "<name>SIMPLARRAY</name>" +
                                       "<index>0</index>" +
                                       "<type-name>SOMEPACKAGE.TBL1</type-name>" +
                                       "<compatible-type>SOMEPACKAGE_TBL1</compatible-type>" +
                                       "<java-type>java.util.ArrayList</java-type>" +
{'fraction_non_alphanumeric': 0.11404450168133362, 'fraction_numerical': 0.005294412248694283, 'mean_word_length': 2.737433155080214, 'pattern_counts': {'":': 0, '<': 80, '<?xml version=': 0, '>': 80, 'https://': 0, 'lorem ipsum': 0, 'www.': 8, 'xml': 18}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 15, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4745363', 'n_tokens_mistral': 3796, 'n_tokens_neox': 3831, 'n_words': 568}