[CRV-12] Initial commit

parents
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.tirasa.connid</groupId>
<artifactId>connid</artifactId>
<version>1.4.3.0-SNAPSHOT</version>
</parent>
<groupId>eu.chorevolution</groupId>
<artifactId>connid-federation-server</artifactId>
<version>0.1-SNAPSHOT</version>
<name>ConnId Federation Server Bundle</name>
<packaging>jar</packaging>
<properties>
<connid.version>1.4.3.0-SNAPSHOT</connid.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>net.tirasa.connid</groupId>
<artifactId>connector-framework</artifactId>
<version>${connid.version}</version>
</dependency>
<dependency>
<groupId>net.tirasa.connid</groupId>
<artifactId>connector-framework-internal</artifactId>
<version>${connid.version}</version>
</dependency>
<!-- TEST -->
<dependency>
<groupId>net.tirasa.connid</groupId>
<artifactId>connector-test-common</artifactId>
<version>${connid.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Disable any licese check -->
<plugin>
<groupId>com.mycila.maven-license-plugin</groupId>
<artifactId>maven-license-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<skip>true</skip>
</configuration>
<executions>
<execution>
<id>copy-javadoc-legal-files</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>ianal-maven-plugin</artifactId>
<inherited>true</inherited>
<executions>
<execution>
<goals>
<goal>verify-legal-files</goal>
</goals>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<appendAssemblyId>true</appendAssemblyId>
<descriptors>
<descriptor>src/assemble/connector.xml</descriptor>
</descriptors>
<archive>
<index>true</index>
<manifestEntries>
<ConnectorBundle-FrameworkVersion>${connid.version}</ConnectorBundle-FrameworkVersion>
<ConnectorBundle-Name>${project.artifactId}</ConnectorBundle-Name>
<ConnectorBundle-Version>${project.version}</ConnectorBundle-Version>
</manifestEntries>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
</snapshots>
</repository>
</repositories>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>bundle</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.build.directory}/classes</directory>
<outputDirectory></outputDirectory>
</fileSet>
</fileSets>
</assembly>
package eu.chorevolution.connid.federationserver;
import org.identityconnectors.common.StringUtil;
import org.identityconnectors.framework.common.exceptions.ConfigurationException;
import org.identityconnectors.framework.spi.AbstractConfiguration;
import org.identityconnectors.framework.spi.ConfigurationProperty;
public class FederationServerConfiguration extends AbstractConfiguration {
private String sampleProperty = "SAMPLE VALUE";
@ConfigurationProperty(displayMessageKey = "sampleProperty.display",
helpMessageKey = "sampleProperty.help", order = 1)
public String getSampleProperty() {
return sampleProperty;
}
public void setSampleProperty(String sampleProperty) {
this.sampleProperty = sampleProperty;
}
@Override
public void validate() {
if (StringUtil.isBlank(sampleProperty)) {
throw new ConfigurationException("sampleProperty must not be blank!");
}
}
}
package eu.chorevolution.connid.federationserver;
import java.util.Collections;
import java.util.Set;
import java.util.UUID;
import org.identityconnectors.common.logging.Log;
import org.identityconnectors.common.security.GuardedString;
import org.identityconnectors.framework.api.operations.APIOperation;
import org.identityconnectors.framework.api.operations.ResolveUsernameApiOp;
import org.identityconnectors.framework.common.objects.Attribute;
import org.identityconnectors.framework.common.objects.ObjectClass;
import org.identityconnectors.framework.common.objects.ObjectClassInfo;
import org.identityconnectors.framework.common.objects.OperationOptionInfo;
import org.identityconnectors.framework.common.objects.OperationOptions;
import org.identityconnectors.framework.common.objects.ResultsHandler;
import org.identityconnectors.framework.common.objects.Schema;
import org.identityconnectors.framework.common.objects.SyncResultsHandler;
import org.identityconnectors.framework.common.objects.SyncToken;
import org.identityconnectors.framework.common.objects.Uid;
import org.identityconnectors.framework.common.objects.filter.AbstractFilterTranslator;
import org.identityconnectors.framework.common.objects.filter.FilterTranslator;
import org.identityconnectors.framework.spi.Configuration;
import org.identityconnectors.framework.spi.Connector;
import org.identityconnectors.framework.spi.ConnectorClass;
import org.identityconnectors.framework.spi.operations.AuthenticateOp;
import org.identityconnectors.framework.spi.operations.CreateOp;
import org.identityconnectors.framework.spi.operations.DeleteOp;
import org.identityconnectors.framework.spi.operations.SchemaOp;
import org.identityconnectors.framework.spi.operations.SearchOp;
import org.identityconnectors.framework.spi.operations.SyncOp;
import org.identityconnectors.framework.spi.operations.TestOp;
import org.identityconnectors.framework.spi.operations.UpdateAttributeValuesOp;
import org.identityconnectors.framework.spi.operations.UpdateOp;
/**
* This sample connector provides (empty) implementations for all ConnId operations, but this is not mandatory: any
* connector can choose which operations are actually to be implemented.
*/
@ConnectorClass(configurationClass = FederationServerConfiguration.class, displayNameKey = "sample.connector.display")
public class FederationServerConnector implements Connector,
CreateOp, UpdateOp, UpdateAttributeValuesOp, DeleteOp,
AuthenticateOp, ResolveUsernameApiOp, SchemaOp, SyncOp, TestOp, SearchOp<FederationServerFilter> {
private static final Log LOG = Log.getLog(FederationServerConnector.class);
private FederationServerConfiguration configuration;
@Override
public FederationServerConfiguration getConfiguration() {
return configuration;
}
@Override
public void init(final Configuration configuration) {
this.configuration = (FederationServerConfiguration) configuration;
LOG.ok("Connector {0} successfully inited", getClass().getName());
}
@Override
public void dispose() {
// dispose of any resources the this connector uses.
}
@Override
public Uid create(
final ObjectClass objectClass,
final Set<Attribute> createAttributes,
final OperationOptions options) {
return new Uid(UUID.randomUUID().toString());
}
@Override
public Uid update(
final ObjectClass objectClass,
final Uid uid,
final Set<Attribute> replaceAttributes,
final OperationOptions options) {
return uid;
}
@Override
public Uid addAttributeValues(
final ObjectClass objclass,
final Uid uid,
final Set<Attribute> valuesToAdd,
final OperationOptions options) {
return uid;
}
@Override
public Uid removeAttributeValues(
final ObjectClass objclass,
final Uid uid,
final Set<Attribute> valuesToRemove,
final OperationOptions options) {
return uid;
}
@Override
public void delete(
final ObjectClass objectClass,
final Uid uid,
final OperationOptions options) {
}
@Override
public Uid authenticate(
final ObjectClass objectClass,
final String username,
final GuardedString password,
final OperationOptions options) {
return new Uid(username);
}
@Override
public Uid resolveUsername(
final ObjectClass objectClass,
final String username,
final OperationOptions options) {
return new Uid(username);
}
@Override
public Schema schema() {
return new Schema(
Collections.<ObjectClassInfo>emptySet(),
Collections.<OperationOptionInfo>emptySet(),
Collections.<Class<? extends APIOperation>, Set<ObjectClassInfo>>emptyMap(),
Collections.<Class<? extends APIOperation>, Set<OperationOptionInfo>>emptyMap());
}
@Override
public void sync(
final ObjectClass objectClass,
final SyncToken token,
final SyncResultsHandler handler,
final OperationOptions options) {
}
@Override
public SyncToken getLatestSyncToken(final ObjectClass objectClass) {
return new SyncToken(null);
}
@Override
public void test() {
}
@Override
public FilterTranslator<FederationServerFilter> createFilterTranslator(
final ObjectClass objectClass,
final OperationOptions options) {
return new AbstractFilterTranslator<FederationServerFilter>() {
};
}
@Override
public void executeQuery(
final ObjectClass objectClass,
final FederationServerFilter query,
final ResultsHandler handler,
final OperationOptions options) {
}
}
package eu.chorevolution.connid.federationserver;
/**
* This implementation depends on the logic that this connector follows.
*/
public class FederationServerFilter {
}
sampleProperty.display=Sampe Property
sampleProperty.help=Only a sample property
sample.connector.display=Sample Connector
sampleProperty.display=Propriet\u00e0 d'esempio
sampleProperty.help=Solo una propriet\u00e0 d'esempio
sample.connector.display=Connettore d'esempio
package eu.chorevolution.connid.federationserver;
import static org.junit.Assert.assertNotNull;
import java.util.Collections;
import org.identityconnectors.framework.api.APIConfiguration;
import org.identityconnectors.framework.api.ConnectorFacade;
import org.identityconnectors.framework.api.ConnectorFacadeFactory;
import org.identityconnectors.framework.common.objects.Attribute;
import org.identityconnectors.framework.common.objects.ObjectClass;
import org.identityconnectors.framework.common.objects.OperationOptionsBuilder;
import org.identityconnectors.framework.common.objects.Uid;
import org.identityconnectors.test.common.TestHelpers;
import org.junit.Test;
import static org.junit.Assert.assertNotNull;
public class FederationServerTests {
protected FederationServerConfiguration newConfiguration() {
return new FederationServerConfiguration();
}
protected ConnectorFacade newFacade() {
ConnectorFacadeFactory factory = ConnectorFacadeFactory.getInstance();
APIConfiguration impl = TestHelpers.createTestConfiguration(FederationServerConnector.class, newConfiguration());
impl.getResultsHandlerConfiguration().setFilteredResultsHandlerInValidationMode(true);
return factory.newInstance(impl);
}
@Test
public void basic() {
Uid created = newFacade().create(
ObjectClass.ACCOUNT,
Collections.<Attribute>emptySet(),
new OperationOptionsBuilder().build());
assertNotNull(created);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment