Examples of BasicComponent


Examples of com.atlassian.jira.rest.client.domain.BasicComponent


  @Test
  @JiraBuildNumberDependent(BN_JIRA_4_4)
  public void testUpdateComponent() {
    final BasicComponent basicComponent = Iterables.get(client.getProjectClient().getProject("TST", pm).getComponents(), 0);
    final Component component = client.getComponentClient().getComponent(basicComponent.getSelf(), pm);
    final String newName = basicComponent.getName() + "updated";
    Component adjustedComponent = new Component(component.getSelf(), component.getId(), newName, component.getDescription(), component.getLead(), component.getAssigneeInfo());

    Component updatedComponent = client.getComponentClient().updateComponent(basicComponent.getSelf(), new ComponentInput(newName, null, null, null), pm);
    assertEquals(adjustedComponent, updatedComponent);
    assertEquals(adjustedComponent, client.getComponentClient().getComponent(basicComponent.getSelf(), pm));

    final String newDescription = "updated description";
    adjustedComponent = new Component(component.getSelf(), component.getId(), newName, newDescription, IntegrationTestUtil.USER1_LATEST, component.getAssigneeInfo());
    updatedComponent = client.getComponentClient().updateComponent(basicComponent.getSelf(), new ComponentInput(null, newDescription, IntegrationTestUtil.USER1.getName(), null), pm);
    assertEquals(adjustedComponent, updatedComponent);

    adjustedComponent = new Component(component.getSelf(), component.getId(), newName, newDescription, IntegrationTestUtil.USER1_LATEST,
        new Component.AssigneeInfo(IntegrationTestUtil.USER1_LATEST, AssigneeType.COMPONENT_LEAD, IntegrationTestUtil.USER1_LATEST, AssigneeType.COMPONENT_LEAD, true));

    updatedComponent = client.getComponentClient().updateComponent(basicComponent.getSelf(), new ComponentInput(null, newDescription, IntegrationTestUtil.USER1.getName(), AssigneeType.COMPONENT_LEAD), pm);
    assertEquals(adjustedComponent, updatedComponent);


    // now with non-assignable assignee (thus we are inheriting assignee from project settings and component-level settings are ignored)
    adjustedComponent = new Component(component.getSelf(), component.getId(), newName, newDescription, IntegrationTestUtil.USER2_LATEST,
        new Component.AssigneeInfo(IntegrationTestUtil.USER2_LATEST, AssigneeType.COMPONENT_LEAD, IntegrationTestUtil.USER_ADMIN_LATEST, AssigneeType.PROJECT_DEFAULT, false));

    updatedComponent = client.getComponentClient().updateComponent(basicComponent.getSelf(), new ComponentInput(null, newDescription, IntegrationTestUtil.USER2.getName(), AssigneeType.COMPONENT_LEAD), pm);
    assertEquals(adjustedComponent, updatedComponent);

  }
View Full Code Here

