Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,23 @@ public Builder withMavenInfoAndType( ProjectVersionRef gav )
return this;
}

public Builder withRpmInfoAndType(ProjectVersionRef gav )
{
if ( target.extraInfo == null )
{
target.extraInfo = new BuildExtraInfo();
}
target.extraInfo.setMavenRpm(gav.toString());

if (target.extraInfo.getTypeInfo() == null)
{
target.extraInfo.setTypeInfo( new TypeInfoExtraInfo() );
}
target.extraInfo.getTypeInfo().setRpmTypeInfoExtraInfo( RpmTypeInfoExtraInfo.getInstance() );

return this;
}

public Builder withNpmInfoAndType( NpmPackageRef nv )
{
NpmExtraInfo npmExtraInfo = new NpmExtraInfo( nv.getName(), nv.getVersion().toString() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
package com.redhat.red.build.koji.model.json;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonInclude.Include;

import com.fasterxml.jackson.annotation.JsonProperty;
import org.commonjava.atlas.maven.ident.ref.ProjectVersionRef;
import org.commonjava.atlas.npm.ident.ref.NpmPackageRef;
import org.commonjava.rwx.anno.DataKey;
Expand All @@ -34,6 +33,7 @@
import static com.redhat.red.build.koji.model.json.KojiJsonConstants.IMAGE_INFO;
import static com.redhat.red.build.koji.model.json.KojiJsonConstants.IMPORT_INITIATOR;
import static com.redhat.red.build.koji.model.json.KojiJsonConstants.MAVEN_INFO;
import static com.redhat.red.build.koji.model.json.KojiJsonConstants.MAVEN_RPM;
import static com.redhat.red.build.koji.model.json.KojiJsonConstants.NPM_INFO;
import static com.redhat.red.build.koji.model.json.KojiJsonConstants.OSBS_BUILD;
import static com.redhat.red.build.koji.model.json.KojiJsonConstants.SCM_TAG;
Expand Down Expand Up @@ -87,6 +87,10 @@ public class BuildExtraInfo
@DataKey( SCM_TAG )
private String scmTag;

@JsonProperty( MAVEN_RPM )
@DataKey( MAVEN_RPM )
private String mavenRpm;

@JsonProperty( OSBS_BUILD )
@DataKey( OSBS_BUILD )
private OsbsBuildExtraInfo osbsBuild;
Expand Down Expand Up @@ -265,12 +269,12 @@ public boolean equals( Object o )
}

BuildExtraInfo that = (BuildExtraInfo ) o;
return Objects.equals( mavenExtraInfo, that.mavenExtraInfo ) && Objects.equals( npmExtraInfo, that.npmExtraInfo ) && Objects.equals( imageExtraInfo, that.imageExtraInfo ) && Objects.equals( externalBuildId, that.externalBuildId ) && Objects.equals( buildSystem, that.buildSystem ) && Objects.equals( externalBuildUrl, that.externalBuildUrl ) && Objects.equals( importInitiator, that.importInitiator ) && Objects.equals( scmTag, that.scmTag ) && Objects.equals( typeInfo, that.typeInfo ) && Objects.equals( containerKojiTaskId, that.containerKojiTaskId ) && Objects.equals( filesystemKojiTaskId, that.filesystemKojiTaskId ) && Objects.equals( osbsBuild, that.osbsBuild ) && Objects.equals( submitter, that.submitter );
return Objects.equals( mavenExtraInfo, that.mavenExtraInfo ) && Objects.equals( npmExtraInfo, that.npmExtraInfo ) && Objects.equals( imageExtraInfo, that.imageExtraInfo ) && Objects.equals( externalBuildId, that.externalBuildId ) && Objects.equals( buildSystem, that.buildSystem ) && Objects.equals( externalBuildUrl, that.externalBuildUrl ) && Objects.equals( importInitiator, that.importInitiator ) && Objects.equals( scmTag, that.scmTag ) && Objects.equals( mavenRpm, that.mavenRpm )&& Objects.equals( typeInfo, that.typeInfo ) && Objects.equals( containerKojiTaskId, that.containerKojiTaskId ) && Objects.equals( filesystemKojiTaskId, that.filesystemKojiTaskId ) && Objects.equals( osbsBuild, that.osbsBuild ) && Objects.equals( submitter, that.submitter );
}

@Override
public int hashCode() {
return Objects.hash( mavenExtraInfo, npmExtraInfo, imageExtraInfo, externalBuildId, buildSystem, externalBuildUrl, importInitiator, scmTag, typeInfo, containerKojiTaskId, filesystemKojiTaskId, osbsBuild, submitter );
return Objects.hash( mavenExtraInfo, npmExtraInfo, imageExtraInfo, externalBuildId, buildSystem, externalBuildUrl, importInitiator, scmTag, mavenRpm, typeInfo, containerKojiTaskId, filesystemKojiTaskId, osbsBuild, submitter );
}

