当前位置: 首页>>代码示例>>Java>>正文


Java CourseReader类代码示例

本文整理汇总了Java中edu.ksu.canvas.interfaces.CourseReader的典型用法代码示例。如果您正苦于以下问题:Java CourseReader类的具体用法?Java CourseReader怎么用?Java CourseReader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CourseReader类属于edu.ksu.canvas.interfaces包,在下文中一共展示了CourseReader类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: attendanceSummary_nonExistantSectionId

import edu.ksu.canvas.interfaces.CourseReader; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void attendanceSummary_nonExistantSectionId() throws Exception {
    Long nonExistantSectionId = 2000L;

    CourseReader mockCourseReader = mock(CourseReader.class);
    GetSingleCourseOptions testSingleCourseOptions = new GetSingleCourseOptions("");
    testSingleCourseOptions.includes(Collections.emptyList());
    when(mockCourseReader.getSingleCourse(testSingleCourseOptions)).thenReturn(Optional.<Course>empty());

    mockMvc.perform(get("/attendanceSummary/"+nonExistantSectionId))
        .andExpect(status().isOk())
        .andExpect(view().name("attendanceSummary"))
        .andExpect(model().attribute("selectedSectionId", is(nonExistantSectionId)))
        .andExpect(model().attribute("attendanceSummaryForSections", empty()))
        .andExpect(model().attribute("sectionList", empty()));
}
 
开发者ID:kstateome,项目名称:lti-attendance,代码行数:18,代码来源:AttendanceSummaryControllerITest.java

示例2: canvasApiFactory

import edu.ksu.canvas.interfaces.CourseReader; //导入依赖的package包/类
@Bean
public CanvasApiFactory canvasApiFactory() throws IOException {

    CanvasApiFactory mockApiFactory = Mockito.mock(CanvasApiFactory.class);

    CourseReader mockCourseReader = Mockito.mock(CourseReader.class);
    GetSingleCourseOptions mockGetSingleCourseOptions = new GetSingleCourseOptions(anyString());
    when(mockCourseReader.getSingleCourse(mockGetSingleCourseOptions)).thenReturn(Optional.of(new Course()));
    SectionReader mockSectionReader = Mockito.mock(SectionReader.class);
    when(mockSectionReader.listCourseSections(any(), any())).thenReturn(Collections.singletonList(buildFakeSection()));
    EnrollmentReader mockEnrollmentsReader = Mockito.mock(EnrollmentReader.class);
    when(mockEnrollmentsReader.getSectionEnrollments(new GetEnrollmentOptions(any()))).thenReturn(Collections.singletonList(buildFakeEnrollment()));

    when(mockApiFactory.getReader(eq(CourseReader.class), any(OauthToken.class))).thenReturn(mockCourseReader);
    when(mockApiFactory.getReader(eq(SectionReader.class), any(OauthToken.class))).thenReturn(mockSectionReader);
    when(mockApiFactory.getReader(eq(EnrollmentReader.class), any(OauthToken.class))).thenReturn(mockEnrollmentsReader);
    return mockApiFactory;
}
 
开发者ID:kstateome,项目名称:lti-attendance,代码行数:19,代码来源:ArquillianSpringMVCConfig.java

示例3: getOwnCourses

import edu.ksu.canvas.interfaces.CourseReader; //导入依赖的package包/类
public void getOwnCourses() throws IOException {
    CanvasApiFactory apiFactory = new CanvasApiFactory(canvasUrl);
    CourseReader courseReader = apiFactory.getReader(CourseReader.class, oauthToken);
    List<Course> myCourses = courseReader.listCurrentUserCourses(new ListCurrentUserCoursesOptions());
    LOG.info("Got " + myCourses.size() + " courses back from Canvas: ");
    for(Course course : myCourses) {
        LOG.info("  " + course.getName());
    }
}
 
开发者ID:kstateome,项目名称:canvas-api,代码行数:10,代码来源:TestLauncher.java

示例4: testGetCourseReader

import edu.ksu.canvas.interfaces.CourseReader; //导入依赖的package包/类
@Test
public void testGetCourseReader() {
    CourseReader courseReader = apiFactoryWithDefaultTimeout.getReader(CourseReader.class, SOME_OAUTH_TOKEN);
    Assert.assertNotNull("API factory did not return a course reader object", courseReader);
}
 
开发者ID:kstateome,项目名称:canvas-api,代码行数:6,代码来源:ApiFactoryUTest.java

示例5: testGetReaderWithTimeout

import edu.ksu.canvas.interfaces.CourseReader; //导入依赖的package包/类
@Test
public void testGetReaderWithTimeout() {
    apiFactory = new CanvasApiFactory(baseUrl, SOME_CONNECT_TIMEOUT, SOME_READ_TIMEOUT);
    CourseReader courseReader = apiFactory.getReader(CourseReader.class, SOME_OAUTH_TOKEN);
    Assert.assertNotNull("API factory did not return a course writer object", courseReader);
}
 
开发者ID:kstateome,项目名称:canvas-api,代码行数:7,代码来源:ApiFactoryUTest.java

示例6: validateOAuthToken

import edu.ksu.canvas.interfaces.CourseReader; //导入依赖的package包/类
/**
 * Perform a trivial Canvas operation to verify if the OAuth Token is valid.
 * This will typically be used when we want an integration to fail fast.
 * Some integrations might not notice that the OAuth token is invalid until
 * halfway into whatever it is that they do. This was initially the case
 * for the Scantron integration.
 *
 * @throws NoLtiSessionException       When there isn't a valid ltiExcpetion
 * @throws IOException                 when exception communicating with canvas
 */
public void validateOAuthToken() throws NoLtiSessionException, IOException {
    LtiSession ltiSession = ltiSessionService.getLtiSession();
    CourseReader courseReader = apiFactory.getReader(CourseReader.class, ltiSession.getOauthToken());
    //TODO: This should maybe call a different API endpoint. It was calling the user's todo list but
    //the API library doesn't have this call implemented yet. User's courses probably works but may
    //be a heaver API call.
    //If call succeeds without an exception being thrown, the token is valid 
    courseReader.listCurrentUserCourses(new ListCurrentUserCoursesOptions());
}
 
开发者ID:kstateome,项目名称:lti-launch,代码行数:20,代码来源:LtiLaunch.java


注:本文中的edu.ksu.canvas.interfaces.CourseReader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。