Examples of com.atlassian.jira.rest.client.domain.BasicComponent


  @Test
  @JiraBuildNumberDependent(BN_JIRA_4_4)
  public void testGetComponentRelatedIssuesCount() {
    final BasicComponent bc = findEntityByName(client.getProjectClient().getProject("TST", pm).getComponents(), "Component A");
    assertEquals(1, client.getComponentClient().getComponentRelatedIssuesCount(bc.getSelf(), pm));
    final ComponentInput componentInput = new ComponentInput("my component name", "a description", "admin", AssigneeType.COMPONENT_LEAD);
    final Component component = client.getComponentClient().createComponent("TST", componentInput, pm);
    assertEquals(0, client.getComponentClient().getComponentRelatedIssuesCount(component.getSelf(), pm));

    client.getComponentClient().removeComponent(bc.getSelf(), component.getSelf(), pm);
    assertEquals(1, client.getComponentClient().getComponentRelatedIssuesCount(component.getSelf(), pm));

    // smelly error code/message returned here - JRA-25062
    setAnonymousMode();
    TestUtil.assertErrorCode(Response.Status.NOT_FOUND, IntegrationTestUtil.TESTING_JIRA_5_OR_NEWER ?
                "The component with id 10000 does not exist." : "This user does not have permission to complete this operation.", new Runnable() {
      @Override
      public void run() {
        client.getComponentClient().getComponentRelatedIssuesCount(component.getSelf(), pm);
      }
    });

    setAdmin();
    final BasicComponent restrictedComponent = Iterables.getOnlyElement(client.getProjectClient().getProject("RST", pm).getComponents());
    setUser1();
    TestUtil.assertErrorCode(Response.Status.NOT_FOUND, IntegrationTestUtil.TESTING_JIRA_5_OR_NEWER ?
                "The component with id 10010 does not exist." : "The user wseliga does not have permission to complete this operation.", new Runnable() {
      @Override
      public void run() {
        client.getComponentClient().getComponentRelatedIssuesCount(restrictedComponent.getSelf(), pm);
      }
    });

    setAdmin();
    TestUtil.assertErrorCode(Response.Status.NOT_FOUND, "The component with id " + TestUtil.getLastPathSegment(restrictedComponent.getSelf())
        + "999 does not exist.", new Runnable() {
      @Override
      public void run() {
        client.getComponentClient().getComponentRelatedIssuesCount(TestUtil.toUri(restrictedComponent.getSelf() + "999"), pm);
      }
    });

  }
View Full Code Here

Examples of com.atlassian.jira.rest.client.domain.BasicComponent

    // grab the first component
    final Iterable<Object> allowedValuesForComponents = issueType.getField(IssueFieldId.COMPONENTS_FIELD).getAllowedValues();
    assertNotNull(allowedValuesForComponents);
    assertTrue(allowedValuesForComponents.iterator().hasNext());
    final BasicComponent component = (BasicComponent) allowedValuesForComponents.iterator().next();

    // grab the first priority
    final Iterable<Object> allowedValuesForPriority = issueType.getField(IssueFieldId.PRIORITY_FIELD).getAllowedValues();
    assertNotNull(allowedValuesForPriority);
    assertTrue(allowedValuesForPriority.iterator().hasNext());
    final BasicPriority priority = (BasicPriority) allowedValuesForPriority.iterator().next();

    // build issue input
    final String summary = "My new issue!";
    final String description = "Some description";
    final BasicUser assignee = IntegrationTestUtil.USER1;
    final List<String> affectedVersionsNames = Collections.emptyList();
    final DateTime dueDate = new DateTime(new Date().getTime());
    final ArrayList<String> fixVersionsNames = Lists.newArrayList("1.1");

    // prepare IssueInput
    final IssueInputBuilder issueInputBuilder = new IssueInputBuilder(project, issueType, summary)
        .setDescription(description)
        .setAssignee(assignee)
        .setAffectedVersionsNames(affectedVersionsNames)
        .setFixVersionsNames(fixVersionsNames)
        .setComponents(component)
        .setDueDate(dueDate)
        .setPriority(priority);

    // create
    final BasicIssue basicCreatedIssue = issueClient.createIssue(issueInputBuilder.build(), pm);
    assertNotNull(basicCreatedIssue.getKey());

    // get issue and check if everything was set as we expected
    final Issue createdIssue = issueClient.getIssue(basicCreatedIssue.getKey(), pm);
    assertNotNull(createdIssue);

    assertEquals(basicCreatedIssue.getKey(), createdIssue.getKey());
    assertEquals(project.getKey(), createdIssue.getProject().getKey());
    assertEquals(issueType.getId(), createdIssue.getIssueType().getId());
    assertEquals(summary, createdIssue.getSummary());
    assertEquals(description, createdIssue.getDescription());

    final BasicUser actualAssignee = createdIssue.getAssignee();
    assertNotNull(actualAssignee);
    assertEquals(assignee.getSelf(), actualAssignee.getSelf());

    final Iterable<String> actualAffectedVersionsNames = EntityHelper.toNamesList(createdIssue.getAffectedVersions());
    assertThat(affectedVersionsNames, containsInAnyOrder(toArray(actualAffectedVersionsNames, String.class)));

    final Iterable<String> actualFixVersionsNames = EntityHelper.toNamesList(createdIssue.getFixVersions());
    assertThat(fixVersionsNames, containsInAnyOrder(toArray(actualFixVersionsNames, String.class)));

    assertTrue(createdIssue.getComponents().iterator().hasNext());
    assertEquals(component.getId(), createdIssue.getComponents().iterator().next().getId());

    // strip time from dueDate
    final DateTime expectedDueDate = JsonParseUtil.parseDate(JsonParseUtil.formatDate(dueDate));
    assertEquals(expectedDueDate, createdIssue.getDueDate());
