Tabnine Logo
ConnectorInstance.fetchCurrentToken
Code IndexAdd Tabnine to your IDE (free)

How to use
fetchCurrentToken
method
in
com.evolveum.midpoint.provisioning.ucf.api.ConnectorInstance

Best Java code snippets using com.evolveum.midpoint.provisioning.ucf.api.ConnectorInstance.fetchCurrentToken (Showing top 4 results out of 315)

origin: Evolveum/midpoint

@Test
public void test100FetchEmptyChanges() throws Exception {
  final String TEST_NAME = "test100FetchEmptyChanges";
  TestUtil.displayTestTitle(this, TEST_NAME);
  OperationResult result = new OperationResult(this.getClass().getName() + "." + TEST_NAME);
  ObjectClassComplexTypeDefinition accountDefinition = resourceSchema.findDefaultObjectClassDefinition(ShadowKindType.ACCOUNT);
  // WHEN
  PrismProperty<Integer> lastToken = cc.fetchCurrentToken(accountDefinition, null, result);
  assertNotNull("No last sync token", lastToken);
  System.out.println("Property:");
  System.out.println(lastToken.debugDump());
  PrismPropertyDefinition<Integer> lastTokenDef = lastToken.getDefinition();
  assertNotNull("No last sync token definition", lastTokenDef);
  assertEquals("Last sync token definition has wrong type", DOMUtil.XSD_INT, lastTokenDef.getTypeName());
  assertTrue("Last sync token definition is NOT dynamic", lastTokenDef.isDynamic());
  // WHEN
  List<Change> changes = cc.fetchChanges(accountDefinition, lastToken, null, null, result);
  AssertJUnit.assertEquals(0, changes.size());
}
origin: Evolveum/midpoint

@SuppressWarnings("rawtypes")
public PrismProperty fetchCurrentToken(ProvisioningContext ctx, OperationResult parentResult)
    throws ObjectNotFoundException, CommunicationException, SchemaException, ConfigurationException, ExpressionEvaluationException {
  Validate.notNull(parentResult, "Operation result must not be null.");
  LOGGER.trace("Fetcing current sync token for {}", ctx);
  
  PrismProperty lastToken;
  ConnectorInstance connector = ctx.getConnector(LiveSyncCapabilityType.class, parentResult);
  try {
    lastToken = connector.fetchCurrentToken(ctx.getObjectClassDefinition(), ctx, parentResult);
  } catch (GenericFrameworkException e) {
    parentResult.recordFatalError("Generic error in the connector: " + e.getMessage(), e);
    throw new CommunicationException("Generic error in the connector: " + e.getMessage(), e);
  } catch (CommunicationException ex) {
    parentResult.recordFatalError(
        "Error communicating with the connector " + connector + ": " + ex.getMessage(), ex);
    throw new CommunicationException("Error communicating with the connector " + connector + ": "
        + ex.getMessage(), ex);
  }
  LOGGER.trace("Got last token: {}", SchemaDebugUtil.prettyPrint(lastToken));
  
  computeResultStatus(parentResult);
  
  return lastToken;
}
origin: Evolveum/midpoint

@Test
public void test200FetchChanges() throws Exception {
  final String TEST_NAME = "test200FetchChanges";
  TestUtil.displayTestTitle(this, TEST_NAME);
  OperationResult result = new OperationResult(this.getClass().getName() + "." + TEST_NAME);
  ObjectClassComplexTypeDefinition accountDefinition = resourceSchema.findObjectClassDefinition(OpenDJController.OBJECT_CLASS_INETORGPERSON_NAME);
  PrismProperty<Integer> lastToken = cc.fetchCurrentToken(accountDefinition, null, result);
  System.out.println("Property:");
  System.out.println(SchemaDebugUtil.prettyPrint(lastToken));
  System.out.println("token " + lastToken.toString());
  assertNotNull("No last token", lastToken);
  assertNotNull("No last token value", lastToken.getRealValue());
  List<Change> changes = cc.fetchChanges(accountDefinition, lastToken, null, null, result);
  display("Changes", changes);
  // Just one pseudo-change that updates the token
  AssertJUnit.assertEquals(1, changes.size());
  Change change = changes.get(0);
  assertNull(change.getCurrentShadow());
  assertNull(change.getIdentifiers());
  assertNull(change.getObjectDelta());
  assertNotNull(change.getToken());
}
origin: Evolveum/midpoint

@Test
public void test101FetchAddChange() throws Exception {
  final String TEST_NAME = "test101FetchAddChange";
  TestUtil.displayTestTitle(this, TEST_NAME);
  OperationResult result = new OperationResult(this.getClass().getName() + "." + TEST_NAME);
  ObjectClassComplexTypeDefinition accountDefinition = resourceSchema.findDefaultObjectClassDefinition(ShadowKindType.ACCOUNT);
  PrismProperty<?> lastToken = cc.fetchCurrentToken(accountDefinition, null, result);
  assertNotNull("No last sync token", lastToken);
  // Add account to the resource
  dummyResource.setSyncStyle(DummySyncStyle.DUMB);
  DummyAccount newAccount = new DummyAccount("blackbeard");
  newAccount.addAttributeValues("fullname", "Edward Teach");
  newAccount.setEnabled(true);
  newAccount.setPassword("shiverMEtimbers");
  dummyResource.addAccount(newAccount);
  // WHEN
  List<Change> changes = cc.fetchChanges(accountDefinition, lastToken, null, null, result);
  AssertJUnit.assertEquals(1, changes.size());
  Change change = changes.get(0);
  assertNotNull("null change", change);
  PrismObject<ShadowType> currentShadow = change.getCurrentShadow();
  assertNotNull("null current shadow", currentShadow);
  PrismAsserts.assertParentConsistency(currentShadow);
  Collection<ResourceAttribute<?>> identifiers = change.getIdentifiers();
  assertNotNull("null identifiers", identifiers);
  assertFalse("empty identifiers", identifiers.isEmpty());
}
com.evolveum.midpoint.provisioning.ucf.apiConnectorInstancefetchCurrentToken

Javadoc

Returns the latest token. In other words, returns a token that corresponds to a current state of the resource. If fetchChanges is immediately called with this token, nothing should be returned (Figuratively speaking, neglecting concurrent resource modifications).

Popular methods of ConnectorInstance

  • test
  • addObject
    TODO: This should return indication how the operation went, e.g. what changes were applied, what wer
  • configure
    The connector instance will be configured to the state that it can immediately access the resource.
  • deleteObject
  • fetchCapabilities
    Retrieves native connector capabilities. The capabilities specify what the connector can do without
  • fetchChanges
    Token may be null. That means "from the beginning of history".
  • fetchObject
    Retrieves a specific object from the resource. This method is fetching an object from the resource t
  • fetchResourceSchema
    Retrieves the schema from the resource. The schema may be considered to be an XSD schema, but it is
  • getOperationalStatus
  • initialize
    Get necessary information from the remote system. This method will initialize the configured connect
  • modifyObject
    TODO: This should return indication how the operation went, e.g. what changes were applied, what wer
  • search
    Execute iterative search operation. This method will execute search operation on the resource and wi
  • modifyObject,
  • search,
  • count,
  • dispose,
  • executeScript

Popular in Java

  • Finding current android device location
  • setScale (BigDecimal)
  • getContentResolver (Context)
  • runOnUiThread (Activity)
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now