예제 #1
0
  /*
   * PicoContainer
   */
  @Test
  public void picocontainer() {
    final MutablePicoContainer pico = new DefaultPicoContainer();
    pico.registerComponentImplementation(SuperManager.class);
    pico.registerComponentInstance(new OutputManager1(new OutputHelper(new SystemOutOutput())));
    pico.registerComponentInstance(new OutputManager2(new OutputHelper(new LoggerOutput())));
    pico.registerComponentImplementation(ComputationManager.class);
    pico.registerComponentImplementation(ComputationHelper.class);

    final SuperManager mgr = (SuperManager) pico.getComponentInstance(SuperManager.class);
    mgr.manage1();
    mgr.manage2();
  }
  public void testActionContainerCreatedOnlyOncePerRequest() {
    MutablePicoContainer requestContainer = new DefaultPicoContainer();
    requestContainer.registerComponentImplementation(TestService.class);
    MutablePicoContainer actionsContainer = new DefaultPicoContainer(requestContainer);

    requestMock
        .expects(once())
        .method("getAttribute")
        .with(eq(KeyConstants.ACTIONS_CONTAINER))
        .will(returnValue(actionsContainer));
    requestMock
        .expects(once())
        .method("getAttribute")
        .with(eq(KeyConstants.ACTIONS_CONTAINER))
        .will(returnValue(actionsContainer));
    requestMock
        .expects(once())
        .method("setAttribute")
        .with(eq(KeyConstants.ACTIONS_CONTAINER), isA(MutablePicoContainer.class));
    requestMock
        .expects(once())
        .method("getAttribute")
        .with(eq(KeyConstants.REQUEST_CONTAINER))
        .will(returnValue(requestContainer));
    requestMock
        .expects(once())
        .method("getAttribute")
        .with(eq(KeyConstants.ACTIONS_CONTAINER))
        .will(returnValue(null));

    actionFactory.getAction(request, mapping1, servlet);
    actionFactory.getAction(request, mapping1, servlet);
    actionFactory.getAction(request, mapping1, servlet);
  }
예제 #3
0
 /** Registers HgMockVcsHelper as the AbstractVcsHelper. */
 protected HgMockVcsHelper registerMockVcsHelper() {
   final String key = "com.intellij.openapi.vcs.AbstractVcsHelper";
   final MutablePicoContainer picoContainer = (MutablePicoContainer) myProject.getPicoContainer();
   picoContainer.unregisterComponent(key);
   picoContainer.registerComponentImplementation(key, HgMockVcsHelper.class);
   return (HgMockVcsHelper) AbstractVcsHelper.getInstance(myProject);
 }
예제 #4
0
 @Override
 protected void registerBindings(MutablePicoContainer container) {
   super.registerBindings(container);
   // override the binding for GML.BoxType to use the one producing an output Ionic
   // understands
   container.registerComponentImplementation(GML.BoxType, IonicGML2BoxTypeBinding.class);
 }
  protected AbstractEventChannel newEventChannel() {
    final MutablePicoContainer _container = newContainerForChannel();

    _container.registerComponentImplementation(
        AbstractEventChannel.class, TypedEventChannelImpl.class);

    return (AbstractEventChannel) _container.getComponentInstance(AbstractEventChannel.class);
  }