View Full Code Here

Examples of com.atlassian.jira.rest.client.domain.BasicComponent

import org.codehaus.jettison.json.JSONObject;

public class ComponentJsonParser implements JsonParser<Component> {
  @Override
  public Component parse(JSONObject json) throws JSONException {
    final BasicComponent basicComponent = BasicComponentJsonParser.parseBasicComponent(json);
    final JSONObject leadJson = json.optJSONObject("lead");
    final BasicUser lead = leadJson != null ? JsonParseUtil.parseBasicUser(leadJson) : null;
    final String assigneeTypeStr = JsonParseUtil.getOptionalString(json, "assigneeType");
    final Component.AssigneeInfo assigneeInfo;
    if (assigneeTypeStr != null) {
      final AssigneeType assigneeType = parseAssigneeType(assigneeTypeStr);
      final JSONObject assigneeJson = json.optJSONObject("assignee");
      final BasicUser assignee = assigneeJson != null ? JsonParseUtil.parseBasicUser(assigneeJson) : null;
      final AssigneeType realAssigneeType = parseAssigneeType(json.getString("realAssigneeType"));
      final JSONObject realAssigneeJson = json.optJSONObject("realAssignee");
      final BasicUser realAssignee = realAssigneeJson != null ? JsonParseUtil.parseBasicUser(realAssigneeJson) : null;
      final boolean isAssigneeTypeValid = json.getBoolean("isAssigneeTypeValid");
      assigneeInfo = new Component.AssigneeInfo(assignee, assigneeType, realAssignee, realAssigneeType, isAssigneeTypeValid);
    } else {
      assigneeInfo = null;
    }

    return new Component(basicComponent.getSelf(), basicComponent.getId(), basicComponent.getName(), basicComponent.getDescription(), lead, assigneeInfo);
  }
View Full Code Here

Examples of eu.mosaic_cloud.components.implementations.basic.BasicComponent