@Override
Expand All @@ -287,9 +291,18 @@ public String toString()
", externalBuildUrl='" + externalBuildUrl + '\'' +
", importInitiator='" + importInitiator + '\'' +
", scmTag='" + scmTag + '\'' +
", mavenRpm='" + mavenRpm + '\'' +
", typeInfo=" + typeInfo +
", osbsBuild=" + osbsBuild +
", submitter='" + submitter + '\'' +
'}';
}

public String getMavenRpm() {
return mavenRpm;
}

public void setMavenRpm(String mavenRpm) {
this.mavenRpm = mavenRpm;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,12 @@ public Builder withNpmInfoAndType( NpmPackageRef ref )
return this;
}

public Builder withRpmInfoAndType()
{
target.outputType = StandardOutputType.rpm.getName();
return this;
}

public Builder withRemoteSourcesInfoAndType( List<RemoteSourcesExtraInfo> sourcesExtraInfo )
{
target.outputType = StandardOutputType.remote_sources.getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,12 @@ public int hashCode()
result = 31 * result + ( getRevision() != null ? getRevision().hashCode() : 0 );
return result;
}

@Override
public String toString() {
return "BuildSource{" +
"url='" + url + '\'' +
", revision='" + revision + '\'' +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (C) 2015 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.redhat.red.build.koji.model.json;

/**
* Created by pkocandr on 06/22/21
*/
abstract public class EmptyTypeInfoExtraInfo {

public EmptyTypeInfoExtraInfo() {
}

@Override
public String toString() {
return "EmptyTypeInfoExtraInfo{}";
}

@Override
public boolean equals(Object o) {
if (!(o instanceof EmptyTypeInfoExtraInfo)) {
return false;
}
return true;
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
package com.redhat.red.build.koji.model.json;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonInclude.Include;

import com.fasterxml.jackson.annotation.JsonProperty;
import org.commonjava.atlas.maven.ident.ref.ProjectVersionRef;
import org.commonjava.rwx.anno.DataKey;
import org.commonjava.rwx.anno.StructPart;
Expand Down Expand Up @@ -46,18 +45,18 @@ public class FileExtraInfo
@DataKey( TYPEINFO )
private TypeInfoExtraInfo typeInfo;

public FileExtraInfo( @JsonProperty( MAVEN_INFO ) MavenExtraInfo mavenExtraInfo )
{
this.mavenExtraInfo = mavenExtraInfo;
}

public FileExtraInfo( @JsonProperty( NPM_INFO ) NpmExtraInfo npmExtraInfo,
@JsonProperty( TYPEINFO ) TypeInfoExtraInfo typeInfo )
{
this.npmExtraInfo = npmExtraInfo;
this.typeInfo = typeInfo;
}

public FileExtraInfo( @JsonProperty( MAVEN_INFO ) MavenExtraInfo mavenExtraInfo )
{
this.mavenExtraInfo = mavenExtraInfo;
}

public FileExtraInfo( @JsonProperty( TYPEINFO ) TypeInfoExtraInfo typeInfo )
{
this.typeInfo = typeInfo;
Expand Down Expand Up @@ -154,7 +153,7 @@ else if ( getNpmExtraInfo() != null )
{
return "FileExtraInfo{" + "npmExtraInfo=" + npmExtraInfo + "}";
}
else if ( getMavenExtraInfo() != null )
else if ( getTypeInfo() != null )

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was duplicating a getMavenExtraInfo from line 149.

{
return "FileExtraInfo{" + "typeInfo=" + typeInfo + "}";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ public final class KojiJsonConstants

public static final String MAVEN_OUTPUT_TYPE = "maven";

public static final String MAVEN_RPM = "maven_rpm";

public static final String MD5_CHECKSUM_TYPE = "md5";

public static final String METADATA_VERSION = "metadata_version";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,46 +1,19 @@
/*
* Copyright (C) 2015 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.redhat.red.build.koji.model.json;

import org.commonjava.rwx.anno.StructPart;

/**
* Created by pkocandr on 06/22/21
*/
@StructPart
public class NpmTypeInfoExtraInfo
{
private static NpmTypeInfoExtraInfo instance;
public class NpmTypeInfoExtraInfo extends EmptyTypeInfoExtraInfo {
protected static NpmTypeInfoExtraInfo instance;

public NpmTypeInfoExtraInfo()
{
public NpmTypeInfoExtraInfo() {
}

public static NpmTypeInfoExtraInfo getInstance() {
if (instance == null)
{
if (instance == null) {
// if instance is null, initialize
instance = new NpmTypeInfoExtraInfo();
}
return instance;
}

@Override
public String toString()
{
return "NpmTypeInfoExtraInfo{}";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.redhat.red.build.koji.model.json;

import org.commonjava.rwx.anno.StructPart;

@StructPart
public class RpmTypeInfoExtraInfo extends EmptyTypeInfoExtraInfo {
protected static RpmTypeInfoExtraInfo instance;

public RpmTypeInfoExtraInfo() {
}

public static RpmTypeInfoExtraInfo getInstance() {
if (instance == null) {
// if instance is null, initialize
instance = new RpmTypeInfoExtraInfo();
}
return instance;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
*/
public enum StandardArchitecture
{
i386, x86_64, noarch;
i386, x86_64, noarch, src;
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public enum StandardOutputType
maven("maven"),
remote_sources("remote-sources"),
REMOTE_SOURCE_FILE("remote-source-file"),
npm("npm");

npm("npm"),
rpm("rpm");
private String name;

StandardOutputType(String name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import static com.redhat.red.build.koji.model.json.KojiJsonConstants.NPM_TYPE_INFO;
import static com.redhat.red.build.koji.model.json.KojiJsonConstants.REMOTE_SOURCES;
import static com.redhat.red.build.koji.model.json.KojiJsonConstants.REMOTE_SOURCE_FILE;
import static com.redhat.red.build.koji.model.json.KojiJsonConstants.RPM;

/**
* Created by jbrazdil on 2021-04-08.
Expand All @@ -51,6 +52,10 @@ public class TypeInfoExtraInfo
@DataKey( NPM_TYPE_INFO )
private NpmTypeInfoExtraInfo npmTypeInfoExtraInfo;

@JsonProperty( RPM )
@DataKey( RPM )
private RpmTypeInfoExtraInfo rpmTypeInfoExtraInfo;

@JsonProperty( IMAGE_INFO )
@DataKey( IMAGE_INFO )
private ImageExtraInfo imageExtraInfo;
Expand Down Expand Up @@ -114,6 +119,16 @@ public void setNpmTypeInfoExtraInfo( NpmTypeInfoExtraInfo npmTypeInfoExtraInfo )
this.npmTypeInfoExtraInfo = npmTypeInfoExtraInfo;
}

public RpmTypeInfoExtraInfo getRpmTypeInfoExtraInfo()
{
return rpmTypeInfoExtraInfo;
}

public void setRpmTypeInfoExtraInfo( RpmTypeInfoExtraInfo rpmTypeInfoExtraInfo )
{
this.rpmTypeInfoExtraInfo = rpmTypeInfoExtraInfo;
}

public ImageExtraInfo getImageExtraInfo()
{
return imageExtraInfo;
Expand Down Expand Up @@ -143,17 +158,17 @@ public boolean equals( Object o )
}

TypeInfoExtraInfo that = (TypeInfoExtraInfo) o;
return Objects.equals( remoteSourcesExtraInfo, that.remoteSourcesExtraInfo ) && Objects.equals( remoteSourceFileExtraInfo, that.remoteSourceFileExtraInfo ) && Objects.equals( npmTypeInfoExtraInfo, that.npmTypeInfoExtraInfo ) && Objects.equals( imageExtraInfo, that.imageExtraInfo ) && Objects.equals( icmExtraInfo, that.icmExtraInfo );
return Objects.equals( remoteSourcesExtraInfo, that.remoteSourcesExtraInfo ) && Objects.equals( remoteSourceFileExtraInfo, that.remoteSourceFileExtraInfo ) && Objects.equals( npmTypeInfoExtraInfo, that.npmTypeInfoExtraInfo ) && Objects.equals( rpmTypeInfoExtraInfo, that.rpmTypeInfoExtraInfo )&& Objects.equals( imageExtraInfo, that.imageExtraInfo ) && Objects.equals( icmExtraInfo, that.icmExtraInfo );
}

@Override
public int hashCode()
{
return Objects.hash( remoteSourcesExtraInfo, remoteSourceFileExtraInfo, npmTypeInfoExtraInfo, imageExtraInfo, icmExtraInfo );
return Objects.hash( remoteSourcesExtraInfo, remoteSourceFileExtraInfo, npmTypeInfoExtraInfo, rpmTypeInfoExtraInfo, imageExtraInfo, icmExtraInfo );
}

@Override
public String toString() {
return "TypeInfoExtraInfo{remoteSourcesExtraInfo=" + remoteSourcesExtraInfo + ", remoteSourceFileExtraInfo=" + remoteSourceFileExtraInfo + ", npmTypeInfoExtraInfo=" + npmTypeInfoExtraInfo + ", imageExtraInfo=" + imageExtraInfo + ", icmExtraInfo=" + icmExtraInfo + '}';
return "TypeInfoExtraInfo{remoteSourcesExtraInfo=" + remoteSourcesExtraInfo + ", remoteSourceFileExtraInfo=" + remoteSourceFileExtraInfo + ", npmTypeInfoExtraInfo=" + npmTypeInfoExtraInfo + ", rpmTypeInfoExtraInfo=" + rpmTypeInfoExtraInfo + ", imageExtraInfo=" + imageExtraInfo + ", icmExtraInfo=" + icmExtraInfo + '}';
}
}
44 changes: 0 additions & 44 deletions src/test/java/com/redhat/red/build/koji/MiscProofs.java

This file was deleted.

Loading