Skip to content

Commit

Permalink
Merge pull request #21 from gs-rezaem/master
Browse files Browse the repository at this point in the history
implement equality substitution in chained mapper
  • Loading branch information
gs-rezaem authored Nov 3, 2016
2 parents d17cfb8 + fcdb227 commit 5d9c39a
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 54 deletions.
2 changes: 1 addition & 1 deletion build/reladomo-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
under the License.
-->
<project name="mithra-config" default="determine-jdk">
<property name="reladomo.version" value="16.1.0"/>
<property name="reladomo.version" value="16.1.1"/>
<property name="snapshot" value=""/>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.gs.fw.common.mithra.extractor.Extractor;
import com.gs.fw.common.mithra.util.InternalList;
import com.gs.fw.common.mithra.util.MithraFastList;
import com.gs.fw.common.mithra.util.SmallSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.gs.fw.common.mithra.MithraObjectPortal;
Expand Down Expand Up @@ -380,17 +381,27 @@ public boolean isJoinedWith(MithraObjectPortal portal)

public MappedOperation equalitySubstituteWithMultiEquality(MappedOperation mappedOperation, MultiEqualityOperation op)
{
HashSet set = new HashSet();
this.addDepenedentAttributesToSet(set);
for(Iterator it = set.iterator();it.hasNext();)
SmallSet set = new SmallSet(4);
op.zAddAllLeftAttributes(set);
Operation possibleSub = NoOperation.instance();
for(int i=0;i<set.size();i++)
{
Attribute a = (Attribute) it.next();
if (op.operatesOnAttribute(a))
Attribute attr = (Attribute) set.get(i);
Attribute replace = this.getDeepestEqualAttribute(attr);
if (replace != null && !mappedOperation.underlyingOperationDependsOnAttribute(replace))
{
//todo: rezaem: multi equality substitution in chanied mapper
this.getLogger().warn("this operation is at best not well optimized. At worst, totally broken.");
Operation replacedOp = op.getSusbstitutedEquality(attr, replace);
if (replacedOp != null)
{
possibleSub = possibleSub.and(replacedOp);
}
}
}
if (NoOperation.instance() != possibleSub)
{
return new MappedOperation(this,
mappedOperation.getUnderlyingOperation().and(possibleSub));
}
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ public static Test suite()
// suite.addTest(new MultiVmNotificationsTestSuite(TestNotificationMessages.class));
// suite.addTest(new MultiClientVmTestSuite(TestMultiClientNotificationTestCase.class));
// suite.addTest(new MultiVmNotificationsTestSuite(TestPeerToPeerMithraTestCase.class));
// suite.addTest(new MultiVmNotificationsTestSuite(TestApplicationNotification.class));
suite.addTest(new MultiVmNotificationsTestSuite(TestApplicationNotification.class));
// suite.addTest(new MultiVmNotificationsTestSuite(TestMithraReplicationNotificationMessages.class));
suite.addTest(new MultiVmTestSuite(TestClientPortal.class));
// suite.addTest(new MultiVmTestSuite(TestClientPortal.class));
// suite.addTest(new MultiVmTestSuite(TestClientPortalUsingDerby.class));
suite.addTest(new MultiVmTestSuite(TestTransactionalClientPortal.class));
// suite.addTest(new MultiVmTestSuite(TestTransactionalClientPortal.class));
// suite.addTest(new MultiVmTestSuite(TestEmbeddedValueObjectsRemote.class));
//suite.addTest(new MultiVmTestSuite(TestPureObjectsRemote.class));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1083,17 +1083,17 @@ public void testSimpleListNotificationWithMultipleSourceAttributesAddingObjectAf

//add a new team to the registered list
Team team = new Team();
team.setTeamId(999);
team.setTeamId(10999);
team.setSourceId("B");
team.setDivisionId(1);
team.setName("Team 999");
team.setName("Team 10999");
team.insert();
teamList.add(team);
updateClassCount = TeamFinder.getMithraObjectPortal().getPerClassUpdateCountHolder().getUpdateCount();
//server-side update the newly added team
this.getRemoteSlaveVm().executeMethod("serverUpdateTeamName",
new Class[]{String.class, int.class,String.class},
new Object[]{"B", new Integer(999), "New Team 999"});
new Object[]{"B", new Integer(10999), "New Team 999"});
waitForMessages(updateClassCount, TeamFinder.getMithraObjectPortal());