    Assert.assertTrue (threading.initialize (BasicComponentTest.defaultPollTimeout));
    final BasicCallbackReactor reactor = BasicCallbackReactor.create (threading, exceptions);
    Assert.assertTrue (reactor.initialize (BasicComponentTest.defaultPollTimeout));
    final DefaultChannelMessageCoder coder = DefaultChannelMessageCoder.defaultInstance;
    final BasicChannel channel = BasicChannel.create (pipe.source (), pipe.sink (), coder, reactor, threading, exceptions);
    final BasicComponent component = BasicComponent.create (reactor, exceptions);
    Assert.assertTrue (channel.initialize (BasicComponentTest.defaultPollTimeout));
    Assert.assertTrue (component.initialize (BasicComponentTest.defaultPollTimeout));
    final ComponentController componentController = component.getController ();
    final ComponentCallbacks componentCallbacksProxy = reactor.createProxy (ComponentCallbacks.class);
    Assert.assertTrue (componentController.bind (componentCallbacksProxy, channel.getController ()).await (BasicComponentTest.defaultPollTimeout));
    final QueueingComponentCallbacks componentCallbacks = QueueingComponentCallbacks.create (componentController, exceptions);
    final CallbackIsolate componentCallbacksIsolate = reactor.createIsolate ();
    Assert.assertTrue (reactor.assignHandler (componentCallbacksProxy, componentCallbacks, componentCallbacksIsolate).await (BasicComponentTest.defaultPollTimeout));
    final ComponentIdentifier peer = ComponentIdentifier.resolve (Strings.repeat ("00", 20));
    for (int index = 0; index < BasicComponentTest.defaultTries; index++) {
      final ComponentCallRequest outboundRequest = RandomMessageGenerator.defaultInstance.generateComponentCallRequest ();
      Assert.assertTrue (componentController.call (peer, outboundRequest).await (BasicComponentTest.defaultPollTimeout));
      final ComponentCallRequest inboundRequest = (ComponentCallRequest) componentCallbacks.queue.poll (BasicComponentTest.defaultPollTimeout, TimeUnit.MILLISECONDS);
      Assert.assertNotNull (inboundRequest);
      Assert.assertEquals (outboundRequest.operation, inboundRequest.operation);
      Assert.assertEquals (outboundRequest.inputs, inboundRequest.inputs);
      Assert.assertEquals (outboundRequest.data, inboundRequest.data);
      final ComponentCallReply outboundReply = RandomMessageGenerator.defaultInstance.generateComponentCallReply (inboundRequest);
      Assert.assertTrue (componentController.callReturn (outboundReply).await (BasicComponentTest.defaultPollTimeout));
      final ComponentCallReply inboundReply = (ComponentCallReply) componentCallbacks.queue.poll (BasicComponentTest.defaultPollTimeout, TimeUnit.MILLISECONDS);
      Assert.assertNotNull (inboundReply);
      Assert.assertEquals (outboundRequest.reference, inboundReply.reference);
      Assert.assertEquals (outboundRequest.inputs, inboundReply.outputsOrError);
      Assert.assertEquals (outboundRequest.data, inboundReply.data);
    }
    pipe.sink ().close ();
    Assert.assertTrue (component.await (BasicComponentTest.defaultPollTimeout * 10));
    Assert.assertTrue (component.destroy (BasicComponentTest.defaultPollTimeout));
    Assert.assertTrue (channel.destroy (BasicComponentTest.defaultPollTimeout));
    Assert.assertTrue (componentCallbacksIsolate.destroy ().await (BasicComponentTest.defaultPollTimeout));
    Assert.assertTrue (reactor.destroy (BasicComponentTest.defaultPollTimeout));
    Assert.assertTrue (threading.destroy (BasicComponentTest.defaultPollTimeout));
    Assert.assertNull (exceptionsQueue.queue.poll ());
View Full Code Here

Examples of eu.mosaic_cloud.components.implementations.basic.BasicComponent

