本文整理汇总了Java中org.sonatype.nexus.repository.Format类的典型用法代码示例。如果您正苦于以下问题:Java Format类的具体用法?Java Format怎么用?Java Format使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Format类属于org.sonatype.nexus.repository包,在下文中一共展示了Format类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setup
import org.sonatype.nexus.repository.Format; //导入依赖的package包/类
@Before
public void setup() {
underTest = new ComponentComponent();
underTest.setRepositoryManager(repositoryManager);
underTest.setContentPermissionChecker(contentPermissionChecker);
underTest.setVariableResolverAdapterManager(variableResolverAdapterManager);
underTest.setMaintenanceService(maintenanceService);
underTest.setBrowseService(browseService);
underTest.setJexlExpressionValidator(jexlExpressionValidator);
underTest.setCselExpressionValidator(cselExpressionValidator);
when(repositoryManager.get("testRepositoryName")).thenReturn(repository);
when(repository.getName()).thenReturn("testRepositoryName");
when(repository.getFormat()).thenReturn(new Format("testFormat") { });
when(repository.facet(ComponentMaintenance.class)).thenReturn(componentMaintenance);
when(repository.facet(StorageFacet.class)).thenReturn(storageFacet);
when(variableResolverAdapterManager.get("testFormat")).thenReturn(variableResolverAdapter);
when(storageFacet.txSupplier()).thenReturn(Suppliers.ofInstance(storageTx));
}
开发者ID:sonatype,项目名称:nexus-public,代码行数:20,代码来源:ComponentComponentTest.java
示例2: setup
import org.sonatype.nexus.repository.Format; //导入依赖的package包/类
@Before
public void setup() {
Map<String,Object> checksum = Maps.newHashMap(ImmutableMap.of(HashAlgorithm.SHA1.name(), "87acec17cd9dcd20a716cc2cf67417b71c8a7016"));
when(assetOne.name()).thenReturn("nameOne");
when(assetOne.getEntityMetadata()).thenReturn(assetOneEntityMetadata);
when(assetOne.attributes()).thenReturn(new NestedAttributesMap(Asset.CHECKSUM, checksum));
when(assetOneORID.toString()).thenReturn("assetOneORID");
when(assetOneEntityMetadata.getId()).thenReturn(assetOneEntityId);
when(assetOneEntityId.getValue()).thenReturn("assetOne");
when(repository.getName()).thenReturn("maven-releases");
when(repository.getUrl()).thenReturn("http://localhost:8081/repository/maven-releases");
when(repository.getFormat()).thenReturn(new Format("maven2") {});
}
开发者ID:sonatype,项目名称:nexus-public,代码行数:18,代码来源:AssetXOTest.java
示例3: createAsset
import org.sonatype.nexus.repository.Format; //导入依赖的package包/类
private Asset createAsset(final String assetName, final String assetId, final String format, final EntityId componentId) {
EntityMetadata entityMetadata = mock(EntityMetadata.class);
when(entityMetadata.getId()).thenReturn(new DetachedEntityId(assetId));
Asset asset = mock(Asset.class);
when(asset.getEntityMetadata()).thenReturn(entityMetadata);
when(asset.name()).thenReturn(assetName);
when(asset.format()).thenReturn(format);
if (componentId != null) {
when(asset.componentId()).thenReturn(componentId);
}
Format fmt = mock(Format.class);
when(fmt.getValue()).thenReturn(format);
when(repository.getFormat()).thenReturn(fmt);
return asset;
}
开发者ID:sonatype,项目名称:nexus-public,代码行数:20,代码来源:BrowseNodeManagerTest.java
示例4: setupConfig
import org.sonatype.nexus.repository.Format; //导入依赖的package包/类
@Before
public void setupConfig() throws Exception {
when(request.getPath()).thenReturn("/some/path.txt");
when(request.getAction()).thenReturn(HttpMethods.GET);
when(repository.getFormat()).thenReturn(new Format("conan") { });
when(repository.getName()).thenReturn("ConanSecurityFacetTest");
conanSecurityFacet = new ConanSecurityFacet(securityContributor,
variableResolverAdapter, contentPermissionChecker);
conanSecurityFacet.attach(repository);
}
开发者ID:sonatype-nexus-community,项目名称:nexus-repository-conan,代码行数:14,代码来源:ConanSecurityFacetTest.java
示例5: setup
import org.sonatype.nexus.repository.Format; //导入依赖的package包/类
@Before
public void setup() {
when(repo.getFormat()).thenReturn(new Format("m2")
{
});
when(repositoryManager.get(REPO_NAME)).thenReturn(repo);
UploadDefinition ud = new UploadDefinition("m2", true,
Arrays.asList(new UploadFieldDefinition("g", false, STRING), new UploadFieldDefinition("v", true, STRING)),
Arrays.asList(new UploadFieldDefinition("e", false, STRING), new UploadFieldDefinition("c", true, STRING)));
when(handler.getDefinition()).thenReturn(ud);
uploadManager = new UploadManagerImpl(Collections.singletonMap("m2", handler));
component = new UploadService(repositoryManager, uploadManager);
}
开发者ID:sonatype,项目名称:nexus-public,代码行数:16,代码来源:UploadServiceTest.java
示例6: setupConfig
import org.sonatype.nexus.repository.Format; //导入依赖的package包/类
@Before
public void setupConfig() throws Exception {
when(request.getPath()).thenReturn("/some/path.txt");
when(request.getAction()).thenReturn(HttpMethods.GET);
when(repository.getFormat()).thenReturn(new Format("raw") { });
when(repository.getName()).thenReturn("RawSecurityFacetTest");
rawSecurityFacet = new RawSecurityFacet(securityContributor,
variableResolverAdapter, contentPermissionChecker);
rawSecurityFacet.attach(repository);
}
开发者ID:sonatype,项目名称:nexus-public,代码行数:14,代码来源:RawSecurityFacetTest.java
示例7: sendNotFoundWhenLegacyUrlAndRepositoryNotFound
import org.sonatype.nexus.repository.Format; //导入依赖的package包/类
@Test
public void sendNotFoundWhenLegacyUrlAndRepositoryNotFound() throws Exception {
when(repository.getFormat()).thenReturn(new Format("raw") { });
when(repositoryManager.get(REPOSITORY_NAME)).thenReturn(null);
when(request.getPathInfo()).thenReturn("/test-repo/content.txt");
when(request.getRequestURI()).thenReturn("/content/sites/test-repo/content.txt");
viewServlet.doService(request, response);
ArgumentCaptor<Response> responseCaptor = ArgumentCaptor.forClass(Response.class);
verify(sender).send(eq(null), responseCaptor.capture(), eq(response));
assertThat(responseCaptor.getValue().getStatus().getCode(), is(equalTo(404)));
assertThat(responseCaptor.getValue().getStatus().getMessage(), is(equalTo(NOT_FOUND_MESSAGE)));
}
开发者ID:sonatype,项目名称:nexus-public,代码行数:15,代码来源:LegacyViewServletTest.java
示例8: sendNotFoundWhenLegacyUrlAndFormatDoesNotMatch
import org.sonatype.nexus.repository.Format; //导入依赖的package包/类
@Test
public void sendNotFoundWhenLegacyUrlAndFormatDoesNotMatch() throws Exception {
when(repository.getFormat()).thenReturn(new Format("yum") { });
when(request.getPathInfo()).thenReturn("/test-repo/content.txt");
when(request.getRequestURI()).thenReturn("/content/sites/test-repo/content.txt");
viewServlet.doService(request, response);
ArgumentCaptor<Response> responseCaptor = ArgumentCaptor.forClass(Response.class);
verify(sender).send(eq(null), responseCaptor.capture(), eq(response));
assertThat(responseCaptor.getValue().getStatus().getCode(), is(equalTo(NOT_FOUND)));
assertThat(responseCaptor.getValue().getStatus().getMessage(), is(equalTo(NOT_FOUND_MESSAGE)));
}
开发者ID:sonatype,项目名称:nexus-public,代码行数:14,代码来源:LegacyViewServletTest.java
示例9: mockRepository
import org.sonatype.nexus.repository.Format; //导入依赖的package包/类
private void mockRepository() {
when(repositoryManager.get(REPOSITORY_NAME)).thenReturn(repository);
when(repository.getConfiguration()).thenReturn(configuration);
when(repository.facet(ViewFacet.class)).thenReturn(viewFacet);
when(repository.getFormat()).thenReturn(new Format("maven") { });
when(configuration.isOnline()).thenReturn(true);
}
开发者ID:sonatype,项目名称:nexus-public,代码行数:8,代码来源:LegacyViewServletTest.java
示例10: RebuildMaven2MetadataTask
import org.sonatype.nexus.repository.Format; //导入依赖的package包/类
@Inject
public RebuildMaven2MetadataTask(@Named(HostedType.NAME) final Type hostedType,
@Named(Maven2Format.NAME) final Format maven2Format)
{
this.hostedType = checkNotNull(hostedType);
this.maven2Format = checkNotNull(maven2Format);
}
开发者ID:sonatype,项目名称:nexus-public,代码行数:8,代码来源:RebuildMaven2MetadataTask.java
示例11: PurgeMavenUnusedSnapshotsTask
import org.sonatype.nexus.repository.Format; //导入依赖的package包/类
@Inject
public PurgeMavenUnusedSnapshotsTask(@Named(GroupType.NAME) final Type groupType,
@Named(HostedType.NAME) final Type hostedType,
@Named(Maven2Format.NAME) final Format maven2Format)
{
this.groupType = checkNotNull(groupType);
this.hostedType = checkNotNull(hostedType);
this.maven2Format = checkNotNull(maven2Format);
}
开发者ID:sonatype,项目名称:nexus-public,代码行数:10,代码来源:PurgeMavenUnusedSnapshotsTask.java
示例12: RepositoryImpl
import org.sonatype.nexus.repository.Format; //导入依赖的package包/类
@Inject
public RepositoryImpl(final EventManager eventManager,
@Assisted final Type type,
@Assisted final Format format)
{
this.eventManager = checkNotNull(eventManager);
this.type = checkNotNull(type);
this.format = checkNotNull(format);
}
开发者ID:sonatype,项目名称:nexus-public,代码行数:10,代码来源:RepositoryImpl.java
示例13: createComponent
import org.sonatype.nexus.repository.Format; //导入依赖的package包/类
@Override
@Guarded(by = ACTIVE)
public Component createComponent(final Bucket bucket, final Format format) {
checkNotNull(bucket);
checkNotNull(format);
Component component = componentFactory.createComponent();
component.bucketId(id(bucket));
component.format(format.toString());
component.attributes(new NestedAttributesMap(P_ATTRIBUTES, new HashMap<>()));
return component;
}
开发者ID:sonatype,项目名称:nexus-public,代码行数:13,代码来源:StorageTxImpl.java
示例14: setupConfig
import org.sonatype.nexus.repository.Format; //导入依赖的package包/类
@Before
public void setupConfig() throws Exception {
when(request.getPath()).thenReturn("/some/path.txt");
when(request.getAction()).thenReturn(HttpMethods.GET);
when(repository.getFormat()).thenReturn(new Format("test") { });
when(repository.getName()).thenReturn("SecurityFacetSupportTest");
testSecurityFacetSupport = new TestSecurityFacetSupport(securityContributor,
variableResolverAdapter, contentPermissionChecker);
testSecurityFacetSupport.attach(repository);
}
开发者ID:sonatype,项目名称:nexus-public,代码行数:14,代码来源:SecurityFacetSupportTest.java
示例15: testFromRequest
import org.sonatype.nexus.repository.Format; //导入依赖的package包/类
@Test
public void testFromRequest() throws Exception {
when(request.getPath()).thenReturn(TEST_PATH_WITH_SLASH);
when(repository.getName()).thenReturn("SimpleVariableResolverAdapterTest");
when(repository.getFormat()).thenReturn(new Format(TEST_FORMAT) { });
SimpleVariableResolverAdapter simpleVariableResolverAdapter = new SimpleVariableResolverAdapter();
VariableSource source = simpleVariableResolverAdapter.fromRequest(request, repository);
assertThat(source.getVariableSet(), containsInAnyOrder(FORMAT_VARIABLE, PATH_VARIABLE));
assertThat(source.get(FORMAT_VARIABLE).get(), is(TEST_FORMAT));
assertThat(source.get(PATH_VARIABLE).get(), is(TEST_PATH_WITH_SLASH));
}
开发者ID:sonatype,项目名称:nexus-public,代码行数:13,代码来源:SimpleVariableResolverAdapterTest.java
示例16: testHandle
import org.sonatype.nexus.repository.Format; //导入依赖的package包/类
@Test
public void testHandle() throws IOException {
Repository repository = mock(Repository.class);
when(repository.getFormat()).thenReturn(new Format("a")
{
});
ComponentUpload component = mock(ComponentUpload.class);
when(component.getAssetUploads()).thenReturn(Collections.singletonList(new AssetUpload()));
underTest.handle(repository, component);
verify(handlerA, times(1)).handle(repository, component);
verify(handlerB, never()).handle(repository, component);
// Try the other, to be sure!
reset(handlerA, handlerB);
when(handlerB.getDefinition()).thenReturn(uploadB);
when(repository.getFormat()).thenReturn(new Format("b")
{
});
underTest.handle(repository, component);
verify(handlerB, times(1)).handle(repository, component);
verify(handlerA, never()).handle(repository, component);
}
开发者ID:sonatype,项目名称:nexus-public,代码行数:28,代码来源:UploadManagerImplTest.java
示例17: testHandle_unsupportedRepositoryFormat
import org.sonatype.nexus.repository.Format; //导入依赖的package包/类
@Test
public void testHandle_unsupportedRepositoryFormat() throws IOException {
ComponentUpload component = mock(ComponentUpload.class);
Repository repository = mock(Repository.class);
when(repository.getFormat()).thenReturn(new Format("c")
{
});
expectExceptionOnUpload(repository, component, "Uploading components to 'c' repositories is unsupported");
}
开发者ID:sonatype,项目名称:nexus-public,代码行数:11,代码来源:UploadManagerImplTest.java
示例18: before
import org.sonatype.nexus.repository.Format; //导入依赖的package包/类
@Before
public void before() throws Exception {
when(uriInfo.getAbsolutePath()).thenReturn(UriBuilder.fromPath(URL_PREFIX + "central/").build());
when(securityHelper.allPermitted(any())).thenReturn(true);
when(templateHelper.parameters()).thenReturn(new TemplateParameters());
when(templateHelper.render(any(),any())).thenReturn("something");
when(repository.getName()).thenReturn(REPOSITORY_NAME);
when(repository.getFormat()).thenReturn(new Format("format") {});
when(repository.getType()).thenReturn(new ProxyType());
when(repository.optionalFacet(GroupFacet.class)).thenReturn(Optional.empty());
when(repository.facet(StorageFacet.class)).thenReturn(storageFacet);
when(storageFacet.txSupplier()).thenReturn(txSupplier);
when(txSupplier.get()).thenReturn(storageTx);
when(storageTx.findAsset(any())).thenReturn(asset);
EntityId bucketId = mock(EntityId.class);
when(asset.bucketId()).thenReturn(bucketId);
when(bucketStore.getById(bucketId)).thenReturn(bucket);
when(bucket.getRepositoryName()).thenReturn(REPOSITORY_NAME);
when(browseNodeStore
.getByPath(repository, Collections.emptyList(), configuration.getMaxHtmlNodes(), null))
.thenReturn(Collections.singleton(browseNode("org")));
when(browseNodeStore
.getByPath(repository, Collections.singletonList("org"), configuration.getMaxHtmlNodes(), null))
.thenReturn(Collections.singleton(browseNode("sonatype")));
when(repositoryManager.get(REPOSITORY_NAME)).thenReturn(repository);
underTest = new RepositoryBrowseResource(repositoryManager, browseNodeStore, configuration, bucketStore,
templateHelper, securityHelper);
}
开发者ID:sonatype,项目名称:nexus-public,代码行数:37,代码来源:RepositoryBrowseResourceTest.java
示例19: validateAsset_groupRepository
import org.sonatype.nexus.repository.Format; //导入依赖的package包/类
@Test
public void validateAsset_groupRepository() throws Exception {
String filter = "test";
Repository groupRepository = mock(Repository.class);
when(groupRepository.getType()).thenReturn(new GroupType());
when(groupRepository.getName()).thenReturn("group-repository");
when(groupRepository.getFormat()).thenReturn(new Format("format") {});
when(groupRepository.facet(StorageFacet.class)).thenReturn(storageFacet);
GroupFacet groupFacet = mock(GroupFacet.class);
when(groupFacet.allMembers()).thenReturn(Arrays.asList(groupRepository, repository));
when(groupRepository.optionalFacet(GroupFacet.class)).thenReturn(Optional.of(groupFacet));
when(repositoryManager.get("group-repository")).thenReturn(groupRepository);
List<BrowseNode> nodes = asList(browseNode("a.txt", mock(EntityId.class), true));
when(asset.size()).thenReturn(1024L);
when(asset.blobUpdated()).thenReturn(new DateTime(0));
when(asset.name()).thenReturn("a1.txt");
when(groupRepository.getUrl()).thenReturn("http://foo/bar");
when(browseNodeStore
.getByPath(groupRepository, Collections.emptyList(), configuration.getMaxHtmlNodes(), filter))
.thenReturn(nodes);
underTest.getHtml("group-repository", "", filter, uriInfo);
ArgumentCaptor<TemplateParameters> argument = ArgumentCaptor.forClass(TemplateParameters.class);
verify(templateHelper).render(any(), argument.capture());
List<BrowseListItem> listItems = (List<BrowseListItem>) argument.getValue().get().get("listItems");
assertThat(listItems.size(), is(1));
BrowseListItem item = listItems.get(0);
assertThat(item.getName(), is("a.txt"));
assertThat(item.getSize(), is("1024"));
assertThat(item.getLastModified(), is(format.format(asset.blobUpdated().toDate())));
assertThat(item.getResourceUri(), is("http://foo/bar/a1.txt"));
}
开发者ID:sonatype,项目名称:nexus-public,代码行数:37,代码来源:RepositoryBrowseResourceTest.java
示例20: validateFilterAppliedToNonAssetUrls
import org.sonatype.nexus.repository.Format; //导入依赖的package包/类
@Test
public void validateFilterAppliedToNonAssetUrls() throws Exception {
String filter = "test/test";
Repository groupRepository = mock(Repository.class);
when(groupRepository.getType()).thenReturn(new GroupType());
when(groupRepository.getName()).thenReturn("group-repository");
when(groupRepository.getFormat()).thenReturn(new Format("format") { });
when(groupRepository.facet(StorageFacet.class)).thenReturn(storageFacet);
GroupFacet groupFacet = mock(GroupFacet.class);
when(groupFacet.allMembers()).thenReturn(Arrays.asList(groupRepository, repository));
when(groupRepository.optionalFacet(GroupFacet.class)).thenReturn(Optional.of(groupFacet));
when(repositoryManager.get("group-repository")).thenReturn(groupRepository);
List<BrowseNode> nodes = asList(browseNode("bar"));
when(groupRepository.getUrl()).thenReturn("http://foo/");
when(browseNodeStore
.getByPath(groupRepository, Collections.emptyList(), configuration.getMaxHtmlNodes(), filter))
.thenReturn(nodes);
underTest.getHtml("group-repository", "", filter, uriInfo);
ArgumentCaptor<TemplateParameters> argument = ArgumentCaptor.forClass(TemplateParameters.class);
verify(templateHelper).render(any(), argument.capture());
List<BrowseListItem> listItems = (List<BrowseListItem>) argument.getValue().get().get("listItems");
assertThat(listItems.size(), is(1));
BrowseListItem item = listItems.get(0);
assertThat(item.getName(), is("bar"));
assertThat(item.getResourceUri(), is("bar/?filter=test%2Ftest"));
}
开发者ID:sonatype,项目名称:nexus-public,代码行数:32,代码来源:RepositoryBrowseResourceTest.java
注:本文中的org.sonatype.nexus.repository.Format类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论