예제 #6
0
 @SuppressWarnings("unchecked")
 public static <T> T overrideService(
     @NotNull Project project, Class<? super T> serviceInterface, Class<T> serviceImplementation) {
   String key = serviceInterface.getName();
   MutablePicoContainer picoContainer = (MutablePicoContainer) project.getPicoContainer();
   picoContainer.unregisterComponent(key);
   picoContainer.registerComponentImplementation(key, serviceImplementation);
   return (T) ServiceManager.getService(project, serviceInterface);
 }
  protected void setUp() throws Exception {
    super.setUp();

    decimal = createAtribute(GML.NAMESPACE, "decimal", XS.STRING, ".");
    ts = createAtribute(GML.NAMESPACE, "ts", XS.STRING, null);
    cs = createAtribute(GML.NAMESPACE, "cs", XS.STRING, null);
    coordinates = createElement(GML.NAMESPACE, "myCoordinates", GML.COORDTYPE, null);
    container = new DefaultPicoContainer();
    container.registerComponentInstance(CoordinateArraySequenceFactory.instance());
    container.registerComponentImplementation(GMLCoordinatesTypeBinding.class);
  }
 protected void configureBindings(org.picocontainer.MutablePicoContainer container) {
   container.registerComponentImplementation(WFS.QueryType, QueryTypeBinding.class);
 }
  protected void registerBindings(MutablePicoContainer container) {
    // Types
    container.registerComponentImplementation(
        SLD.PARAMETERVALUETYPE, SLDParameterValueTypeBinding.class);
    container.registerComponentImplementation(
        SLD.SELECTEDCHANNELTYPE, SLDSelectedChannelTypeBinding.class);
    container.registerComponentImplementation(SLD.SYMBOLIZERTYPE, SLDSymbolizerTypeBinding.class);

    // Elements
    container.registerComponentImplementation(SLD.ANCHORPOINT, SLDAnchorPointBinding.class);
    container.registerComponentImplementation(
        SLD.CHANNELSELECTION, SLDChannelSelectionBinding.class);
    container.registerComponentImplementation(SLD.COLORMAP, SLDColorMapBinding.class);
    container.registerComponentImplementation(SLD.COLORMAPENTRY, SLDColorMapEntryBinding.class);
    container.registerComponentImplementation(
        SLD.CONTRASTENHANCEMENT, SLDContrastEnhancementBinding.class);
    container.registerComponentImplementation(SLD.CSSPARAMETER, SLDCssParameterBinding.class);
    container.registerComponentImplementation(SLD.DISPLACEMENT, SLDDisplacementBinding.class);

    container.registerComponentImplementation(SLD.EXTENT, SLDExtentBinding.class);
    container.registerComponentImplementation(SLD.EXTERNALGRAPHIC, SLDExternalGraphicBinding.class);
    container.registerComponentImplementation(
        SLD.FEATURETYPECONSTRAINT, SLDFeatureTypeConstraintBinding.class);

    container.registerComponentImplementation(
        SLD.FEATURETYPESTYLE, SLDFeatureTypeStyleBinding.class);
    container.registerComponentImplementation(SLD.FILL, SLDFillBinding.class);
    container.registerComponentImplementation(SLD.FONT, SLDFontBinding.class);

    container.registerComponentImplementation(SLD.GEOMETRY, SLDGeometryBinding.class);
    container.registerComponentImplementation(SLD.GRAPHIC, SLDGraphicBinding.class);
    container.registerComponentImplementation(SLD.GRAPHICFILL, SLDGraphicFillBinding.class);
    container.registerComponentImplementation(SLD.GRAPHICSTROKE, SLDGraphicStrokeBinding.class);

    container.registerComponentImplementation(SLD.HALO, SLDHaloBinding.class);

    container.registerComponentImplementation(SLD.IMAGEOUTLINE, SLDImageOutlineBinding.class);

    container.registerComponentImplementation(SLD.LABELPLACEMENT, SLDLabelPlacementBinding.class);

    container.registerComponentImplementation(
        SLD.LAYERFEATURECONSTRAINTS, SLDLayerFeatureConstraintsBinding.class);
    container.registerComponentImplementation(SLD.LEGENDGRAPHIC, SLDLegendGraphicBinding.class);
    container.registerComponentImplementation(SLD.LINEPLACEMENT, SLDLinePlacementBinding.class);
    container.registerComponentImplementation(SLD.LINESYMBOLIZER, SLDLineSymbolizerBinding.class);
    container.registerComponentImplementation(SLD.MARK, SLDMarkBinding.class);

    container.registerComponentImplementation(SLD.NAMEDLAYER, SLDNamedLayerBinding.class);
    container.registerComponentImplementation(SLD.NAMEDSTYLE, SLDNamedStyleBinding.class);

    container.registerComponentImplementation(SLD.ONLINERESOURCE, SLDOnlineResourceBinding.class);

    container.registerComponentImplementation(SLD.OVERLAPBEHAVIOR, SLDOverlapBehaviorBinding.class);
    container.registerComponentImplementation(
        SLD.PERPENDICULAROFFSET, SLDPerpendicularOffsetBinding.class);
    container.registerComponentImplementation(SLD.POINTPLACEMENT, SLDPointPlacementBinding.class);
    container.registerComponentImplementation(SLD.POINTSYMBOLIZER, SLDPointSymbolizerBinding.class);
    container.registerComponentImplementation(
        SLD.POLYGONSYMBOLIZER, SLDPolygonSymbolizerBinding.class);

    container.registerComponentImplementation(
        SLD.RASTERSYMBOLIZER, SLDRasterSymbolizerBinding.class);

    container.registerComponentImplementation(SLD.REMOTEOWS, SLDRemoteOWSBinding.class);

    container.registerComponentImplementation(SLD.RULE, SLDRuleBinding.class);

    container.registerComponentImplementation(SLD.SHADEDRELIEF, SLDShadedReliefBinding.class);

    container.registerComponentImplementation(SLD.STROKE, SLDStrokeBinding.class);
    container.registerComponentImplementation(
        SLD.STYLEDLAYERDESCRIPTOR, SLDStyledLayerDescriptorBinding.class);
    container.registerComponentImplementation(SLD.SYMBOLIZER, SLDSymbolizerBinding.class);
    container.registerComponentImplementation(SLD.TEXTSYMBOLIZER, SLDTextSymbolizerBinding.class);

    container.registerComponentImplementation(SLD.USERLAYER, SLDUserLayerBinding.class);
    container.registerComponentImplementation(SLD.USERSTYLE, SLDUserStyleBinding.class);
  }
  /**
   * Configures the sld context.
   *
   * <p>The following factories are registered:
   *
   * <ul>
   *   <li>{@link StyleFactoryImpl.class} under {@link StyleFactory.class}
   * </ul>
   */
  protected void configureContext(MutablePicoContainer container) {
    super.configureContext(container);

    container.registerComponentImplementation(StyleFactory.class, StyleFactoryImpl.class);
  }