    final BasicCallbackReactor reactor = BasicCallbackReactor.create (threading, exceptions);
    Assert.assertTrue (reactor.initialize (AbacusTest.defaultPollTimeout));
    final DefaultChannelMessageCoder coder = DefaultChannelMessageCoder.defaultInstance;
    final BasicChannel serverChannel = BasicChannel.create (pipe1.source (), pipe2.sink (), coder, reactor, threading, exceptions);
    final BasicChannel clientChannel = BasicChannel.create (pipe2.source (), pipe1.sink (), coder, reactor, threading, exceptions);
    final BasicComponent serverComponent = BasicComponent.create (reactor, exceptions);
    final BasicComponent clientComponent = BasicComponent.create (reactor, exceptions);
    Assert.assertTrue (serverChannel.initialize (AbacusTest.defaultPollTimeout));
    Assert.assertTrue (clientChannel.initialize (AbacusTest.defaultPollTimeout));
    Assert.assertTrue (serverComponent.initialize (AbacusTest.defaultPollTimeout));
    Assert.assertTrue (clientComponent.initialize (AbacusTest.defaultPollTimeout));
    final ComponentController serverComponentController = serverComponent.getController ();
    final ComponentController clientComponentController = clientComponent.getController ();
    final ComponentCallbacks serverComponentCallbacksProxy = reactor.createProxy (ComponentCallbacks.class);
    final ComponentCallbacks clientComponentCallbacksProxy = reactor.createProxy (ComponentCallbacks.class);
    Assert.assertTrue (serverComponentController.bind (serverComponentCallbacksProxy, serverChannel.getController ()).await (AbacusTest.defaultPollTimeout));
    Assert.assertTrue (clientComponentController.bind (clientComponentCallbacksProxy, clientChannel.getController ()).await (AbacusTest.defaultPollTimeout));
    final AbacusComponentCallbacks serverComponentCallbacks = new AbacusComponentCallbacks (ComponentEnvironment.create (ComponentIdentifier.standalone, this.getClass ().getClassLoader (), reactor, threading, exceptions));
    final QueueingComponentCallbacks clientComponentCallbacks = QueueingComponentCallbacks.create (clientComponentController, exceptions);
    final CallbackIsolate serverComponentCallbacksIsolate = reactor.createIsolate ();
    final CallbackIsolate clientComponentCallbacksIsolate = reactor.createIsolate ();
    Assert.assertTrue (reactor.assignHandler (serverComponentCallbacksProxy, serverComponentCallbacks, serverComponentCallbacksIsolate).await (AbacusTest.defaultPollTimeout));
    Assert.assertTrue (reactor.assignHandler (clientComponentCallbacksProxy, clientComponentCallbacks, clientComponentCallbacksIsolate).await (AbacusTest.defaultPollTimeout));
    final ComponentIdentifier peer = ComponentIdentifier.resolve (Strings.repeat ("00", 20));
    for (int index = 0; index < AbacusTest.defaultTries; index++) {
      final double operandA = (int) (Math.random () * 10);
      final double operandB = (int) (Math.random () * 10);
      final ComponentCallRequest request = ComponentCallRequest.create ("+", Arrays.asList (Double.valueOf (operandA), Double.valueOf (operandB)), ByteBuffer.allocate (0), ComponentCallReference.create ());
      Assert.assertTrue (clientComponentController.call (peer, request).await (AbacusTest.defaultPollTimeout));
      final ComponentCallReply reply = (ComponentCallReply) clientComponentCallbacks.queue.poll (AbacusTest.defaultPollTimeout, TimeUnit.MILLISECONDS);
      Assert.assertNotNull (reply);
      Assert.assertTrue (reply.ok);
      Assert.assertNotNull (reply.outputsOrError);
      Assert.assertEquals (request.reference, reply.reference);
      Assert.assertTrue ((operandA + operandB) == ((Number) reply.outputsOrError).doubleValue ());
    }
    pipe1.sink ().close ();
    pipe2.sink ().close ();
    Assert.assertTrue (serverComponent.await (AbacusTest.defaultPollTimeout));
    Assert.assertTrue (clientComponent.await (AbacusTest.defaultPollTimeout));
    Assert.assertTrue (serverComponent.destroy (AbacusTest.defaultPollTimeout));
    Assert.assertTrue (clientComponent.destroy (AbacusTest.defaultPollTimeout));
    Assert.assertTrue (serverChannel.destroy (AbacusTest.defaultPollTimeout));
    Assert.assertTrue (clientChannel.destroy (AbacusTest.defaultPollTimeout));
    Assert.assertTrue (serverComponentCallbacksIsolate.destroy ().await (AbacusTest.defaultPollTimeout));
    Assert.assertTrue (clientComponentCallbacksIsolate.destroy ().await (AbacusTest.defaultPollTimeout));
    Assert.assertTrue (reactor.destroy (AbacusTest.defaultPollTimeout));
View Full Code Here

Examples of net.sf.wicketdemo.app.wicketpages.component.BasicComponent

/**
* @author Dieter D'haeyere
*/
public class BasicComponentPage extends BaseWebPage {
    public BasicComponentPage() {
        add(new BasicComponent("basicComponent"));
    }
View Full Code Here

Examples of org.jboss.as.ee.component.BasicComponent