waitForNotification(listener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,46 +36,7 @@
import com.gs.fw.common.mithra.test.aggregate.TestMin;
import com.gs.fw.common.mithra.test.aggregate.TestNumericAttribute;
import com.gs.fw.common.mithra.test.aggregate.TestSum;
import com.gs.fw.common.mithra.test.domain.Account;
import com.gs.fw.common.mithra.test.domain.AccountTransactionException;
import com.gs.fw.common.mithra.test.domain.AccountTransactionExceptionFinder;
import com.gs.fw.common.mithra.test.domain.AuditedOrder;
import com.gs.fw.common.mithra.test.domain.AuditedOrderItem;
import com.gs.fw.common.mithra.test.domain.AuditedOrderStatus;
import com.gs.fw.common.mithra.test.domain.Book;
import com.gs.fw.common.mithra.test.domain.BookFinder;
import com.gs.fw.common.mithra.test.domain.BookList;
import com.gs.fw.common.mithra.test.domain.DatedEntity;
import com.gs.fw.common.mithra.test.domain.Group;
import com.gs.fw.common.mithra.test.domain.GroupFinder;
import com.gs.fw.common.mithra.test.domain.GroupList;
import com.gs.fw.common.mithra.test.domain.InfinityTimestamp;
import com.gs.fw.common.mithra.test.domain.Manufacturer;
import com.gs.fw.common.mithra.test.domain.NoExportTestObject;
import com.gs.fw.common.mithra.test.domain.NoExportTestObjectFinder;
import com.gs.fw.common.mithra.test.domain.Order;
import com.gs.fw.common.mithra.test.domain.OrderFinder;
import com.gs.fw.common.mithra.test.domain.OrderItem;
import com.gs.fw.common.mithra.test.domain.OrderItemList;
import com.gs.fw.common.mithra.test.domain.OrderList;
import com.gs.fw.common.mithra.test.domain.ParaBalance;
import com.gs.fw.common.mithra.test.domain.ParaDesk;
import com.gs.fw.common.mithra.test.domain.ParaDeskFinder;
import com.gs.fw.common.mithra.test.domain.ParaDeskList;
import com.gs.fw.common.mithra.test.domain.Profile;
import com.gs.fw.common.mithra.test.domain.ProfileFinder;
import com.gs.fw.common.mithra.test.domain.ProfileList;
import com.gs.fw.common.mithra.test.domain.SpecialAccount;
import com.gs.fw.common.mithra.test.domain.SpecialAccountFinder;
import com.gs.fw.common.mithra.test.domain.TamsAccount;
import com.gs.fw.common.mithra.test.domain.TamsAccountFinder;
import com.gs.fw.common.mithra.test.domain.TamsAccountList;
import com.gs.fw.common.mithra.test.domain.Trial;
import com.gs.fw.common.mithra.test.domain.TrialFinder;
import com.gs.fw.common.mithra.test.domain.User;
import com.gs.fw.common.mithra.test.domain.UserFinder;
import com.gs.fw.common.mithra.test.domain.UserGroup;
import com.gs.fw.common.mithra.test.domain.UserList;
import com.gs.fw.common.mithra.test.domain.*;
import com.gs.fw.common.mithra.test.domain.dated.AuditedOrderStatusTwo;
import com.gs.fw.common.mithra.test.inherited.TestReadOnlyInherited;
import java.sql.Connection;
Expand Down Expand Up @@ -146,6 +107,7 @@ protected Class[] getRestrictedClassList()
result.add(NoExportTestObject.class);
result.add(AccountTransactionException.class);
result.add(SpecialAccount.class);
result.add(FullyCachedTinyBalance.class);
Class[] array = new Class[result.size()];
result.toArray(array);
return array;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.gs.fw.common.mithra.test;

import com.gs.fw.common.mithra.databasetype.DerbyDatabaseType;
import com.gs.fw.common.mithra.test.domain.FullyCachedTinyBalance;
import com.gs.fw.common.mithra.test.domain.SpecialAccount;

import java.sql.SQLException;
Expand All @@ -35,6 +36,7 @@ protected Class[] getRestrictedClassList()
Set<Class> result = new HashSet<Class>();
addTestClassesFromOther(new TestOrderby(), result);
result.add(SpecialAccount.class);
result.add(FullyCachedTinyBalance.class);
Class[] array = new Class[result.size()];
result.toArray(array);
return array;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import com.gs.fw.common.mithra.MithraManagerProvider;
import com.gs.fw.common.mithra.finder.Operation;
import com.gs.fw.common.mithra.test.domain.FullyCachedTinyBalance;
import com.gs.fw.common.mithra.test.domain.SpecialAccount;
import com.gs.fw.common.mithra.test.domain.TestReplicatedObject;
import com.gs.fw.common.mithra.test.domain.dated.TestTamsAccountIncomeFunction;
Expand Down Expand Up @@ -49,6 +50,7 @@ protected Class[] getRestrictedClassList()
TestTamsMithraTrial.class,
TestTamsAccountIncomeFunction.class,
TestReplicatedObject.class,
FullyCachedTinyBalance.class,
SpecialAccount.class
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ protected Class[] getRestrictedClassList()
Employee.class,
Product.class,
TinyBalance.class,
FullyCachedTinyBalance.class,
Contract.class,
SpecialAccount.class
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ protected Class[] getRestrictedClassList()
result.add(ProductSpecification.class);
result.add(SalesLineItem.class);
result.add(SpecialAccount.class);
result.add(FullyCachedTinyBalance.class);
result.add(WallCrossImpl.class);
result.add(PureOrder.class);
result.add(PureOrderItem.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ private void addTestClassesToBeDecoupled(Set<Class> result)
result.add(ProductSpecification.class);
result.add(SalesLineItem.class);
result.add(SpecialAccount.class);
result.add(FullyCachedTinyBalance.class);
result.add(WallCrossImpl.class);
}

Expand Down

0 comments on commit 5d9c39a

Please sign in to comment.