Package jenkins.model

Examples of jenkins.model.Jenkins


    @Override public hudson.model.BuildAuthorizationToken getAuthToken() {
        return authToken;
    }

    @Override public int getQuietPeriod() {
        Jenkins j = Jenkins.getInstance();
        if (j == null) {
            throw new IllegalStateException("Jenkins is not running");
        }
        return quietPeriod != null ? quietPeriod : j.getQuietPeriod();
    }
View Full Code Here


    @Override public Authentication getDefaultAuthentication() {
        return ACL.SYSTEM;
    }

    @Override public Label getAssignedLabel() {
        Jenkins j = Jenkins.getInstance();
        if (j == null) {
            return null;
        }
        return j.getSelfLabel();
    }
View Full Code Here

    @Override public String getPronoun() {
        return AlternativeUiTextProvider.get(PRONOUN, this, "Workflow");
    }

    @Override public TopLevelItemDescriptor getDescriptor() {
        Jenkins j = Jenkins.getInstance();
        if (j == null) {
            throw new IllegalStateException("Jenkins is not running");
        }
        return (DescriptorImpl) j.getDescriptorOrDie(WorkflowJob.class);
    }
View Full Code Here

            try {
                FilePath workspace;
                Launcher launcher;
                WorkspaceList.Lease lease;
                if (co.scm.requiresWorkspaceForPolling()) {
                    Jenkins j = Jenkins.getInstance();
                    if (j == null) {
                        listener.error("Jenkins is shutting down");
                        continue;
                    }
                    Computer c = j.getComputer(co.node);
                    if (c == null) {
                        listener.error("no such computer " + co.node);
                        continue;
                    }
                    workspace = new FilePath(c.getChannel(), co.workspace);
View Full Code Here

    /**
     * Creates an {@link Injector} that performs injection to {@link Inject} and {@link StepContextParameter}.
     */
    protected static Injector prepareInjector(final StepContext context, @Nullable final Step step) {
        Jenkins j = Jenkins.getInstance();
        if (j == null) {
            throw new IllegalStateException("Jenkins is not running");
        }
        return j.getInjector().createChildInjector(new ContextParameterModule(step,context));
    }
View Full Code Here

                if (Modifier.isAbstract(((Class) type).getModifiers())) {
                    throw new UnsupportedOperationException("must specify $class with an implementation of " + type);
                }
                clazz = (Class) type;
            } else if (clazzS.contains(".")) {
                Jenkins j = Jenkins.getInstance();
                ClassLoader loader = j != null ? j.getPluginManager().uberClassLoader : DescribableHelper.class.getClassLoader();
                clazz = loader.loadClass(clazzS);
            } else {
                clazz = null;
                for (Class<?> c : findSubtypes((Class<?>) type)) {
                    if (c.getSimpleName().equals(clazzS)) {
View Full Code Here

        return clazzes;
    }

    @SuppressWarnings("rawtypes")
    private static List<? extends Descriptor> getDescriptorList() {
        Jenkins j = Jenkins.getInstance();
        if (j != null) {
            // Jenkins.getDescriptorList does not work well since it is limited to descriptors declaring one supertype, and does not work at all for SimpleBuildStep.
            return j.getExtensionList(Descriptor.class);
        } else {
            // TODO should be part of ExtensionList.lookup in core, but here now for benefit of tests:
            List<Descriptor<?>> descriptors = new ArrayList<Descriptor<?>>();
            for (IndexItem<Extension,Object> item : Index.load(Extension.class, Object.class)) {
                try {
View Full Code Here

    public abstract @Nonnull Set<LabelAtom> getLabels();

    /** Reconstructs the live workspace, if possible. */
    public final @CheckForNull FilePath getWorkspace() {
        // TODO copied from FilePathPickle. WorkspaceListLeasePickle also needs to do the same. Perhaps we need to extract a FilePathHandle or similar?
        Jenkins j = Jenkins.getInstance();
        if (j == null) {
            return null;
        }
        Computer c = j.getComputer(getNode());
        if (c == null) {
            return null;
        }
        VirtualChannel ch = c.getChannel();
        if (ch == null) {
View Full Code Here

            // TODO 9: log to build console "awaiting completion of job xyz"
            return;
        }
       
    if (jn != null){
      Jenkins jenkins = Jenkins.getInstance();
      TopLevelItem it = jenkins.getItem(jn);
      if (it == null){
                LOG.info("unable to launch job "+jn+", it=null");
      }else if (!(it instanceof Project)){
          LOG.info("unable to launch job "+jn+", because it's not a Project, but just "+it.getClass());
      }else{
        // TODO 8: would like to have AbstractProject here, but it doesn't have BuildWrappers.
          Project p = (Project)it;
       
        DescribableList wrappers = p.getBuildWrappersList();
        JenkowBuildWrapper wrapper = new JenkowBuildWrapper();
        if (!wrappers.contains(wrapper.getDescriptor())) wrappers.add(wrapper);
       
        p.scheduleBuild2(jenkins.getQuietPeriod(),new WorkflowCause("triggered by workflow"),ja);
        return;
      }
    }
   
    // TODO 9: need test for Jenkins task with empty / non-existing job name
View Full Code Here

    public void setUp() {
        gerritHandlerMock = mock(GerritHandler.class);
        dispatcher = new ReplicationQueueTaskDispatcher(gerritHandlerMock, ReplicationCache.Factory.createCache());
        gerritTriggerMock = mock(GerritTrigger.class);
        queueMock = mock(Queue.class);
        Jenkins jenkinsMock = mock(Jenkins.class);
        when(jenkinsMock.getQueue()).thenReturn(queueMock);
        PowerMockito.mockStatic(Jenkins.class);
        when(Jenkins.getInstance()).thenReturn(jenkinsMock);
    }
View Full Code Here

TOP

Related Classes of jenkins.model.Jenkins

Copyright © 2018 www.massapicom. 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.