                if (!isEjb3Endpoint) {
                    // only POJO endpoints have to be initialized. EJB3 endpoints are handled by the EJB3 subsystem.
                    final ServiceName endpointComponentName = getEndpointComponentServiceName();
                    final ServiceController<BasicComponent> endpointController = getComponentController(endpointComponentName);
                    if (endpointController != null) {
                        final BasicComponent endpointComponent = endpointController.getValue();
                        final ComponentInstance endpointComponentInstance = endpointComponent.createInstance(delegate.getInstance(className).getValue());
                        final Object endpointInstance = endpointComponentInstance.getInstance();
                        // mark reference as initialized because JBoss server initialized it
                        final Reference endpointReference = ReferenceFactory.newInitializedReference(endpointInstance);
                        return cacheAndGet(endpointReference);
                    }
                }
            } else {
                // handle JAXWS handler instantiation
                final ServiceName handlerComponentName = getHandlerComponentServiceName(className);
                final ServiceController<BasicComponent> handlerComponentController = getComponentController(handlerComponentName);
                if (handlerComponentController != null) {
                    // we support initialization only on non system JAXWS handlers
                    final BasicComponent handlerComponent = handlerComponentController.getValue();
                    final ComponentInstance handlerComponentInstance = handlerComponent.createInstance(delegate.getInstance(className).getValue());
                    final Object handlerInstance = handlerComponentInstance.getInstance();
                    // mark reference as initialized because JBoss server initialized it
                    final Reference handlerReference = ReferenceFactory.newInitializedReference(handlerInstance);
                    return cacheAndGet(handlerReference);
                }
View Full Code Here

Examples of org.jboss.as.ee.component.BasicComponent

                // handle JAXWS handler instantiation
                final ServiceName handlerComponentName = getHandlerComponentServiceName(className);
                final ServiceController<BasicComponent> handlerComponentController = getComponentController(handlerComponentName);
                if (handlerComponentController != null) {
                    // we support initialization only on non system JAXWS handlers
                    final BasicComponent handlerComponent = handlerComponentController.getValue();
                    final ComponentInstance handlerComponentInstance = handlerComponent.createInstance(delegate.getInstance(className).getValue());
                    final Object handlerInstance = handlerComponentInstance.getInstance();
                    // mark reference as initialized because JBoss server initialized it
                    final Reference handlerReference = ReferenceFactory.newInitializedReference(handlerInstance);
                    return cacheAndGet(handlerReference);
                }
View Full Code Here

Examples of org.jboss.as.ee.component.BasicComponent

                if (!isEjb3Endpoint) {
                    // only POJO endpoints have to be initialized. EJB3 endpoints are handled by the EJB3 susbystem.
                    final ServiceName endpointComponentName = getEndpointComponentServiceName();
                    final ServiceController<BasicComponent> endpointController = getComponentController(endpointComponentName);
                    if (endpointController != null) {
                        final BasicComponent endpointComponent = endpointController.getValue();
                        final ComponentInstance endpointComponentInstance = endpointComponent.createInstance(delegate.getInstance(className).getValue());
                        final Object endpointInstance = endpointComponentInstance.getInstance();
                        // mark reference as initialized because JBoss server initialized it
                        final Reference endpointReference = ReferenceFactory.newInitializedReference(endpointInstance);
                        return cacheAndGet(endpointReference);
                    }
                }
            } else {
                // handle JAXWS handler instantiation
                final ServiceName handlerComponentName = getHandlerComponentServiceName(className);
                final ServiceController<BasicComponent> handlerComponentController = getComponentController(handlerComponentName);
                if (handlerComponentController != null) {
                    // we support initialization only on non system JAXWS handlers
                    final BasicComponent handlerComponent = handlerComponentController.getValue();
                    final ComponentInstance handlerComponentInstance = handlerComponent.createInstance(delegate.getInstance(className).getValue());
                    final Object handlerInstance = handlerComponentInstance.getInstance();
                    // mark reference as initialized because JBoss server initialized it
                    final Reference handlerReference = ReferenceFactory.newInitializedReference(handlerInstance);
                    return cacheAndGet(handlerReference);
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.