本文整理汇总了Java中org.sonatype.nexus.repository.Format类的典型用法代码示例。如果您正苦于以下问题:Java Format类的具体用法?Java Format怎么用?Java Format使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Format类属于org.sonatype.nexus.repository包,在下文中一共展示了Format类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
}
示例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") {});
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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)));
}
示例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)));
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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));
}