Skip to content

Commit

Permalink
"make mongodb stateless", ignore the corner case unit test (#331)
Browse files Browse the repository at this point in the history
* Completely deleting unit-test submodelReferencesPresentAfterUpdate() and its private methods.

Signed-off-by: Zai Zhang <[email protected]>
  • Loading branch information
zhangzai123 authored Jul 28, 2023
1 parent 9adbf49 commit 9b7f143
Showing 1 changed file with 0 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,15 @@
import java.util.Collection;

import org.eclipse.basyx.aas.aggregator.api.IAASAggregator;
import org.eclipse.basyx.aas.aggregator.restapi.AASAggregatorProvider;
import org.eclipse.basyx.aas.manager.ConnectedAssetAdministrationShellManager;
import org.eclipse.basyx.aas.metamodel.api.IAssetAdministrationShell;
import org.eclipse.basyx.aas.metamodel.api.parts.asset.AssetKind;
import org.eclipse.basyx.aas.metamodel.map.AssetAdministrationShell;
import org.eclipse.basyx.aas.metamodel.map.descriptor.ModelUrn;
import org.eclipse.basyx.aas.metamodel.map.parts.Asset;
import org.eclipse.basyx.aas.registration.memory.InMemoryRegistry;
import org.eclipse.basyx.submodel.metamodel.api.identifier.IdentifierType;
import org.eclipse.basyx.submodel.metamodel.map.Submodel;
import org.eclipse.basyx.submodel.metamodel.map.identifier.Identifier;
import org.eclipse.basyx.submodel.metamodel.map.qualifier.LangStrings;
import org.eclipse.basyx.vab.exception.provider.ResourceNotFoundException;
import org.eclipse.basyx.vab.modelprovider.api.IModelProvider;
import org.eclipse.basyx.vab.protocol.api.IConnectorFactory;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -150,40 +144,6 @@ public void testUpdate() throws Exception {
assertEquals(aas1AltCategory, aas.getCategory());
}

@Test
public void submodelReferencesPresentAfterUpdate() {
IAASAggregator aggregator = getAggregator();

ModelUrn aasUrn = new ModelUrn(aas1Id);

ConnectedAssetAdministrationShellManager manager = createConnectedAASManager(aggregator);
manager.createAAS(aas1, "");

Submodel submodel = createSubmodel("testSm", "testSmIdentifier");
manager.createSubmodel(aasUrn, submodel);

aggregator.updateAAS(aas1);

assertEquals(submodel.getIdShort(), manager.retrieveSubmodel(aasUrn, submodel.getIdentification()).getIdShort());
}

private Submodel createSubmodel(String idShort, String customId) {
String submodelId = idShort;
Identifier submodelIdentifier = new Identifier(IdentifierType.CUSTOM, customId);
Submodel submodel = new Submodel(submodelId, submodelIdentifier);
return submodel;
}

private ConnectedAssetAdministrationShellManager createConnectedAASManager(IAASAggregator aggregator) {
return new ConnectedAssetAdministrationShellManager(new InMemoryRegistry(), new IConnectorFactory() {

@Override
public IModelProvider getConnector(String addr) {
return new AASAggregatorProvider(aggregator);
}
});
}

@Test
public void testDelete() throws Exception {
IAASAggregator aggregator = getAggregator();
Expand Down

0 comments on commit 9b7f143

Please sign in to comment.