예제 #11
0
 /**
  * Registers the bindings for the configuration.
  *
  * @generated
  */
 protected final void registerBindings(MutablePicoContainer container) {
   // Types
   container.registerComponentImplementation(WFS.ActionType, ActionTypeBinding.class);
   container.registerComponentImplementation(WFS.AllSomeType, AllSomeTypeBinding.class);
   container.registerComponentImplementation(
       WFS.Base_TypeNameListType, Base_TypeNameListTypeBinding.class);
   container.registerComponentImplementation(WFS.BaseRequestType, BaseRequestTypeBinding.class);
   container.registerComponentImplementation(
       WFS.DeleteElementType, DeleteElementTypeBinding.class);
   container.registerComponentImplementation(
       WFS.DescribeFeatureTypeType, DescribeFeatureTypeTypeBinding.class);
   container.registerComponentImplementation(
       WFS.FeaturesLockedType, FeaturesLockedTypeBinding.class);
   container.registerComponentImplementation(
       WFS.FeaturesNotLockedType, FeaturesNotLockedTypeBinding.class);
   container.registerComponentImplementation(
       WFS.FeatureTypeListType, FeatureTypeListTypeBinding.class);
   container.registerComponentImplementation(WFS.FeatureTypeType, FeatureTypeTypeBinding.class);
   container.registerComponentImplementation(
       WFS.GetCapabilitiesType, GetCapabilitiesTypeBinding.class);
   container.registerComponentImplementation(WFS.GetFeatureType, GetFeatureTypeBinding.class);
   container.registerComponentImplementation(
       WFS.GetFeatureWithLockType, GetFeatureWithLockTypeBinding.class);
   container.registerComponentImplementation(WFS.GetGmlObjectType, GetGmlObjectTypeBinding.class);
   container.registerComponentImplementation(
       WFS.GMLObjectTypeListType, GMLObjectTypeListTypeBinding.class);
   container.registerComponentImplementation(
       WFS.GMLObjectTypeType, GMLObjectTypeTypeBinding.class);
   container.registerComponentImplementation(
       WFS.IdentifierGenerationOptionType, IdentifierGenerationOptionTypeBinding.class);
   container.registerComponentImplementation(
       WFS.InsertedFeatureType, InsertedFeatureTypeBinding.class);
   container.registerComponentImplementation(
       WFS.InsertElementType, InsertElementTypeBinding.class);
   container.registerComponentImplementation(WFS.LockFeatureType, LockFeatureTypeBinding.class);
   container.registerComponentImplementation(WFS.LockType, LockTypeBinding.class);
   container.registerComponentImplementation(WFS.MetadataURLType, MetadataURLTypeBinding.class);
   container.registerComponentImplementation(WFS.NativeType, NativeTypeBinding.class);
   container.registerComponentImplementation(WFS.OperationType, OperationTypeBinding.class);
   container.registerComponentImplementation(
       WFS.OutputFormatListType, OutputFormatListTypeBinding.class);
   container.registerComponentImplementation(WFS.PropertyType, PropertyTypeBinding.class);
   container.registerComponentImplementation(WFS.QueryType, QueryTypeBinding.class);
   container.registerComponentImplementation(WFS.ResultTypeType, ResultTypeTypeBinding.class);
   container.registerComponentImplementation(
       WFS.TransactionSummaryType, TransactionSummaryTypeBinding.class);
   container.registerComponentImplementation(WFS.TransactionType, TransactionTypeBinding.class);
   container.registerComponentImplementation(WFS.TypeNameListType, TypeNameListTypeBinding.class);
   container.registerComponentImplementation(
       WFS.UpdateElementType, UpdateElementTypeBinding.class);
   container.registerComponentImplementation(
       WFS.WFS_CapabilitiesType, WFS_CapabilitiesTypeBinding.class);
   container.registerComponentImplementation(
       WFS._XlinkPropertyName, _XlinkPropertyNameBinding.class);
   container.registerComponentImplementation(
       WFS.FeatureTypeType_NoSRS, FeatureTypeType_NoSRSBinding.class);
 }
예제 #12
0
 /** Registers an instance of {@link ObjectFactory}. */
 protected void configureContext(MutablePicoContainer context) {
   context.registerComponentImplementation(ObjectFactory.class);
 }