Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassifierRef.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOClassNotFoundException.java53
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOPackageNotFoundException.java (renamed from plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/PackageNotFoundException.java)26
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/CDOQueryInfoImpl.java32
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/messages/messages.properties3
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/protocol/CDODataInputImpl.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/CDOExtentCreator.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/OCLQueryHandler.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/InstancesQueryHandler.java30
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_456993_Test.java230
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/messages/messages.properties1
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java4
12 files changed, 356 insertions, 40 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassifierRef.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassifierRef.java
index aa4782fb4d..a0e8ef242b 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassifierRef.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassifierRef.java
@@ -12,6 +12,7 @@ package org.eclipse.emf.cdo.common.model;
import org.eclipse.emf.cdo.common.protocol.CDODataInput;
import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+import org.eclipse.emf.cdo.common.util.CDOPackageNotFoundException;
import org.eclipse.emf.cdo.internal.common.messages.Messages;
import org.eclipse.net4j.util.ObjectUtil;
@@ -113,7 +114,7 @@ public final class CDOClassifierRef implements Serializable
EPackage ePackage = packageRegistry.getEPackage(packageURI);
if (ePackage == null)
{
- throw new IllegalStateException(MessageFormat.format(Messages.getString("CDOClassifierRef.0"), packageURI)); //$NON-NLS-1$
+ throw new CDOPackageNotFoundException(packageURI);
}
return ePackage.getEClassifier(classifierName);
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOClassNotFoundException.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOClassNotFoundException.java
new file mode 100644
index 0000000000..9fd9018a1d
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOClassNotFoundException.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2004-2014 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Esteban Dugueperoux - initial API and implementation
+ */
+package org.eclipse.emf.cdo.common.util;
+
+import org.eclipse.emf.cdo.common.model.CDOClassifierRef;
+import org.eclipse.emf.cdo.internal.common.messages.Messages;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EPackage.Registry;
+
+import java.text.MessageFormat;
+
+/**
+ * A {@link CDOException} to indicate that an {@link EClass} is not available for an {@link EPackage} in the current {@link Registry}.
+ *
+ * @author Esteban Dugueperoux
+ * @since 4.4
+ */
+public final class CDOClassNotFoundException extends CDOException
+{
+ private static final long serialVersionUID = 1L;
+
+ private final String packageURI;
+
+ private final String classifierName;
+
+ public CDOClassNotFoundException(String packageURI, String classifierName)
+ {
+ super(MessageFormat.format(Messages.getString("CDOSessionImpl.1"),
+ packageURI + CDOClassifierRef.URI_SEPARATOR + classifierName));
+ this.packageURI = packageURI;
+ this.classifierName = classifierName;
+ }
+
+ public String getPackageURI()
+ {
+ return packageURI;
+ }
+
+ public String getClassifierName()
+ {
+ return classifierName;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/PackageNotFoundException.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOPackageNotFoundException.java
index 44e673439d..8b9edc9317 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/PackageNotFoundException.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOPackageNotFoundException.java
@@ -6,39 +6,37 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Eike Stepper - initial API and implementation
+ * Esteban Dugueperoux - initial API and implementation
*/
-package org.eclipse.emf.cdo.util;
+package org.eclipse.emf.cdo.common.util;
-import org.eclipse.emf.cdo.common.util.CDOException;
-
-import org.eclipse.emf.internal.cdo.messages.Messages;
+import org.eclipse.emf.cdo.internal.common.messages.Messages;
+import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EPackage.Registry;
import java.text.MessageFormat;
/**
- * A {@link CDOException} to indicate that an EPackage is not available in the current {@link Registry}
+ * A {@link CDOException} to indicate that an {@link EPackage} is not available in the current {@link Registry}.
*
* @author Esteban Dugueperoux
* @since 4.4
*/
-public class PackageNotFoundException extends CDOException
+public final class CDOPackageNotFoundException extends CDOException
{
private static final long serialVersionUID = 1L;
- private String uri;
+ private final String packageURI;
- public PackageNotFoundException(String uri)
+ public CDOPackageNotFoundException(String packageURI)
{
- super(MessageFormat.format(Messages.getString("CDOSessionImpl.0"), uri));
- this.uri = uri;
+ super(MessageFormat.format(Messages.getString("CDOSessionImpl.0"), packageURI));
+ this.packageURI = packageURI;
}
- public String uri()
+ public String getPackageURI()
{
- return uri;
+ return packageURI;
}
-
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/CDOQueryInfoImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/CDOQueryInfoImpl.java
index 49630ce875..82aa8acfb6 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/CDOQueryInfoImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/CDOQueryInfoImpl.java
@@ -15,6 +15,8 @@ import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
import org.eclipse.emf.cdo.common.protocol.CDODataInput;
import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
import org.eclipse.emf.cdo.common.util.CDOQueryInfo;
+import org.eclipse.emf.cdo.common.util.CDOClassNotFoundException;
+import org.eclipse.emf.cdo.common.util.CDOPackageNotFoundException;
import java.io.IOException;
import java.util.Collections;
@@ -50,7 +52,20 @@ public class CDOQueryInfoImpl implements CDOQueryInfo
{
queryLanguage = in.readString();
queryString = in.readString();
- context = in.readCDORevisionOrPrimitiveOrClassifier();
+
+ try
+ {
+ context = in.readCDORevisionOrPrimitiveOrClassifier();
+ }
+ catch (CDOPackageNotFoundException e)
+ {
+ //$FALL-THROUGH$
+ }
+ catch (CDOClassNotFoundException e)
+ {
+ //$FALL-THROUGH$
+ }
+
maxResults = in.readInt();
if (in.readBoolean())
@@ -62,8 +77,19 @@ public class CDOQueryInfoImpl implements CDOQueryInfo
for (int i = 0; i < size; i++)
{
String key = in.readString();
- Object object = in.readCDORevisionOrPrimitiveOrClassifier();
- parameters.put(key, object);
+ try
+ {
+ Object object = in.readCDORevisionOrPrimitiveOrClassifier();
+ parameters.put(key, object);
+ }
+ catch (CDOPackageNotFoundException e)
+ {
+ //$FALL-THROUGH$
+ }
+ catch (CDOClassNotFoundException e)
+ {
+ //$FALL-THROUGH$
+ }
}
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/messages/messages.properties b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/messages/messages.properties
index 3b20c8646c..b2082fbcfb 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/messages/messages.properties
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/messages/messages.properties
@@ -12,7 +12,6 @@ AbstractCDORevision.0=EClass is abstract: {0}
AbstractCDORevision.1=CDOID is null
AbstractCDORevision.2=Missing ID mapping for {0}
AbstractCDORevision.20=Could not find feature {0} in class {1}
-CDOClassifierRef.0=Package not found: {0}
CDOClassifierRef.1=Invalid classifier URI:
CDODataInputImpl.5=Invalid CDOFeatureDelta type
CDODataOutputImpl.5=Temporary ID not supported: {0}
@@ -31,6 +30,8 @@ CDOPackageUnit.0=Package unit type is unknown
CDOPackageUnitImpl.0=UNINITIALIZED
CDOPackageUnitImpl.1=Package unit not initialized
CDORevisionUtil.0=UNINITIALIZED
+CDOSessionImpl.0=Package locally not available: {0}
+CDOSessionImpl.1=Class locally not available: {0}
CDOTypeImpl.23=Cannot find the enum literal {0}
DLRevisionList.0=Cannot assign to a different list while linked to a list
DLRevisionList.3=Holder {0} is still linked in different list
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/protocol/CDODataInputImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/protocol/CDODataInputImpl.java
index e12220e516..abd9a272e1 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/protocol/CDODataInputImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/protocol/CDODataInputImpl.java
@@ -50,6 +50,7 @@ import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
+import org.eclipse.emf.cdo.common.util.CDOClassNotFoundException;
import org.eclipse.emf.cdo.internal.common.bundle.OM;
import org.eclipse.emf.cdo.internal.common.commit.CDOChangeSetDataImpl;
import org.eclipse.emf.cdo.internal.common.commit.FailureCommitInfo;
@@ -170,7 +171,7 @@ public abstract class CDODataInputImpl extends ExtendedDataInput.Delegating impl
EClassifier classifier = classifierRef.resolve(getPackageRegistry());
if (classifier == null)
{
- throw new IOException("Unable to resolve " + classifierRef);
+ throw new CDOClassNotFoundException(classifierRef.getPackageURI(), classifierRef.getClassifierName());
}
return classifier;
diff --git a/plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/CDOExtentCreator.java b/plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/CDOExtentCreator.java
index 8e318fd82b..3e4c7cdd0e 100644
--- a/plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/CDOExtentCreator.java
+++ b/plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/CDOExtentCreator.java
@@ -21,6 +21,7 @@ import org.eclipse.emf.cdo.common.revision.CDORevisionCacheAdder;
import org.eclipse.emf.cdo.common.revision.CDORevisionHandler;
import org.eclipse.emf.cdo.server.IStoreAccessor;
import org.eclipse.emf.cdo.server.StoreThreadLocal;
+import org.eclipse.emf.cdo.spi.server.InternalRepository;
import org.eclipse.emf.cdo.util.ObjectNotFoundException;
import org.eclipse.emf.cdo.view.CDOView;
@@ -170,7 +171,8 @@ public class CDOExtentCreator implements OCLExtentCreator
{
if (!eClass.isAbstract() && !eClass.isInterface())
{
- accessor.handleRevisions(eClass, branch, timeStamp, false, revisionHandler);
+ InternalRepository repository = (InternalRepository)accessor.getStore().getRepository();
+ repository.handleRevisions(eClass, branch, false, timeStamp, false, revisionHandler);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/OCLQueryHandler.java b/plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/OCLQueryHandler.java
index 5e23bda3f6..86ef11412d 100644
--- a/plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/OCLQueryHandler.java
+++ b/plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/OCLQueryHandler.java
@@ -560,12 +560,9 @@ public class OCLQueryHandler implements IQueryHandler
{
for (CDOPackageInfo packageInfo : packageUnit.getPackageInfos())
{
- if (!packageUnit.isSystem())
+ for (EClassifier classifier : packageInfo.getEPackage().getEClassifiers())
{
- for (EClassifier classifier : packageInfo.getEPackage().getEClassifiers())
- {
- return classifier;
- }
+ return classifier;
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/InstancesQueryHandler.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/InstancesQueryHandler.java
index 1343909e2d..863e1529b8 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/InstancesQueryHandler.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/InstancesQueryHandler.java
@@ -17,6 +17,7 @@ import org.eclipse.emf.cdo.common.revision.CDORevisionHandler;
import org.eclipse.emf.cdo.common.util.CDOQueryInfo;
import org.eclipse.emf.cdo.server.IQueryContext;
import org.eclipse.emf.cdo.server.IQueryHandler;
+import org.eclipse.emf.cdo.spi.common.revision.DetachedCDORevision;
import org.eclipse.emf.cdo.spi.server.InternalRepository;
import org.eclipse.emf.cdo.spi.server.QueryHandlerFactory;
@@ -38,22 +39,24 @@ public class InstancesQueryHandler implements IQueryHandler
public void executeQuery(CDOQueryInfo info, IQueryContext context)
{
EClass type = (EClass)info.getParameters().get(CDOProtocolConstants.QUERY_LANGUAGE_INSTANCES_TYPE);
- executeQuery(type, context);
-
- boolean exact = Boolean.TRUE.equals(info.getParameters().get(CDOProtocolConstants.QUERY_LANGUAGE_INSTANCES_EXACT));
- if (!exact)
+ if (type != null)
{
- List<EClass> subTypes = context.getView().getRepository().getPackageRegistry().getSubTypes().get(type);
- if (subTypes != null && !subTypes.isEmpty())
+ executeQuery(type, context);
+
+ if (!Boolean.TRUE.equals(info.getParameters().get(CDOProtocolConstants.QUERY_LANGUAGE_INSTANCES_EXACT)))
{
- for (EClass subType : subTypes)
+ List<EClass> subTypes = context.getView().getRepository().getPackageRegistry().getSubTypes().get(type);
+ if (subTypes != null && !subTypes.isEmpty())
{
- if (context.getResultCount() == 0)
+ for (EClass subType : subTypes)
{
- break;
- }
+ if (context.getResultCount() == 0)
+ {
+ break;
+ }
- executeQuery(subType, context);
+ executeQuery(subType, context);
+ }
}
}
}
@@ -74,6 +77,11 @@ public class InstancesQueryHandler implements IQueryHandler
{
public boolean handleRevision(CDORevision revision)
{
+ if (revision instanceof DetachedCDORevision)
+ {
+ return true;
+ }
+
return context.addResult(revision);
}
});
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_456993_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_456993_Test.java
new file mode 100644
index 0000000000..8bc466013e
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_456993_Test.java
@@ -0,0 +1,230 @@
+/*
+ * Copyright (c) 2014 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Esteban Dugueperoux - initial API and implementation
+ */
+package org.eclipse.emf.cdo.tests.bugzilla;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.tests.AbstractCDOTest;
+import org.eclipse.emf.cdo.tests.config.IRepositoryConfig;
+import org.eclipse.emf.cdo.tests.config.impl.ConfigTest.CleanRepositoriesBefore;
+import org.eclipse.emf.cdo.tests.config.impl.ConfigTest.Requires;
+import org.eclipse.emf.cdo.tests.model1.Category;
+import org.eclipse.emf.cdo.tests.model1.Company;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CDOUtil;
+import org.eclipse.emf.cdo.view.CDOQuery;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+
+import java.util.List;
+
+/**
+ * Bug 456993 about allInstances ocl query on branches.
+ *
+ * @author Esteban Dugueperoux
+ */
+@CleanRepositoriesBefore(reason = "Query result counting")
+@Requires(IRepositoryConfig.CAPABILITY_BRANCHING)
+public class Bugzilla_456993_Test extends AbstractCDOTest
+{
+ private static final String RESOURCE_NAME = "test1.model1";
+
+ private static final String B1 = "b1";
+
+ private static final String B11 = "b11";
+
+ private static final String B12 = "b12";
+
+ private static final String B2 = "b2";
+
+ private static final String B21 = "b21";
+
+ private static final String B22 = "b22";
+
+ public void testAllInstancesOCLQueryOnBranches() throws Exception
+ {
+ testAllInstancesQueryOnBranches("ocl", ".allInstances()", null, null);
+ }
+
+ public void testAllInstancesInstancesQueryOnBranches() throws Exception
+ {
+ testAllInstancesQueryOnBranches(CDOProtocolConstants.QUERY_LANGUAGE_INSTANCES, null, null, null);
+ }
+
+ private void testAllInstancesQueryOnBranches(String language, String queryStringSuffix, String parameterName,
+ String parameterValue) throws Exception
+ {
+ CDOSession session1 = openSession();
+ CDOBranch mainBranch = session1.getBranchManager().getMainBranch();
+ CDOTransaction transaction1 = session1.openTransaction();
+ CDOResource resource1 = transaction1.createResource(getResourcePath(RESOURCE_NAME));
+
+ Company company = getModel1Factory().createCompany();
+ CDOQuery query = createQuery(transaction1, language, getModel1Package().getCompany(), queryStringSuffix);
+ List<Object> instances = query.getResult();
+ assertEquals(0, instances.size());
+
+ resource1.getContents().add(company);
+
+ query = createQuery(transaction1, language, getModel1Package().getCompany(), queryStringSuffix);
+ instances = query.getResult();
+ assertEquals(0, instances.size());
+
+ transaction1.commit();
+
+ query = createQuery(transaction1, language, company, queryStringSuffix);
+ instances = query.getResult();
+ assertEquals(1, instances.size());
+
+ Category category = getModel1Factory().createCategory();
+ query = createQuery(transaction1, language, category, queryStringSuffix);
+ instances = query.getResult();
+ assertEquals(0, instances.size());
+
+ CDOBranch b1 = mainBranch.createBranch(B1);
+ transaction1.setBranch(b1);
+
+ query = createQuery(transaction1, language, company, queryStringSuffix);
+ instances = query.getResult();
+ assertEquals(1, instances.size());
+
+ query = createQuery(transaction1, language, category, queryStringSuffix);
+ instances = query.getResult();
+ assertEquals(0, instances.size());
+
+ company.getCategories().add(category);
+
+ query = createQuery(transaction1, language, company, queryStringSuffix);
+ instances = query.getResult();
+ assertEquals(1, instances.size());
+
+ transaction1.commit();
+
+ query = createQuery(transaction1, language, company, queryStringSuffix);
+ instances = query.getResult();
+ assertEquals(1, instances.size());
+
+ query = createQuery(transaction1, language, category, queryStringSuffix);
+ instances = query.getResult();
+ assertEquals(1, instances.size());
+
+ transaction1.setBranch(mainBranch);
+
+ query = createQuery(transaction1, language, company, queryStringSuffix);
+ instances = query.getResult();
+ assertEquals(1, instances.size());
+
+ query = createQuery(transaction1, language, category, queryStringSuffix);
+ instances = query.getResult();
+ assertEquals(0, instances.size());
+
+ CDOBranch b11 = b1.createBranch(B11);
+ CDOBranch b12 = b1.createBranch(B12);
+ CDOBranch b2 = mainBranch.createBranch(B2);
+ CDOBranch b21 = b2.createBranch(B21);
+ CDOBranch b22 = b2.createBranch(B22);
+
+ transaction1.setBranch(b11);
+
+ query = createQuery(transaction1, language, company, queryStringSuffix);
+ instances = query.getResult();
+ assertEquals(1, instances.size());
+
+ query = createQuery(transaction1, language, category, queryStringSuffix);
+ instances = query.getResult();
+ assertEquals(1, instances.size());
+
+ transaction1.setBranch(b12);
+
+ query = createQuery(transaction1, language, company, queryStringSuffix);
+ instances = query.getResult();
+ assertEquals(1, instances.size());
+
+ query = createQuery(transaction1, language, category, queryStringSuffix);
+ instances = query.getResult();
+ assertEquals(1, instances.size());
+
+ CDOID companyCDOID = CDOUtil.getCDOObject(company).cdoID();
+ company = (Company)transaction1.getObject(companyCDOID);
+ EcoreUtil.remove(company);
+ transaction1.commit();
+
+ query = createQuery(transaction1, language, company, queryStringSuffix);
+ instances = query.getResult();
+ assertEquals(0, instances.size());
+
+ query = createQuery(transaction1, language, category, queryStringSuffix);
+ instances = query.getResult();
+ assertEquals(0, instances.size());
+
+ transaction1.setBranch(b2);
+
+ query = createQuery(transaction1, language, company, queryStringSuffix);
+ instances = query.getResult();
+ assertEquals(1, instances.size());
+
+ query = createQuery(transaction1, language, category, queryStringSuffix);
+ instances = query.getResult();
+ assertEquals(0, instances.size());
+
+ company = (Company)transaction1.getObject(companyCDOID);
+ EcoreUtil.remove(company);
+ transaction1.commit();
+
+ query = createQuery(transaction1, language, company, queryStringSuffix);
+ instances = query.getResult();
+ assertEquals(0, instances.size());
+
+ query = createQuery(transaction1, language, category, queryStringSuffix);
+ instances = query.getResult();
+ assertEquals(0, instances.size());
+
+ transaction1.setBranch(b21);
+
+ query = createQuery(transaction1, language, company, queryStringSuffix);
+ instances = query.getResult();
+ assertEquals(1, instances.size());
+
+ query = createQuery(transaction1, language, category, queryStringSuffix);
+ instances = query.getResult();
+ assertEquals(0, instances.size());
+
+ transaction1.setBranch(b22);
+
+ query = createQuery(transaction1, language, company, queryStringSuffix);
+ instances = query.getResult();
+ assertEquals(1, instances.size());
+
+ query = createQuery(transaction1, language, category, queryStringSuffix);
+ instances = query.getResult();
+ assertEquals(0, instances.size());
+ }
+
+ private CDOQuery createQuery(CDOView view, String language, EObject eObject, String queryStringSuffix)
+ {
+ EClass eClass = eObject.eClass();
+ CDOQuery query = view.createQuery(language,
+ queryStringSuffix != null ? eClass.getEPackage().getName() + "::" + eClass.getName() + queryStringSuffix : null,
+ eObject.eResource() != null ? eObject : null);
+ if (queryStringSuffix == null)
+ {
+ query.setParameter(CDOProtocolConstants.QUERY_LANGUAGE_INSTANCES_TYPE, eClass);
+ }
+
+ return query;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/messages/messages.properties b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/messages/messages.properties
index 82bcf62fe5..3c0de29776 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/messages/messages.properties
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/messages/messages.properties
@@ -22,7 +22,6 @@ CDOResourceNodeImpl.5=Duplicate path: {0}
CDOSessionConfigurationImpl.0=Session is already open
CDOSessionConfigurationImpl.1=Session is not open
CDOSessionFactory.1=Query is empty: {0}
-CDOSessionImpl.0=Generated packages locally not available: {0}
CDOSessionImpl.1=Commit notification arrived while view is inactive
CDOSessionImpl.2=Commit notification arrived while session is inactive
CDOStaleReferencePolicy.0=EXCEPTION
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java
index 7a360af0cd..69beef82a3 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java
@@ -52,6 +52,7 @@ import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDOSetFeatureDelta;
import org.eclipse.emf.cdo.common.security.CDOPermission;
import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
+import org.eclipse.emf.cdo.common.util.CDOPackageNotFoundException;
import org.eclipse.emf.cdo.common.util.RepositoryStateChangedEvent;
import org.eclipse.emf.cdo.common.util.RepositoryTypeChangedEvent;
import org.eclipse.emf.cdo.eresource.EresourcePackage;
@@ -82,7 +83,6 @@ import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionManager;
import org.eclipse.emf.cdo.spi.common.revision.PointerCDORevision;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
import org.eclipse.emf.cdo.util.CDOUtil;
-import org.eclipse.emf.cdo.util.PackageNotFoundException;
import org.eclipse.emf.cdo.view.CDOFetchRuleManager;
import org.eclipse.emf.cdo.view.CDOView;
@@ -578,7 +578,7 @@ public abstract class CDOSessionImpl extends CDOTransactionContainerImpl impleme
{
if (!options().isGeneratedPackageEmulationEnabled())
{
- throw new PackageNotFoundException(packageUnit.getID());
+ throw new CDOPackageNotFoundException(packageUnit.getID());
}
}

Back to the top